Пример #1
0
 private void btnAddModifyRole_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.ROLES);
         frm.SingleSelect = true;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (frm.SelectedItems.Count > 0)
             {
                 int roleID = frm.SelectedItems[0].ID;
                 (new ServiceUsers()).UpdateUserRole(this.SelectedUserID, roleID);
                 PopulateRoleInfo();
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageUserManager::btnAddModifyRole_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = Cursors.Default;
 }
Пример #2
0
 private void btnAddMoreResources_Click(object sender, EventArgs e)
 {
     try
     {
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.EMPLOYEES);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             BindingList <MultiSelectListItem> selectedIDs = frm.SelectedItems;
             if (selectedIDs != null)
             {
                 foreach (MultiSelectListItem item in selectedIDs)
                 {
                     string[] arr = item.Description.Split('\n');
                     _mManager.Add(new MyResource()
                     {
                         ID = item.ID, Name = arr[0]
                     });
                 }
                 //gridResources.DataSource = new BindingSource(_mManager.GetAllResources(), null);
                 PopulateAllResourcesGrid();
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlGanttChart::btnAddMoreResources_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #3
0
 private void btnAddNewModule_Click(object sender, EventArgs e)
 {
     try
     {
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.APPLICATION_MODULES);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (frm.SelectedItems != null)
             {
                 this.Cursor = Cursors.WaitCursor;
                 foreach (MultiSelectListItem item in frm.SelectedItems)
                 {
                     MultiSelectListItem foundItem = _roleModulesList.Where(x => x.Code == item.ID.ToString()).FirstOrDefault();
                     if (foundItem == null)
                     {
                         _roleModulesList.Add(new MultiSelectListItem()
                         {
                             ID = 0, Code = item.ID.ToString(), Description = item.Description
                         });
                     }
                 }
                 (new ServiceRoles()).UpdateRoleModules(this.SelectedRoleID, _roleModulesList);
                 PopulateRoleModules();
                 this.Cursor = Cursors.Default;
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
         MessageBox.Show(errMessage, "pageRoleManager::btnAddNewModule_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #4
0
 private void btnAddMoreAuthorities_Click(object sender, EventArgs e)
 {
     try
     {
         string             selectedAuthorityIDs = string.Empty;
         frmGridMultiSelect frm = new frmGridMultiSelect(libERP.MODELS.COMMON.APP_ENTITIES.EMPLOYEES);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             foreach (MultiSelectListItem item in frm.SelectedItems)
             {
                 selectedAuthorityIDs += item.ID.ToString() + ",";
             }
         }
         if ((new ServiceEmployee()).UpdateEmployeeAuthorities(this.EmployeeID, selectedAuthorityIDs))
         {
             PopulateAuthoritiesForEmployee();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlEmployeeAuthorities::btnAddMoreAuthorities_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #5
0
 private void btnDuplicateBOQ_Click(object sender, EventArgs e)
 {
     try
     {
         string strMessage = "Are you Sure to create a Fresh Copy from the BOQs in Past Enquiries";
         if (MessageBox.Show(strMessage, "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.SALES_ENQUIRY);
         frm.SingleSelect = true;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             PopulateDesingBOQFromPreviousEnquiry(frm.SelectedItems[0].ID);
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::btnDuplicateBOQ_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #6
0
 private void btnSelectProject_Click(object sender, EventArgs e)
 {
     try
     {
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.ACTIVE_PROJECT);
         frm.SingleSelect = true;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (frm.SelectedItems.Count > 0)
             {
                 SelectedProjectID = frm.SelectedItems[0].ID;
                 //PopulateProject();
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmSO_Primary::btnSelectProject_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #7
0
 private void btnSelectSalesQuotation_Click(object sender, EventArgs e)
 {
     try
     {
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.SALES_ORDER_SELECT_QUOTATION);
         frm.SingleSelect = true;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (frm.SelectedItems.Count > 0)
             {
                 SelectedQuotationID = frm.SelectedItems[0].ID;
                 PopulateSalesQuotationInfo();
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmSO_Primary::btnSelectSalesQuotation_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #8
0
 private void btnAddSuppliers_Click(object sender, EventArgs e)
 {
     try
     {
         string             supplierIDs = string.Empty;
         frmGridMultiSelect frm         = new frmGridMultiSelect(libERP.MODELS.COMMON.APP_ENTITIES.SUPPLIERS);
         frm.SingleSelect = false;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             this.Cursor = Cursors.WaitCursor;
             foreach (MultiSelectListItem item in frm.SelectedItems)
             {
                 supplierIDs += item.ID.ToString() + ",";
             }
             if (supplierIDs != string.Empty)
             {
                 supplierIDs = supplierIDs.TrimEnd(',');
             }
             if ((new ServiceInventoryItems()).UpdateSuppliers(this.SelectedItemID, supplierIDs))
             {
                 PopulateItemSuppliers();
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlInventoryItemSuppliers::btnAddSuppliers_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = Cursors.Default;
 }
Пример #9
0
        private void btnSelectProject_Click(object sender, EventArgs e)
        {
            try
            {
                frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.ACTIVE_PROJECT);
                frm.SingleSelect = true;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;
                    int        selectedProjectID = frm.SelectedItems[0].ID;
                    List <int> _employeeIDs      = (new ServiceAttendance()).GetEmployeeIDsWhoHaveAttendendaceForProject(selectedProjectID);
                    foreach (int empID in _employeeIDs)
                    {
                        OnSiteAttendanceModel  model = new OnSiteAttendanceModel();
                        TBL_MP_Master_Employee emp   = (new ServiceEmployee()).GetEmployeeDbRecordByID(empID);
                        if (emp != null)
                        {
                            model.EmployeeID   = emp.PK_EmployeeId;
                            model.EmployeeCode = emp.EmployeeCode;
                            model.EmployeeName = emp.EmployeeName;
                        }
                        model.AttendanceDate = dtSiteAttendanceDate.Value;

                        model.AttendanceInTime  = new DateTime(model.AttendanceDate.Year, model.AttendanceDate.Month, model.AttendanceDate.Day, 8, 45, 0);
                        model.AttendanceOutTime = new DateTime(model.AttendanceDate.Year, model.AttendanceDate.Month, model.AttendanceDate.Day, 17, 15, 0);
                        model.AttendanceType    = ATTENDANCE_TYPE.PRESENT;
                        model.ProjectID         = selectedProjectID;
                        model.ProjectName       = (new ServiceProject()).GetProjectDBInfoByID(selectedProjectID).ProjectName;
                        model.Remarks           = "Present";
                        if (listOnSiteATTENDANCE == null)
                        {
                            listOnSiteATTENDANCE = new BindingList <OnSiteAttendanceModel>();
                        }
                        listOnSiteATTENDANCE.Add(model);
                    }
                    listOnSiteATTENDANCE            = AppCommon.ConvertToBindingList <OnSiteAttendanceModel>(listOnSiteATTENDANCE.OrderBy(x => x.EmployeeName).ToList());
                    gridOnSiteAttendance.DataSource = listOnSiteATTENDANCE;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageManualAttendance::btnSelectProject_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
 private void btnAddTerms_Click(object sender, EventArgs e)
 {
     try
     {
         frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.SALES_ORDER_TERMS_AND_CONDITIONS);
         frm.Text         = "TERMS AND CODITIONS FOR SALES ORDER (Multiselect)";
         frm.SingleSelect = false;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             this.Cursor = Cursors.WaitCursor;
             BindingList <MultiSelectListItem> selectedtTermsAndConditions = frm.SelectedItems;
             if (selectedtTermsAndConditions == null)
             {
                 return;
             }
             ServiceSalesOrder _service = new ServiceSalesOrder();
             foreach (MultiSelectListItem item in selectedtTermsAndConditions.AsEnumerable())
             {
                 TBL_MP_CRM_SalesOrder_TermsAndConditions model = new TBL_MP_CRM_SalesOrder_TermsAndConditions();
                 {
                     model.FK_SalesOrderID  = this.SelectedOrderID;
                     model.TermTitle        = item.Code;
                     model.Term_Description = item.Description.Replace(item.Code, "").Replace("\n", "");
                     model.PK_Order_TermID  = 0;
                     model.Sequence         = 0;
                     _service.AddNewOrderTermAndCondition(model);
                 }
             }
             PopulateTermsAndConditions();
             this.Cursor = Cursors.Default;
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlSalesOrderTermsAndCondition::btnAddTerms_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = Cursors.Default;
 }
Пример #11
0
        private void btnImportMasterPlan_Click(object sender, EventArgs e)
        {
            ServiceProject _service = new ServiceProject();

            try
            {
                switch (this.SelectedPlanType)
                {
                case PROJECT_PLAN_TYPE.PROJECT_PLANNING:
                    tabPageTaskNotes.Visible = false;
                    frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.ALL_PROJECTS);
                    frm.SingleSelect = true;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        int prevProjectID = frm.SelectedItems[0].ID;
                        _mManager = (new ServiceProject()).GetProjectPlanForProjectID(prevProjectID, PROJECT_PLAN_TYPE.PROJECT_PLANNING);
                        _mChart.Init(_mManager);
                        _mChart.Invalidate();
                    }
                    break;

                case PROJECT_PLAN_TYPE.PROJECT_EXECUTION:
                    string strMessage = "Are you sure to Generate Execution plan from MasterPlanning?";
                    if (MessageBox.Show(strMessage, "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _mManager = _service.GetProjectPlanForProjectID(this.SelectedProjectID, PROJECT_PLAN_TYPE.PROJECT_PLANNING);
                        _service.UpdateProjectPlanning(this.SelectedProjectID, _mManager, this.SelectedPlanType);
                        PopulateGanttChart();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlGanttChart::btnImportMasterPlan_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #12
0
        private void btnAddNewOnSiteAttendance_Click(object sender, EventArgs e)
        {
            try
            {
                frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.EMPLOYEES);
                frm.SingleSelect = false;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;
                    foreach (MultiSelectListItem item in frm.SelectedItems)
                    {
                        OnSiteAttendanceModel  model = new OnSiteAttendanceModel();
                        TBL_MP_Master_Employee emp   = (new ServiceEmployee()).GetEmployeeDbRecordByID(item.ID);
                        if (emp != null)
                        {
                            model.EmployeeID   = emp.PK_EmployeeId;
                            model.EmployeeCode = emp.EmployeeCode;
                            model.EmployeeName = emp.EmployeeName;
                        }
                        model.AttendanceDate    = dtSiteAttendanceDate.Value;
                        model.AttendanceInTime  = new DateTime(model.AttendanceDate.Year, model.AttendanceDate.Month, model.AttendanceDate.Day, 8, 45, 0);
                        model.AttendanceOutTime = new DateTime(model.AttendanceDate.Year, model.AttendanceDate.Month, model.AttendanceDate.Day, 17, 15, 0);
                        model.AttendanceType    = ATTENDANCE_TYPE.PRESENT;
                        model.Remarks           = "";
                        List <TBL_MP_HR_ManualAttendance_Master> dbRecords = (new ServiceAttendance()).GetAttendanceRecordOfEmployeeOnDate(emp.PK_EmployeeId, model.AttendanceDate);
                        if (dbRecords.Count > 0)
                        {
                            TBL_MP_HR_ManualAttendance_Master attendanceRecord = dbRecords[0];
                            model.AttendanceType    = (ATTENDANCE_TYPE)attendanceRecord.AttendanceType;
                            model.AttendanceInTime  = attendanceRecord.AttendInTime;
                            model.AttendanceOutTime = attendanceRecord.AttendOutTime;
                            model.AtWarehouse       = attendanceRecord.AtWarehouse;
                            if (attendanceRecord.FK_LeaveApplicationID != null)
                            {
                                model.LeaveApplicationID = (int)attendanceRecord.FK_LeaveApplicationID;
                            }
                            if (attendanceRecord.FK_CostCenterId != null)
                            {
                                model.ProjectID   = (int)attendanceRecord.FK_CostCenterId;
                                model.ProjectName = attendanceRecord.TBL_MP_PMC_ProjectMaster.ProjectName;
                            }
                            model.Remarks = attendanceRecord.AttendanceRemarks;
                        }

                        if (listOnSiteATTENDANCE == null)
                        {
                            listOnSiteATTENDANCE = new BindingList <OnSiteAttendanceModel>();
                        }
                        listOnSiteATTENDANCE.Add(model);
                    }
                    gridOnSiteAttendance.DataSource = listOnSiteATTENDANCE;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageManualAttendance::btnAddNewManualAttendance_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }