public ActionResult UpdateDepartment(DepartmentPO updateForm)
        {
            ActionResult result = null;

            if (Session["RoleID"] != null)
            {
                if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2)
                {
                    if (ModelState.IsValid)
                    {
                        DepartmentDO mappedDataUpdate = Mapper.MapDepartmentPOtoDO(updateForm);
                        DepartmentDataAccessLayer.UpdateDepartment(mappedDataUpdate);
                        result = RedirectToAction("ViewAllDepartment");
                    }
                    else
                    {
                        result = View(updateForm);
                    }
                }
                else
                {
                    result = RedirectToAction("Index", "Home");
                }
            }
            else
            {
                result = RedirectToAction("Index", "Home");
            }
            return(result);
        }
Example #2
0
        private void frmPunish_Load(object sender, EventArgs e)
        {
            Refresh();
            departmentDO = new DepartmentDO();
            employeeDO   = new EmployeeDO();
            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
            departmentTreeView.ExpandNodes(true);
            LoadPunishCardCombo();
            punishD0 = new PunishDO();
            dtPunish = dsPunish.Tables[0];

            if (selectedPunish >= 0)           //Sửa thông tin thẻ phạt
            {
                //this.Text = "Sửa thông tin thiết lập thẻ phạt";
                this.Text = WorkingContext.LangManager.GetString("frmPunish_Text1");
                LoadPunishData();
                cboEmployeeName.Enabled    = false;
                departmentTreeView.Enabled = false;
            }
            else            // thêm mới
            {
                //This.Text = "Thiết lập thẻ phạt";
                this.Text = WorkingContext.LangManager.GetString("frmPunish_Text2");
            }
        }
        public DepartmentDO ViewDepartmentByID(int departmentID)
        {
            DepartmentDO departmentObject = new DepartmentDO();

            try
            {
                using (SqlConnection sqlConnection = new SqlConnection(connectionString))
                {
                    SqlCommand sqlCommand = new SqlCommand("VIEW_DEPARTMENT_BY_ID", sqlConnection);
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.Parameters.AddWithValue("@DeptID", departmentID);
                    sqlConnection.Open();
                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

                    while (sqlDataReader.Read())
                    {
                        departmentObject                        = new DepartmentDO();
                        departmentObject.DeptID                 = sqlDataReader.GetInt32(0);
                        departmentObject.DeptName               = sqlDataReader.GetString(1).Trim();
                        departmentObject.Description            = sqlDataReader.GetString(2).Trim();
                        departmentObject.DeptHead               = sqlDataReader.GetString(3).Trim();
                        departmentObject.DeptHeadSpecialization = sqlDataReader.GetString(4).Trim();
                    }
                    sqlDataReader.Close();
                    sqlDataReader.Dispose();
                    sqlCommand.Dispose();
                }
            }
            catch (Exception exc)
            {
                LoggingDataAccessLayer.LogViewDepartmentByID(exc);
            }
            return(departmentObject);
        }
        private void frmRegLeaveSchedule_Load(object sender, EventArgs e)
        {
            Refresh();
            employeeDO = new EmployeeDO();

            departnemtDO = new DepartmentDO();
            departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
            departmentTreeView.ExpandNodes(true);

            leaveScheduleDO = new LeaveScheduleDO();

            if (selectedLeaveSchedule >= 0)
            {
                // disable các thuộc tính liên quan đến nhân viên
                string str = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_Text2");
                this.Text = str;
                //this.Text = "Sửa đăng ký công tác";
                LoadLeaveSchedule();
                cboEmployeeName.Enabled    = false;
                departmentTreeView.Enabled = false;
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_Text");
                this.Text       = str;
                dsLeaveSchedule = leaveScheduleDO.getLeaveSchedule();
            }
        }
        public List <DepartmentDO> ReadDepartment()
        {
            List <DepartmentDO> departmentList = new List <DepartmentDO>();

            try
            {
                using (SqlConnection sqlConnection = new SqlConnection(connectionString))
                {
                    SqlCommand sqlCommand = new SqlCommand("READ_DEPARTMENT", sqlConnection);
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlConnection.Open();
                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

                    while (sqlDataReader.Read())
                    {
                        DepartmentDO departmentObject = new DepartmentDO();
                        departmentObject.DeptID                 = sqlDataReader.GetInt32(0);
                        departmentObject.DeptName               = sqlDataReader.GetString(1);
                        departmentObject.Description            = sqlDataReader.GetString(2);
                        departmentObject.DeptHead               = sqlDataReader.GetString(3);
                        departmentObject.DeptHeadSpecialization = sqlDataReader.GetString(4);
                        departmentList.Add(departmentObject);
                    }
                    sqlDataReader.Close();
                    sqlDataReader.Dispose();
                    sqlCommand.Dispose();
                }
            }
            catch (Exception exc)
            {
                LoggingDataAccessLayer.LogReadDepartment(exc);
            }
            return(departmentList);
        }
 public void UpdateDepartment(DepartmentDO departmentUpdateDO)
 {
     try
     {
         using (SqlConnection sqlConnection = new SqlConnection(connectionString))
         {
             SqlCommand sqlCommand = new SqlCommand("UPDATE_DEPARTMENT", sqlConnection);
             sqlCommand.CommandType = CommandType.StoredProcedure;
             sqlConnection.Open();
             sqlCommand.Parameters.AddWithValue("@DeptID", departmentUpdateDO.DeptID);
             sqlCommand.Parameters.AddWithValue("@DeptName", departmentUpdateDO.DeptName);
             sqlCommand.Parameters.AddWithValue("@Description", departmentUpdateDO.Description);
             sqlCommand.Parameters.AddWithValue("@DeptHead", departmentUpdateDO.DeptHead);
             sqlCommand.Parameters.AddWithValue("@DeptHeadSpecialization", departmentUpdateDO.DeptHeadSpecialization);
             sqlCommand.ExecuteNonQuery();
             sqlConnection.Close();
             sqlConnection.Dispose();
             sqlCommand.Dispose();
         }
     }
     catch (Exception exc)
     {
         LoggingDataAccessLayer.LogUpdateDepartment(exc);
     }
 }
