public string DelCust(string custCode) { try { if (string.IsNullOrEmpty(custCode)) { return("请选择一条数据进行删除"); } BasCustom bc = DBContext.Find <BasCustom>(BasCustom.Meta.CODE == custCode); if (bc == null) { return("删除数据不存在"); } //if (!string.IsNullOrEmpty(bc.UpdatedBy) && bc.UpdatedBy != this.UserCode) //{ // return "无权删除该客户"; //} DBContext.Remove <BasCustom>(BasCustom.Meta.CODE == bc.CODE); return("OK"); } catch (Exception ex) { PubHelper.GetHelper(DBContext).Error(ex, this.UserCode, "DelCust"); return(ex.Message); } }
public string SaveCust(BasCustom obj) { try { if (obj == null || string.IsNullOrEmpty(obj.CODE) || string.IsNullOrEmpty(obj.NAME)) { return("请检查输入数据是否输入完全"); } BasCustom bc = DBContext.Find <BasCustom>(BasCustom.Meta.CODE == obj.CODE); if (bc != null) { return("客户编号已使用"); } obj.UpdatedBy = this.UserCode; obj.CreatedDate = DateTime.Now; DBContext.SaveAndUpdate <BasCustom>(obj); return("OK"); } catch (Exception ex) { PubHelper.GetHelper(DBContext).Error(ex, this.UserCode, "SaveCustInfo"); throw ex; } }
/// <summary> /// 获取实体 /// </summary> /// <param name="ID"></param> /// <returns></returns> public Dictionary <string, object> Find(Guid ID) { tuser = db.Find <T_Users>(w => w.uUsers_ID == ID); tuserrole = db.Find <T_UsersRoles>(w => w.uUsersRoles_UsersID == tuser.uUsers_ID); troles = db.Find <T_Roles>(w => w.uRoles_ID == tuserrole.uUsersRoles_RoleID); tuser.cUsers_LoginPwd = ""; var di = new ToJson().GetDictionary(new Dictionary <string, object>() { { "tuser", tuser }, { "troles", troles }, { "status", 1 } }); di["dUsers_CreateTime"] = di["dUsers_CreateTime"].To_DateTimeString(); return(di); }
/// <summary> /// 获取实体 /// </summary> /// <param name="ID"></param> /// <returns></returns> public Dictionary <string, object> Find(Guid ID) { tf = db.Find <T_Function>(w => w.uFunction_ID == ID.To_Guid()); var di = new ToJson().GetDictionary(new Dictionary <string, object>() { { "tf", tf }, { "status", 1 } }); return(di); }
/// <summary> /// 获取实体 /// </summary> /// <param name="ID"></param> /// <returns></returns> public Dictionary <string, object> Find(Guid ID) { troles = db.Find <T_Roles>(f => f.uRoles_ID == Tools.getGuid(ID)); var di = new ToJson().GetDictionary(new Dictionary <string, object>() { { "troles", troles }, { "status", 1 } }); return(di); }