Beispiel #1
0
 /// <summary>
 /// 绑定人员详细
 /// </summary>
 /// <param name="id"></param>
 void BindDetail(int id)
 {
     model                 = bll.GetModel(id);
     txtEmail.Text         = model.Email;
     txtNameInfo.Text      = model.NameInfo;
     txtPhone.Text         = model.Phone;
     ddlType.SelectedValue = model.TypeId.ToString();
     ckState.Checked       = model.StateInfo == 1 ? true : false;
     account               = model.Account;
     txtPwd.Text           = Common.DESEncrypt.Decrypt(model.Pwd);
 }
Beispiel #2
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            bool isEdit = false;

            if (int.TryParse(Request.Params["id"], out id))
            {
                model  = bll.GetModel(id);
                isEdit = true;
            }
            else
            {
                model.NumId   = bll.SetNumID();
                model.AddTime = DateTime.Now;
                model.Pwd     = Leadin.Common.DESEncrypt.Encrypt(txtPwd.Text.Trim());
            }


            model.Account   = Request.Form["txtAccount"].ToString();
            model.Email     = txtEmail.Text;
            model.NameInfo  = txtNameInfo.Text;
            model.Phone     = txtPhone.Text;
            model.StateInfo = ckState.Checked ? 1 : 0;
            model.TypeId    = int.Parse(ddlType.SelectedValue);


            if (isEdit)
            {
                if (bll.Update(model))
                {
                    JsMessage("人员信息修改成功", 2000, "true", "index.aspx" + Request.Url.Query);
                }
                else
                {
                    JsMessage("人员信息修改失败,请稍候重试", 2000, "false");
                }
            }
            else
            {
                if (bll.Add(model) > 0)
                {
                    JsMessage("人员信息录入成功", 2000, "true", "index.aspx");
                }
                else
                {
                    JsMessage("人员信息录入失败,请稍候重试", 2000, "false");
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取类别编号
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string SetNumID()
        {
            StringBuilder strNumId = new StringBuilder("OA");

            strNumId.Append(DateTime.Now.ToString("yyMMdd"));

            Model.Workers model = GetModel(GetMaxId());
            if (model != null)
            {
                strNumId.Append((int.Parse(model.NumId.Substring(model.NumId.Length - 3)) + 1).ToString().PadLeft(3, '0'));
            }
            else
            {
                strNumId.Append("001");
            }

            return(strNumId.ToString());
        }
Beispiel #4
0
 //Workers
 public void CreateWorker(Model.Workers c)
 {
     ctx.Workers.Add(c);
     ctx.SaveChanges();
 }