Exemple #1
0
 public string GetData(string userId, string mId)
 {
     try
     {
         B_OA_NewsData data = new B_OA_NewsData();
         data.lst_CommandType = new List<Para_CommType>();
         List<Para_CommType> lstCommandType = CommonClass.GetCommType("News");
         if (lstCommandType != null && lstCommandType.Count > 0)
         {
             if (userId == "U000008")
             {
                 data.lst_CommandType = lstCommandType;
             }
             else
             {
                 List<Privilege> listPrivilege = IWorkFlow.BaseService.IWorkPrivilegeManage.QueryPrivilegebyUserID(userId).FindAll(g => g.Type == "维护权限集");
                 if (listPrivilege != null && listPrivilege.Count > 0)
                 {
                     foreach (var item in listPrivilege)
                     {
                         if (item.ModelKey.IndexOf("Edit") > 0)
                         {
                             string type = item.ModelKey.Substring(item.ModelKey.IndexOf("Edit") + 4, 2);
                             data.lst_CommandType.Add(lstCommandType.Where(p => p.id == int.Parse(type)).FirstOrDefault());
                         }
                     }
                 }
             }
         }
         B_OA_NewsService _En = new B_OA_NewsService();
         _En.Condition.Add("id = " + mId);
         _En = Utility.Database.QueryObject<B_OA_NewsService>(_En);
         if (_En == null)
         {
             _En = new B_OA_NewsService();
             _En.userID = userId;
             UserSelect us = CommonClass.GetUserSelect(userId);
             if (us != null) _En.author = us.CnName;
             _En.dateTime = DateTime.Now;
         }
         data._entity_B_OA_News = _En;
         return JsonConvert.SerializeObject(data);
     }
     catch (Exception e)
     {
         // throw new Exception("数据加载失败! ERR:" + e.Message);
         return "ERR:数据加载失败!msg: " + e.Message;
     }
 }
Exemple #2
0
 public void SaveData(string content, IDbTransaction tran)
 {
     B_OA_NewsData data = new B_OA_NewsData();
     data = JsonConvert.DeserializeObject<B_OA_NewsData>(content);
     data._entity_B_OA_News.Condition.Add("id=" + data._entity_B_OA_News.id);
     if (Utility.Database.Update<B_OA_NewsService>(data._entity_B_OA_News, tran) < 1)
     {
         data._entity_B_OA_News.addDate = DateTime.Now;
         data._entity_B_OA_News.flag = 0;
         Utility.Database.Insert<B_OA_NewsService>(data._entity_B_OA_News, tran);
     }
 }