| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using SQLData;
- using System.Data;
- using System.Text;
- namespace SiteCore.Handler
- {
- public partial class sync
- {
- public void get_zdmodel()
- {
- if (UrlPostParmsCheck("path"))
- {
- string path = GetPostString("path");
- string sql = "select name,con,issys from ce_columns where cpath='" + path + "'";
- DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
- returnSuccess(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
- }
- }
- public void save_zdmodel()
- {
- if (UrlPostParmsCheck("path,cdata"))
- {
- int uid = CurrentUser.UserID;
- string path = GetPostString("path");
- string cdata = GetPostString("cdata");
- string name = GetPostString("name");
- StringBuilder sql = new StringBuilder();
- sql.AppendFormat("if (select count(0) from ce_columns where name='{0}' and cpath='{1}')>0 begin ", name, path);
- sql.AppendFormat(" update ce_columns set con='{0}' where name='{1}' and cpath='{2}' ", cdata, name, path);
- sql.AppendFormat(" end else begin ");
- sql.AppendFormat(" insert into ce_columns(userid,name,cpath,con) values({0},'{1}','{2}','{3}') ", uid, name, path, cdata);
- sql.Append(" end ");
- DbHelper.DbConn.ExecuteNonQuery(sql.ToString());
- returnSuccessMsg("保存成功");
- }
- }
- public void del_zdmodel()
- {
- if (UrlPostParmsCheck("name,path"))
- {
- string name = GetPostString("name");
- string path = GetPostString("path");
- string sql = string.Format("delete from ce_columns where name='{0}' and cpath='{1}' and issys=0 ;", name, path);
- int c = DbHelper.DbConn.ExecuteNonQuery(sql);
- if (c > 0) returnSuccessMsg("删除成功");
- else returnSuccessMsg("无法删除");
- }
- }
- }
- }
|