Esempio n. 1
0
        public string Edit(UserAccount ua)
        {
            try
            {
                User loginUser = Session[SessionList.FamilyManageUser.ToString()] as User;
                ua.ctypeName = WebComm.GetAccountListByXml().Where(c => c.TypeID == int.Parse(Request.Form["ctypeID"])).SingleOrDefault().TypeName;

                db.Entry(ua).State = EntityState.Modified;
                db.SaveChanges();
                return(WebComm.ReturnAlertMessage(ActionReturnStatus.成功, "修改成功", "UserAccountList", "", CallBackType.none, ""));
            }
            catch (Exception ex)
            {
                return(WebComm.ReturnAlertMessage(ActionReturnStatus.失败, "修改失败" + ex.Message, "", "", CallBackType.none, ""));
            }
        }
Esempio n. 2
0
        public string Create(UserAccount ua)
        {
            try
            {
                User loginUser = Session[SessionList.FamilyManageUser.ToString()] as User;
                ua.UserID    = loginUser.ID;
                ua.ctypeName = WebComm.GetAccountListByXml().Where(c => c.TypeID == int.Parse(Request.Form["ctypeID"])).SingleOrDefault().TypeName;


                db.UserAccounts.Add(ua);
                db.SaveChanges();
                return(WebComm.ReturnAlertMessage(ActionReturnStatus.成功, "添加成功", "UserAccountList", "", CallBackType.none, ""));
            }
            catch (Exception ex)
            {
                return(WebComm.ReturnAlertMessage(ActionReturnStatus.失败, "添加失败!" + ex.Message, "", "", CallBackType.none, ""));
            }
        }
Esempio n. 3
0
 public string DeleteConfirmed()
 {
     try
     {
         string ids    = Request["ids"] ?? "";
         int[]  idList = WebComm.GetIntArrayByString(ids);
         foreach (int item in idList)
         {
             UserAccount ua = db.UserAccounts.Find(item);
             if (ua != null)
             {
                 db.UserAccounts.Remove(ua);
             }
         }
         db.SaveChanges();
         return(WebComm.ReturnAlertMessage(ActionReturnStatus.成功, "删除成功", "UserAccountList", "", CallBackType.none, ""));
     }
     catch (Exception ex)
     {
         return(WebComm.ReturnAlertMessage(ActionReturnStatus.失败, "删除失败!" + ex.Message, "", "", CallBackType.none, ""));
     }
 }