Example #1
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();
        }
Example #2
0
        private void InitialDataPopup()
        {
            if (ViewState["RoleId"] != null)
            {
                var cmd = new RoleService();
                _item = cmd.Select(Convert.ToInt32(ViewState["RoleId"].ToString()));
                if (_item != null)
                {
                    popTxtRoleCode.Text = _item.ROLE_CODE;
                    popTxtRoleName.Text = _item.ROLE_NAME;
                    flag.Text           = "Edit";
                }

                var cmdFunc = new RoleFunctionService();
                DataSouceRoleFunction = cmdFunc.GetALLIncludeFunction(_item.ROLE_ID);
            }
            else
            {
                DataSouceRoleFunction = new List <ROLE_FUNCTION>();
            }
            DataSouceRoleFunction.AddRange(DataSouceNewRoleFunction);

            gridFunction.DataSource = DataSouceRoleFunction;
            gridFunction.DataBind();
        }
Example #3
0
        protected void btnAddZone_Click(object sender, EventArgs e)
        {
            var cmdZone             = new ZoneService();
            List <ZONE_DETAIL> list = new List <ZONE_DETAIL>();

            for (int i = 0; i < gridSelectZone.Rows.Count; i++)
            {
                if (((CheckBox)gridSelectZone.Rows[i].Cells[0].FindControl("check")).Checked)
                {
                    if (ViewState["empId"] != null && DataSouceRoleFunction.Where(x => x.ZONE_ID == Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString())).FirstOrDefault() == null)
                    {
                        ZONE_DETAIL obj = new ZONE_DETAIL();
                        obj.Action             = ActionEnum.Create;
                        obj.EMPLOYEE_ID        = Convert.ToInt32(ViewState["empId"].ToString());
                        obj.ZONE_ID            = Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString());
                        obj.CREATE_DATE        = DateTime.Now;
                        obj.CREATE_EMPLOYEE_ID = 0;
                        obj.UPDATE_DATE        = DateTime.Now;
                        obj.UPDATE_EMPLOYEE_ID = 0;
                        obj.SYE_DEL            = true;
                        list.Add(obj);
                    }
                    else if (DataSouceNewRoleFunction.Where(x => x.ZONE_ID == Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString())).FirstOrDefault() == null)
                    {
                        ZONE_DETAIL obj = new ZONE_DETAIL();
                        obj.Action             = ActionEnum.Create;
                        obj.EMPLOYEE_ID        = 0;
                        obj.ZONE_ID            = Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString());
                        obj.CREATE_DATE        = DateTime.Now;
                        obj.CREATE_EMPLOYEE_ID = 0;
                        obj.UPDATE_DATE        = DateTime.Now;
                        obj.UPDATE_EMPLOYEE_ID = 0;
                        obj.SYE_DEL            = true;
                        DataSouceNewRoleFunction.Add(obj);
                    }
                }
            }

            if (list.Count > 0)
            {
                var cmd = new ZoneDetailService(list);
                cmd.AddList();
            }

            InitialDataPopup();
            this.popup.Show();
        }