protected void btnsave_Click(object sender, EventArgs e)
 {
     var tempid = txtIdcard.Text.Trim();
     if (CheckIDCard(tempid))
     {
         if (Request.QueryString["cuid"] != null)
         {
             CommonUser cu = bllcommonuser.GetCommonUserByid(int.Parse(Request.QueryString["cuid"]));
             cu.Name = txtName.Text.Trim();
             cu.IdCard = txtIdcard.Text.Trim();
             bllcommonuser.updatecu(cu);
             Response.Redirect("CommonUserInfo.aspx");
         }
         else
         {
             CommonUser cu = new CommonUser();
             cu.Name = txtName.Text.Trim();
             cu.IdCard = txtIdcard.Text.Trim();
             cu.User = CurrentMember;
             string msg;
             bllcommonuser.SaveCommonUser(cu, out msg);
         }
         Response.Redirect("CommonUserInfo.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "alert('身份证号码不正确,请确认!')", true);
     }
 }
Beispiel #2
0
 public void updatecu(CommonUser cu)
 {
     using (var x=session.Transaction)
     {
         x.Begin();
         session.Update(cu);
         x.Commit();
     }
 }
Beispiel #3
0
 public void SaveCommonUser(CommonUser commonuser)
 {
     using (var x=session.Transaction)
     {
         x.Begin();
         session.Save(commonuser);
         x.Commit();
     }
 }
Beispiel #4
0
        public void SaveCommonUserTest_condition1()
        {
            CommonUser cu = new CommonUser();
            cu.Name = "小A";
            cu.IdCard = "330381198812164236";
            cu.User = new BLL.BLLMembership().GetMember("admin");
            string message;
            bllcommonuser.SaveCommonUser(cu, out message);
            Assert.AreEqual(string.Empty, message);

            CommonUser cu2 = new CommonUser();
            cu.Name = "小A";
            cu.IdCard = "330381198812164236";
            cu.User = new BLL.BLLMembership().GetMember("admin");
            string message2;
            bllcommonuser.SaveCommonUser(cu2, out message2);
            Assert.AreEqual("已存在", message2);
        }
Beispiel #5
0
 /// <summary>
 /// 保存常用联系人
 /// </summary>
 /// <param name="userid"></param>
 /// <param name="name"></param>
 /// <param name="idcard"></param>
 public void Save(Guid userid, string name, string idcard)
 {
     string msg;
     CommonUser cu = new CommonUser();
     cu.IdCard = idcard;
     cu.Name = name;
     cu.User = new BLLMembership().GetMemberById(userid);
     SaveCommonUser(cu, out msg);
 }
Beispiel #6
0
 /// <summary>
 /// 获取一个常用联系人
 /// </summary>
 /// <param name="userid"></param>
 /// <param name="name"></param>
 /// <param name="idcard"></param>
 /// <returns></returns>
 public CommonUser Get(Guid userid, string name, string idcard)
 {
     CommonUser cu = new CommonUser();
     cu = ICommonUser.Get(userid, name, idcard);
     return cu;
 }
Beispiel #7
0
 /// <summary>
 /// 更新常用联系人
 /// </summary>
 /// <param name="cu"></param>
 public void updatecu(CommonUser cu)
 {
     ICommonUser.updatecu(cu);
 }
Beispiel #8
0
 /// <summary>
 /// 保存常用联系人
 /// </summary>
 /// <param name="commonuser"></param>
 /// <param name="msg"></param>
 public void SaveCommonUser(CommonUser commonuser, out string msg)
 {
     msg = string.Empty;
     CommonUser cu = Get(commonuser.User.Id, commonuser.Name, commonuser.IdCard);
     if (cu != null)
     {
         msg = "已存在";
         return;
     }
     ICommonUser.SaveCommonUser(commonuser);
 }