コード例 #1
0
ファイル: contact_edit.aspx.cs プロジェクト: wslyzhh/kuaisitu
 private string DoAdd()
 {
     Model.Contacts model = new Model.Contacts();
     BLL.Contacts   bll   = new BLL.Contacts();
     manager         = GetAdminInfo();
     model.co_cid    = cid;
     model.co_flag   = false;
     model.co_name   = txtName.Text.Trim();
     model.co_number = txtPhone.Text.Trim();
     return(bll.Add(model, manager));
 }
コード例 #2
0
 protected void BtnSave_Click(object sender, EventArgs e)
 {
     Model.Contacts modelcon = new Model.Contacts();
     modelcon.Accounts = Accounts.Value;
     modelcon.cName    = cName.Value;
     modelcon.Sex      = Convert.ToBoolean(Convert.ToInt32(Sex.SelectedValue));
     if (Bearthday.Value == "")
     {
         modelcon.Bearthday = null;
     }
     else
     {
         modelcon.Bearthday = Convert.ToDateTime(Bearthday.Value);
     }
     modelcon.editUser    = UserNow.UserID;
     modelcon.addDatetime = DateTime.Now;
     modelcon.Appellation = Convert.ToInt32(Appellation.SelectedValue);
     modelcon.department  = Convert.ToInt32(department.SelectedValue);
     modelcon.Post        = Convert.ToInt32(Post.SelectedValue);
     modelcon.officPhone  = officPhone.Value;
     modelcon.Phone       = Phone.Value;
     modelcon.Address     = Address.Value;
     modelcon.zipcode     = zipcode.Value;
     modelcon.Mail        = Mail.Value;
     modelcon.familyPhone = familyPhone.Value;
     modelcon.Likes       = Likes.Value;
     modelcon.Remark      = Remark.Value;
     if (Request.QueryString["type"] == "add")
     {
         if (bllcon.Add(modelcon) > 0)
         {
             ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('新增成功');parent.window.location.reload();</script>");
         }
     }
     else if (Request.QueryString["type"] == "edit")
     {
         modelcon.ID = Convert.ToInt32(Request.QueryString["id"]);
         if (bllcon.Update(modelcon))
         {
             ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('更新成功');parent.window.location.reload();</script>");
         }
     }
 }