Ejemplo n.º 1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            PersonModel model = GetModel();
            PersonBll bll = new PersonBll();
            bool succeed;
            if (hidOperate.Value == "modify")
            {
                logmodel.ProcessFlag = "update";
                succeed = bll.UpdatePersonByKey(model, logmodel);
                if (succeed)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.UpdateSuccess + "');", true);
                    DataBind();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.UpdateFailed + "');", true);

                }
            }
            if (hidOperate.Value == "add")
            {
                //model.Passwd = "Foxconn88";
                logmodel.ProcessFlag = "insert";
                succeed = bll.AddPerson(model, logmodel);
                succeed = bll.UpdatePWDByKey(model.Personcode, "Foxconn88", logmodel);
                if (succeed)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.AddSuccess + "');", true);
                    DataBind();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.AddFailed + "');", true);
                }

            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 重置密碼
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnResetPWD_Click(object sender, EventArgs e)
 {
     logmodel.ProcessFlag = "update";
     PersonModel model = GetModel();
     PersonBll bll = new PersonBll();
     bool succeed = false;
     if (model.Personcode != null)
     {
         model.Passwd = "Foxconn88";
         //succeed = bll.UpdatePersonByKey(model);
         succeed = bll.UpdatePWDByKey(model.Personcode, "Foxconn88", logmodel);
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.AtLastOneChoose + "');", true);
     }
     if (succeed)
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.ResetPasswordSuccess + "');", true);
         DataBind();
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.ResetPasswordFailed + "');", true);
     }
 }