Exemplo n.º 1
0
 public virtual void UpdateAppPrivilege(AppPrivilege privilege)
 {
     appPrivilegeDao.Update(privilege);
 }
Exemplo n.º 2
0
 public virtual void InsertAppPrivilege(AppPrivilege privilege)
 {
     appPrivilegeDao.Insert(privilege);
 }
 public ActionResult EditAppPrivilege_(string id)
 {
     AppPrivilege privilege;
     if (string.IsNullOrEmpty(id))
     {
         privilege = new AppPrivilege();
     }
     else
     {
         privilege = BoFactory.GetVersionTrackBo.GetAppPrivilege(id);
     }
     return View(privilege);
 }
Exemplo n.º 4
0
        public virtual void AppPrivilegeAdd(string appid, string appName, string appCode, string buaappid, string buaprivilege, string buaprivilegetext, string enablesync, string syncinterval)
        {
            if (buaprivilege == null)
                buaprivilege = "";
            AppPrivilegeDao dao = new AppPrivilegeDao(AppConfig.mainDbKey);
            ApplicationDao appDao = new ApplicationDao(AppConfig.mainDbKey);
            KeyValuePair<string, object> pk = new KeyValuePair<string, object>("name", appCode);
            IList<KeyValuePair<string, object>> par = new List<KeyValuePair<string, object>>();
            par.Add(pk);
            Application application = appDao.Get(par);
            int appPrivilegeid = application.PrivilegeID != null ? application.PrivilegeID.Value : 0;
            AppPrivilege ap = null;
            bool exists = dao.Exists(appPrivilegeid.ToString());
            if (exists)
            {
                IList<KeyValuePair<string, object>> pars = new List<KeyValuePair<string, object>>();
                KeyValuePair<string, object> p = new KeyValuePair<string, object>("id", appPrivilegeid);

                pars.Add(p);
                ap = dao.Get(pars);
                ap.BuaAppCode = buaappid;
                ap.BuaPrivilegeCode = buaprivilege;
                ap.DisplayName = buaprivilegetext;

                ap.EnableSync = enablesync == "ENABLE" ? true : false;
                ap.SyncIntervalTime = String.IsNullOrEmpty(syncinterval) ? 0 : int.Parse(syncinterval);
                dao.Update(ap);
            }
            else
            {
                ap = new AppPrivilege();
                //ap.ID = int.Parse(appid);
                ap.BuaAppCode = buaappid;
                ap.BuaPrivilegeCode = buaprivilege;
                ap.EnableSync = enablesync == "ENABLE" ? true : false;
                ap.Name = appCode;
                ap.DisplayName = buaprivilegetext;
                ap.SyncIntervalTime = String.IsNullOrEmpty(syncinterval) ? 0 : int.Parse(syncinterval);
                ap.SyncLastTime = DateTime.Now;
                ap.SyncTime = DateTime.Now;
                ap.CreateUid = "";
                ap.CreateTime = DateTime.Now;
                ap.UpdateTime = DateTime.Now;
                ap.UpdateUid = "";

                dao.Insert(ap);
            }

            if (application != null)
            {
                application.PrivilegeID = ap.ID;
                appDao.Update(application);
            }
        }
 public JsonResult EditAppPrivilege(AppPrivilege privilege)
 {
     JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
     privilege.UpdateTime = DateTime.Now;
     privilege.UpdateUid = CurrentUser.UserUId;
     try
     {
         if (string.IsNullOrEmpty(Convert.ToString(privilege.ID)) || privilege.ID == 0)
         {//新增
             privilege.CreateTime = DateTime.Now;
             privilege.CreateUid = CurrentUser.UserUId;
             privilege.SyncLastTime = DateTime.Now;
             privilege.SyncTime = DateTime.Now;
             BoFactory.GetVersionTrackBo.InsertAppPrivilege(privilege);
         }
         else
         {
             BoFactory.GetVersionTrackBo.UpdateAppPrivilege(privilege);
         }
     }
     catch (Exception ex)
     {
         data.IsSuccess = false;
         data.Msg = ex.Message;
         Log4NetHelper.Error(ex);
     }
     return Json(data);
 }