Beispiel #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     var obj = new DEPARTMENT();
     obj.DEPARTMENT_CODE = popTxtDepartmentCode.Text;
     obj.DEPARTMENT_NAME = txtDepartmentName.Text;
     var cmd = new DepartmentService(obj);
     if (flag.Text.Equals("Add"))
     {
         obj.Action = ActionEnum.Create;
         obj.CREATE_DATE = DateTime.Now;
         obj.CREATE_EMPLOYEE_ID = 0;
         obj.UPDATE_DATE = DateTime.Now;
         obj.UPDATE_EMPLOYEE_ID = 0;
         obj.SYE_DEL = true;
         cmd.Add();
     }
     else
     {
         obj.Action = ActionEnum.Update;
         obj.DEPARTMENT_ID = Convert.ToInt32(ViewState["depId"].ToString());
         obj.UPDATE_DATE = DateTime.Now;
         obj.UPDATE_EMPLOYEE_ID = 0;
         obj.SYE_DEL = true;
         cmd.Edit();
     }
     ViewState["depId"] = null;
     Response.Redirect("SearchDepartment.aspx");
 }
Beispiel #2
0
        private void InitialDataPopup()
        {
            var cmd = new DepartmentService();
            var list = cmd.GetALL();
            foreach (var item in list)
            {
                ddlDepartment.Items.Add(new ListItem(item.DEPARTMENT_NAME, item.DEPARTMENT_ID.ToString()));
            }

            if (ViewState["empId"] != null)
            {
                var cmdEmp = new EmployeeService();
                _employee = cmdEmp.Select(Convert.ToInt32(ViewState["empId"].ToString()));
                if (_employee != null)
                {
                    popTxtEmployeeCode.Text = _employee.EMPLOYEE_CODE;
                    txtName.Text = _employee.EMPLOYEE_NAME;
                    txtLastName.Text = _employee.EMPLOYEE_SURNAME;
                    ddlDepartment.SelectedValue = _employee.DEPARTMENT_ID.ToString();
                    flag.Text = "Edit";
                }

                var cmdFunc = new ZoneDetailService();
                DataSouceRoleFunction = cmdFunc.GetALLInclude(_employee.EMPLOYEE_ID);
            }
            else
            {
                DataSouceRoleFunction = new List<ZONE_DETAIL>();
            }
            DataSouceRoleFunction.AddRange(DataSouceNewRoleFunction);

            gridZone.DataSource = DataSouceRoleFunction;
            gridZone.DataBind();
        }
Beispiel #3
0
 private void InitialDataPopup()
 {
     if (ViewState["depId"] != null)
     {
         var cmd = new DepartmentService();
         _department = cmd.Select(Convert.ToInt32(ViewState["depId"].ToString()));
         if (_department != null)
         {
             popTxtDepartmentCode.Text = _department.DEPARTMENT_CODE;
             txtDepartmentName.Text = _department.DEPARTMENT_NAME;
             flag.Text = "Edit";
         }
     }
 }
Beispiel #4
0
 private void InitialData()
 {
     var cmd = new DepartmentService();
     DataSouce = cmd.GetALL();
     gridDepartment.DataSource = DataSouce;
     gridDepartment.DataBind();
 }