예제 #1
0
        /// <summary>
        /// 绑定用户账号类型
        /// </summary>
        private void BindAccountType()
        {
            Dictionary <string, string> dataSource = new Dictionary <string, string>();

            foreach (var item in WebComm.GetAccountListByXml())
            {
                dataSource.Add(item.TypeID.ToString(), item.TypeName);
            }
            Dictionary <string, object> attrCardType = null;
            List <SelectListItem>       itemList     = null;

            WebComm.BindComBox(dataSource, out attrCardType, out itemList);
            ViewBag.attrAccountType = attrCardType;
            ViewBag.accountList     = itemList;
        }
예제 #2
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, ""));
            }
        }
예제 #3
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, ""));
            }
        }