Example #7
0
 private void frmDepartment_Load(object sender, EventArgs e)
 {
     Refresh();
     departmentDO = new DepartmentDO();
     PopulateDepartmentTreeView();
     departmentTreeView.SelectedNode = null;
 }
Example #8
0
        /// <summary>
        ///
        /// </summary>
        private void BindingDepartmentCombo()
        {
            DepartmentDO departmentDO = new DepartmentDO();
            DataSet      departmentDS = departmentDO.GetAllDepartments();

            cboDepartment.DataSource    = departmentDS.Tables[0];
            cboDepartment.ValueMember   = "DepartmentID";
            cboDepartment.DisplayMember = "DepartmentName";
        }
        /// <summary>
        /// Lấy Danh sách các phòng ban
        /// </summary>
        private void PopulateDepartmentCombo()
        {
            DepartmentDO departmentDO = new DepartmentDO();
            DataSet      dsDepartment = departmentDO.GetAllDepartments();

            cboDepartment.DataSource    = dsDepartment.Tables[0];
            cboDepartment.ValueMember   = "DepartmentID";
            cboDepartment.DisplayMember = "DepartmentName";
        }
Example #10
0
        private void frmListEmployees_Load(object sender, EventArgs e)
        {
            departmentDO = new DepartmentDO();
            employeeDO   = new EmployeeDO();

            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
            Refresh();
        }
Example #11
0
        private void frmChangeTimeInOut_Load(object sender, System.EventArgs e)
        {
            Refresh();
            timeInOutDO = new TimeInOutDO();
            employeeDO  = new EmployeeDO();
            DepartmentDO departmentDO = new DepartmentDO();

            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
        }
Example #12
0
        public static DepartmentPO MapDepartmentDOtoPO(DepartmentDO frmDepartmentDO)
        {
            DepartmentPO toDepartmentPO = new DepartmentPO();

            toDepartmentPO.DeptID                 = frmDepartmentDO.DeptID;
            toDepartmentPO.DeptName               = frmDepartmentDO.DeptName;
            toDepartmentPO.Description            = frmDepartmentDO.Description;
            toDepartmentPO.DeptHead               = frmDepartmentDO.DeptHead;
            toDepartmentPO.DeptHeadSpecialization = frmDepartmentDO.DeptHeadSpecialization;
            toDepartmentPO.AlumniCount            = frmDepartmentDO.AlumniCount;
            return(toDepartmentPO);
        }
Example #13
0
        private void frmRegWorkingTime_Load(object sender, EventArgs e)
        {
            Refresh();

            cboDinnnerAmount.Enabled = false;
            employeeDO = new EmployeeDO();

            DepartmentDO departnemtDO = new DepartmentDO();

            departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.ExpandNodes(true);
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;

            regOverTimeDO = new RegOverTimeDO();
            dtRegOverTime = dsRegOverTime.Tables[0];

            monthCalendar1.SelectDate(DateTime.Today);

            //CurrentYear = DateTime.Today.Year;
            CurrentYear = DateTime.Now.Year;
            monthCalendar1.ActiveMonth.Year = CurrentYear;
            CurrentMonth = DateTime.Today.Month;
            monthCalendar1.ActiveMonth.Month = CurrentMonth;

            monthCalendar1.SelectDate(DateTime.Today);

            if (selectedRegOverTime >= 0)
            {
                // disable các thuộc tính liên quan đến nhân viên
                string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text2");
                //this.Text = "Sửa đăng ký làm thêm giờ";
                this.Text = str;
                LoadRegOverTime();
                //				optEmployee.Checked = true;
                departmentTreeView.Enabled = false;
                //				optAll.Enabled = false;
                //dtpDayWorking.Enabled = false;
                //cboEmployeeName.Enabled = false;
                lvwListEmployee.Enabled = false;
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text1");
                //this.Text = "Thêm đăng ký làm thêm giờ";
                this.Text = str;
                //txtEmployeeName.Enabled = false;
                //cboEmployeeName.Enabled = false;
            }
            PopulateShiftCombo();
        }
Example #14
0
 private void frmHospital_Load(object sender, EventArgs e)
 {
     Refresh();
     departmentDO = new DepartmentDO();
     dtPosition   = dsPosition.Tables[0];
     if (selectedPosition >= 0)
     {
         //string str = WorkingContext.LangManager.GetString("frmPosition_Text3");
         this.Text = "Sửa thông tin bệnh viện";
         //this.Text = str;
         LoadCurrentPosition();
     }
     else
     {
         //string str = WorkingContext.LangManager.GetString("frmPosition_Text2");
         this.Text = "Thêm một bệnh viện mới";
         //this.Text = str;
     }
 }
Example #15
0
 private void frmPosition_Load(object sender, System.EventArgs e)
 {
     Refresh();
     departmentDO = new DepartmentDO();
     dtPosition   = dsPosition.Tables[0];
     if (selectedPosition >= 0)
     {
         string str = WorkingContext.LangManager.GetString("frmPosition_Text3");
         //this.Text = "Sửa thông tin chức vụ";
         this.Text = str;
         LoadCurrentPosition();
     }
     else
     {
         string str = WorkingContext.LangManager.GetString("frmPosition_Text2");
         //this.Text = "Thêm một chức vụ mới";
         this.Text = str;
     }
 }
Example #16
0
        private void frmDepartment_Load(object sender, EventArgs e)
        {
            Refresh();
            departmentDO = new DepartmentDO();
            DataSet dsDepartmentGroup = new DataSet();

            dsDepartmentGroup = departmentDO.GetAllGroupDepartments();
            if (dsDepartmentGroup != null)
            {
                cboGroup.SourceDataString = new string[] { "GroupID", "GroupName" };
                cboGroup.SourceDataTable  = dsDepartmentGroup.Tables[0];
                cboGroup.SelectedIndex    = 0;
            }
            if (DepartmentName != "")
            {
                string str = WorkingContext.LangManager.GetString("frmDep_Text1");
                //this.Text = "Sửa thông tin phòng ban";
                this.Text = str;
                txtDepartmentName.Text = DepartmentName;
                txtDescription.Text    = Description;
                if (SortIndex > 0)
                {
                    txtSort.Text = SortIndex.ToString();
                }
                else
                {
                    txtSort.Text = "1";
                    SortIndex    = 1;
                }

                DataSet dsGroupName = departmentDO.GetGroupDepartments(GroupID);
                if (dsGroupName != null)
                {
                    cboGroup.Text = dsGroupName.Tables[0].Rows[0]["GroupName"].ToString();
                }
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmDep_Text2");
                //this.Text = "Thêm một phòng ban mới";
                this.Text = str;
            }
        }
        public ActionResult UpdateDepartment(int DeptID)
        {
            ActionResult response = null;

            if (Session["RoleID"] != null)
            {
                if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2)
                {
                    DepartmentDO mappedDataIDDo = DepartmentDataAccessLayer.ViewDepartmentByID(DeptID);
                    DepartmentPO mappedDataIDPo = Mapper.MapDepartmentDOtoPO(mappedDataIDDo);
                    response = View(mappedDataIDPo);
                }
                else
                {
                    response = RedirectToAction("Index", "Home");
                }
            }
            else
            {
                response = RedirectToAction("Index", "Home");
            }
            return(response);
        }
Example #18
0
 private void frmPosition_Load(object sender, System.EventArgs e)
 {
     Refresh();
     departmentDO = new DepartmentDO();
     PopulatePositionListView();
 }
Example #19
0
 private void frmListHospital_Load(object sender, EventArgs e)
 {
     Refresh();
     departmentDO = new DepartmentDO();
     PopulatePositionListView();
 }