Пример #1
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>");
         }
     }
 }
Пример #2
0
        private string DoEdit(int _id)
        {
            BLL.Contacts   bll   = new BLL.Contacts();
            Model.Contacts model = bll.GetModel(_id);
            manager = GetAdminInfo();
            string _content = string.Empty;

            model.co_cid = cid;
            if (model.co_name != txtName.Text.Trim())
            {
                _content += "联系人:" + model.co_name + "→<font color='red'>" + txtName.Text.Trim() + "<font><br/>";
            }
            model.co_name = txtName.Text.Trim();
            if (model.co_number != txtPhone.Text.Trim())
            {
                _content += "联系号码:" + model.co_number + "→<font color='red'>" + txtPhone.Text.Trim() + "<font><br/>";
            }
            model.co_number = txtPhone.Text.Trim();
            return(bll.Update(model, manager, _content));
        }