public ActionResult btnEdit_Click([Bind(Include = "ID,FCompanyNumber,UserName,UserPwd,UserSex,UserBirthday,UserMail,UserEnabledisable,UserRemark,UserPumpGroup,FCustomerID,UserType,IsOther")] Panda_Customer cus) { try { if (ModelState.IsValid) { if (Panda_UserInfoDal.Exist(" and UserName='******' and UserName<>'" + Request["tbxOldName"] + "'").Rows.Count == 0) { Hashtable hasData = new Hashtable(); hasData["ID"] = Request["tbxID"]; hasData["FCompanyNumber"] = Request["ddlCompany"]; hasData["UserName"] = Request["tbxName"]; if (!Request["tbxPassword"].Equals(Request["tbxoldPwd"])) { hasData["UserPwd"] = PasswordUtil.CreateDbPassword(Request["tbxPassword"]); } hasData["UserSex"] = Request["ddlSex"]; hasData["UserBirthday"] = Request["dpBirthday"]; //hasData["UserTel"] = Request["ddlCompany"]; hasData["UserMail"] = Request["tbxEmail"]; hasData["UserEnabledisable"] = Request["ddlEnable"]; hasData["UserRemark"] = Request["tbxRemark"]; hasData["UserPumpGroup"] = Request["tbxPumpGroupID"]; hasData["FCustomerID"] = Request["tbxCustomerID"]; hasData["UserType"] = Request["ddlType"]; hasData["IsOther"] = Request["ddlType"] == "4" ? "1" : "0"; hasData["FUpdUser"] = GetIdentityName(); hasData["FUpdDate"] = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss")); Panda_UserInfoDal.Update(hasData); ShowNotify("修改成功!"); // 关闭本窗体(触发窗体的关闭事件) PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { ShowNotify("用户名重复,请更换!"); } } } catch { ShowNotify("修改失败!"); } return(UIHelper.Result()); }
public ActionResult btnCreate_Click() { if (ModelState.IsValid) { try { if (Panda_UserInfoDal.Exist(" and UserName='******'").Rows.Count == 0) { Hashtable hasData = new Hashtable(); hasData["FCompanyNumber"] = Request["ddlCompany"]; hasData["UserName"] = Request["tbxName"]; hasData["UserPwd"] = PasswordUtil.CreateDbPassword(Request["tbxPassword"]); hasData["UserSex"] = Request["ddlSex"]; hasData["UserBirthday"] = Request["dpBirthday"]; //hasData["UserTel"] = Request["ddlCompany"]; hasData["UserMail"] = Request["tbxEmail"]; hasData["UserEnabledisable"] = Request["ddlEnable"]; hasData["UserRemark"] = Request["tbxRemark"]; hasData["UserPumpGroup"] = Request["tbxPumpGroupID"]; hasData["FCustomerID"] = Request["tbxCustomerID"]; hasData["UserType"] = Request["ddlType"]; hasData["IsOther"] = Request["ddlType"] == "4" ? "1" : "0"; hasData["FIsDelete"] = 0; hasData["FCreateUser"] = GetIdentityName(); hasData["FCreateDate"] = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss")); Panda_UserInfoDal.Insert(hasData); ShowNotify("添加成功!"); // 关闭本窗体(触发窗体的关闭事件) PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { ShowNotify("用户名重复,请更换!"); } } catch { ShowNotify("添加失败!"); } } return(UIHelper.Result()); }