| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using BizCom;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SiteCore.Handler
- {
- public partial class sync
- {
- //save_inst
- public void get_inst()
- {
- DataStruct dStruct = GetStruct();
- List<string> lw = new List<string>();
- string key = GetPostString("key");
- if (key.Length > 0) lw.Add(string.Format("name like '%{0}%'", key));
- dStruct.Order = "id desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("s_inst", dStruct);
- writeGridJson(dStruct.TotalCount, Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
- }
- public void del_inst()
- {
- if (UrlParmsCheck("eid"))
- {
- int eid = GetInt("eid");
- SInst.Del(eid);
- returnSuccessMsg("删除成功");
- }
- }
- public void save_inst()
- {
- if (UrlPostParmsCheck("name"))
- {
- //,address,phone,contex
- int eid = GetPostInt("eid");
- string name = GetPostString("name");
- int num = GetPostInt("num");
- string imgs = GetPostString("imgs");
- string address = GetPostString("address");
- string phone = GetPostString("phone");
- string contex = GetPostString("contex");
- string teacher = GetPostString("teacher");
- string intro = GetPostString("intro");
- string tags = GetPostString("tags");
- double stars = GetPostDouble("stars");
- string lnglat = GetPostString("lnglat");
- string blnglat = GetPostString("blnglat");
- SInst entity = null;
- if (eid > 0) entity = SInst.Get(eid);
- else entity = new SInst();
- entity.Name = name;
- if (imgs.Length > 0)
- {
- string[] sArr = imgs.Split(',');
- if (num > 0)
- {
- if (sArr.Length >= num) entity.CoverImg = sArr[num - 1];
- }
- else
- {
- entity.CoverImg = sArr[0];
- }
- }
- entity.Imgs = imgs;
- entity.Address = address;
- entity.Phone = phone;
- entity.Contex = getFormartBr(contex);
- entity.TeacherRes = getFormartBr(teacher);
- if (lnglat != "")
- {
- string[] lArr = lnglat.Split(',');
- entity.Lng = lArr[0];
- entity.Lat = lArr[1];
- }
- if(blnglat!="")
- {
- string[] lArr = blnglat.Split(',');
- entity.bLng = lArr[0];
- entity.bLat = lArr[1];
- }
- entity.Stars = stars;
- entity.Tags = tags;
- entity.Traffic = getFormartBr(intro);
- //entity.Con = intro;
- if (eid > 0) entity.Update();
- else entity.Create();
- returnSuccessMsg("保存成功!");
- }
- }
- public string getFormartBr(string con)
- {
- con = con.Replace("\r\n", "<br>").Replace("\n", "<br>");
- //con = con.Replace(" ", " ");
- return con;
- }
- }
- }
|