Inheritance: System.MarshalByRefObject, IEmployee
Ejemplo n.º 1
0
        private void FillFormData()
        {
            if (string.IsNullOrEmpty(CurId))
            {
                AlertAndTransfer("参数id无效!", base.UrlReferrer);
                return;
            }

            IEmployee biz = new EmployeeBiz();
            var entity = biz.GetEmployeeEntity(CurId);
            if (entity == null)
            {
                AlertAndTransfer("参数id无效,获取数据失败!", base.UrlReferrer);
                return;
            }
            this.tEmployeeId.Value = entity.EMPLOYEE_ID;
            this.tEmployeeName.Value = entity.EMPLOYEE_NAME;
            this.ddlRestaurant.SelectedValue = entity.RESTAURANT_ID.ToString();
            this.tPassword.Value = entity.PASSWORD;
            this.tOfficePhone.Value = entity.OFFICE_PHONE;
            this.tMobilePhone.Value = entity.MOBILE_PHONE;
            this.hSex.Value = entity.SEX;
            this.cIsAdmin.Checked = (bool)entity.IS_ADMIN;

            this.tEmployeeId.Disabled = true;
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.tName.Value) && !string.IsNullOrEmpty(this.tPassword.Value))
         {
             try
             {
                 IEmployee biz = new EmployeeBiz();
                 EmployeeEntity condition_entity = new EmployeeEntity();
                 condition_entity.EMPLOYEE_ID = this.tName.Value;
                 condition_entity.PASSWORD = this.tPassword.Value;
                 var list = biz.GetEmployeeEntityList(condition_entity);
                 if (list != null && list.Count > 0)
                 {
                     //登陆成功,把用户编号保存到票据中
                     FormsAuthentication.SetAuthCookie(this.tName.Value, false);
                     var ticket = new FormsAuthenticationTicket(1, list[0].EMPLOYEE_NAME, DateTime.Now, DateTime.Now.AddMonths(2), false, this.tName.Value, FormsAuthentication.FormsCookiePath);
                     var encTicket = FormsAuthentication.Encrypt(ticket);
                     var newCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
                     HttpContext.Current.Response.Cookies.Add(newCookie);
                     Response.Redirect(ReturnUrl);
                 }
                 else
                 {
                     this.lMsg.InnerText = "登陆失败,账户或密码错误!";
                 }
             }
             catch (Exception ex)
             {
                 this.lMsg.InnerText = "登陆失败,原因是:" + ex.ToString();
             }
         }
     }
 }
Ejemplo n.º 3
0
 private void DeleteData()
 {
     try
     {
         if (!string.IsNullOrEmpty(this.hDeleteId.Value))
         {
             IEmployee biz = new EmployeeBiz();
             biz.DeleteEmployeeEntity(new EmployeeEntity() { EMPLOYEE_ID = this.hDeleteId.Value });
             this.lMsg.InnerText = "删除成功!";
         }
     }
     catch (Exception ex)
     {
         this.lMsg.InnerText = "删除失败,原因:" + ex.ToString();
     }
 }
Ejemplo n.º 4
0
 private void BindData()
 {
     IEmployee biz = new EmployeeBiz();
     repeater1.DataSource = GetPagedDataSource(biz.GetEmployeeDataTable().DefaultView);
     repeater1.DataBind();
 }
Ejemplo n.º 5
0
        private void Save()
        {
            try
            {
                IEmployee biz = new EmployeeBiz();

                if (CurOperation == "add")
                {
                    var condition_entity = new EmployeeEntity();
                    condition_entity.EMPLOYEE_ID = this.tEmployeeId.Value;
                    var list = biz.GetEmployeeEntityList(condition_entity);
                    if (list != null && list.Count > 0)
                    {
                        this.lMsg.InnerText = "保存失败,原因:已存在重复的账号!";
                    }
                }

                var entity = new EmployeeEntity();
                entity.EMPLOYEE_ID = this.tEmployeeId.Value;
                entity.EMPLOYEE_NAME = this.tEmployeeName.Value;
                entity.RESTAURANT_ID = base.ParseInt(this.ddlRestaurant.SelectedValue);
                entity.PASSWORD = this.tPassword.Value;
                entity.OFFICE_PHONE = this.tOfficePhone.Value;
                entity.MOBILE_PHONE = this.tMobilePhone.Value;
                entity.SEX = this.hSex.Value;
                entity.IS_ADMIN = this.cIsAdmin.Checked;

                if (CurOperation == "add")
                {
                    entity.CREATE_TIME = DateTime.Now;
                    entity.CREATE_PERSON = base.CurEmployeeEntity.EMPLOYEE_ID;
                    biz.InsertEmployeeEntity(entity);
                }
                else if (CurOperation == "edit")
                {
                    entity.EMPLOYEE_ID = CurId;
                    entity.UPDATE_TIME = DateTime.Now;
                    entity.UPDATE_PERSON = base.CurEmployeeEntity.EMPLOYEE_ID;
                    biz.UpdateEmployeeEntity(entity);
                }

                AlertAndTransfer("保存成功!", base.UrlReferrer);
            }
            catch (Exception ex)
            {
                this.lMsg.InnerText = "保存失败,原因:" + ex.ToString();
            }
        }