| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- using BizCom;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- namespace SiteCore.Handler
- {
- public partial class app
- {
- #region dic
- private string getDicClassName(string pType)
- {
- //转成大小写
- switch (pType)
- {
- case "modular":
- {
- return "XModular";
- }
- }
- return pType;
- }
- public void get_dic_item()
- {
- if (UrlParmsCheck("class,mId"))
- {
- string c = GetString("class");
- string mId = GetString("mId");
- DicSysBase sysBase = GetReflectionObject(c) as DicSysBase;
- DataTable dt = sysBase.GetDataTable("ID=" + mId);
- if (dt != null && dt.Rows.Count > 0)
- {
- returnSuccess(Utils.Serialization.JsonString.DataTable2AjaxJson(dt));
- }
- }
- }
- public void del_dic_item()
- {
- if (UrlParmsCheck("class,mId"))
- {
- string c = GetString("class");
- string mId = GetString("mId");
- DicSysBase sysBase = GetReflectionObject(c) as DicSysBase;
- DicSysBase entity = sysBase.GetEntity(mId) as DicSysBase;
- if (entity != null)
- {
- entity.DelChild(entity.ID);
- entity.Delete();
- returnSuccessMsg(entity.ParentID + "|删除成功!");
- }
- }
- }
- public void build_dic_item()
- {
- if (UrlParmsCheck("mId"))
- {
- string mId = GetString("mId");
- XModular.BuilderOperate(mId);
- returnSuccessMsg(mId + "|生成成功!");
- }
- }
- public void transfer_dic_item()
- {
- if (UrlParmsCheck("mId,pId,sort"))
- {
- string mId = GetString("mId");
- int pId = GetInt("pId");
- int sort = GetInt("sort");
- string c = GetString("class");
- DicSysBase sysBase = GetReflectionObject(getDicClassName(c)) as DicSysBase;
- sysBase.TransModular(mId, pId, sort, sysBase.tableName);
- returnSuccessMsg(mId + "|转移成功!");
- }
- }
- public void line_dic_item()
- {
- if (UrlParmsCheck("mId,st,et"))
- {
- string mId = GetString("mId");
- string prev = GetString("prev");
- int st = GetInt("st");
- int et = GetInt("et");
- string c = GetString("class");
- DicSysBase sysBase = GetReflectionObject(getDicClassName(c)) as DicSysBase;
- sysBase.SaveLine(mId, prev, st, et, sysBase.tableName);
- returnSuccessMsg(mId + "|生成成功!");
- }
- }
-
- public void save_dic_item()
- {
- if (UrlParmsCheck("id,pid,name,class"))
- {
- string c = GetString("class");
- int id = GetInt("id");
- int pid = GetInt("pid");
- string name = GetString("name");
- string code = GetString("code");
- int sort = GetInt("sort");
- int del = GetInt("del");
- string memo = GetString("memo");
- string url = GetString("url");
- string tag = GetString("tag");
- string icon = GetString("icon");
- int operate = GetInt("operate");
- string cName = c;// getDicClassName(c);
- if (cName == "")
- {
- return;
- }
- DicSysBase sysBase = GetReflectionObject(cName) as DicSysBase;
- DicSysBase entity = null;
- if (id > 0)
- {
- entity = sysBase.GetEntity(id) as DicSysBase;
- }
- else
- {
- entity = sysBase;
- }
- entity.ParentID = pid;
- entity.Name = name;
- entity.Code = code;
- entity.Sort = sort;
- entity.IsDel = (del == 1 ? true : false);
- entity.Memo = memo;
- switch (c)
- {
- case "XModular":
- {
- entity.Url = url;
- entity.Tag = tag;
- entity.Icon = icon;
- entity.isOperate = (operate == 1 ? true : false);
- break;
- }
- case "hoststation":
- {
- entity.HostFieldName = GetString("hostfield");
- entity.HostName = GetString("hostname");
- entity.MaxStock = GetDouble("maxstock");
- entity.WarningStock = GetDouble("warningstock");
- break;
- }
- }
- if (entity.ParentID > 0)
- {
- DataRow dr = sysBase.GetParentFields("Path,Code", entity.ParentID);
- string parentPath = dr["Path"].ToString();
- entity.Path = parentPath == "" ? "|" + entity.ParentID + "|" : parentPath + entity.ParentID + "|";
- if (c == "opt")
- {
- entity.PCode = dr["Code"].ToString();
- }
- }
- if (id > 0) entity.Update();
- else entity.Create();
- switch (c)
- {
- case "XModular":
- {
- //去除己保存的所有权限
- //WebUser.ClearPermissionCache();
- break;
- }
- }
- returnSuccessMsg(entity.ID + "|保存成功");
- }
- }
- #endregion
- #region category
- private string getCTable(string t)
- {
- switch (t)
- {
- case "utype":
- {
- return "ce_erpunittype";
- }
- case "cartype":
- {
- return "ce_erpcartype";
- }
- case "paymenttype":
- {
- return "ce_erppaymenttype";
- }
- case "transgrade":
- {
- return "ce_erptransgrade";
- }
- }
- return "";
- }
- public void get_category()
- {
- string cate = GetPostString("cate");
- if (cate != "")
- {
- DataTable dt = null;
- dt = CategoryService.GetCategory(getCTable(cate), "");
- writeGridJson(dt.Rows.Count, Utils.Serialization.JsonString.DataTable2AjaxJson(dt));
- }
- }
- public void del_category()
- {
- if (UrlParmsCheck("sId,cate"))
- {
- int sId = GetInt("sId");
- string cate = GetString("cate");
- CategoryService.DelCategory(getCTable(cate), sId);
- returnSuccessMsg("己删除");
- }
- }
- public void save_category()
- {
- if (UrlParmsCheck("name,cate"))
- {
- int sId = GetInt("sId");
- string name = GetString("name");
- string cate = GetString("cate");
- CategoryService.SaveCategory(getCTable(cate), name, sId);
- returnSuccessMsg("保存成功!");
- }
- }
- #endregion
- }
- }
|