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 lw = new List(); 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", "
").Replace("\n", "
"); //con = con.Replace(" ", " "); return con; } } }