예제 #1
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);
     }
 }
예제 #2
0
        public List <MultiSelectListItem> GetAllActiveRolesMultiSelect()
        {
            List <MultiSelectListItem> lstRoles = new List <MultiSelectListItem>();

            try
            {
                List <TBL_MP_Master_Role> dbRoles = _dbContext.TBL_MP_Master_Role.Where(x => x.IsActive == true).ToList();
                foreach (TBL_MP_Master_Role dbItem in dbRoles)
                {
                    MultiSelectListItem item = new MultiSelectListItem()
                    {
                        ID   = dbItem.PK_RoleId,
                        Code = dbItem.RoleNo
                    };
                    item.Description = string.Format("{0}", dbItem.RoleName);
                    lstRoles.Add(item);
                }
                lstRoles = lstRoles.OrderBy(x => x.Description).ToList();
            }
            catch (Exception ex)
            {
                string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
                MessageBox.Show(errMessage, "ServiceRoles::GetAllActiveRoles", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(lstRoles);
        }
예제 #3
0
        private void btnAddInventoryItems_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in gridInventoryItem.Rows)
                {
                    if ((bool)row.Cells["Selected"].Value == true)
                    {
                        int id = (int)row.Cells["ID"].Value;

                        MultiSelectListItem found = this.SelectedItems.Where(x => x.ID == id).FirstOrDefault();
                        if (found == null)
                        {
                            this.SelectedItems.Add(
                                new MultiSelectListItem()
                            {
                                ID          = id,
                                Description = string.Format("{0}", row.Cells["Description"].Value.ToString()),
                                Code        = row.Cells["Code"].Value.ToString()
                            });
                        }
                    }
                }
                PopulateSelectedItemsGrid();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditAssemblyChildItems::btnAddInventoryItems_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        public BindingList <MultiSelectListItem> GetAllPartiesOfTypeBindingListMultiSelect(string strType)
        {
            BindingList <MultiSelectListItem> lst = new BindingList <MultiSelectListItem>();

            try
            {
                List <Tbl_MP_Master_Party> lstDB = (from xx in _dbContext.Tbl_MP_Master_Party
                                                    where xx.PartyType == strType && xx.IsActive == true orderby xx.PartyName select xx).ToList();
                foreach (Tbl_MP_Master_Party item in lstDB)
                {
                    MultiSelectListItem model = new MultiSelectListItem()
                    {
                        ID          = item.PK_PartyId,
                        Description = string.Format("{0} ({1})\nEmail: {2}  Website: {3}\nGSTIN: {4}", item.PartyName, item.PartyCode, item.EmailID, item.Website, item.GSTNO),
                        Code        = item.PartyCode,
                        Selected    = false
                    };
                    lst.Add(model);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceParties::GetAllPartiesOfTypeBindingListMultiSelect", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(lst);
        }
예제 #5
0
        public List <MultiSelectListItem> GetAllPartiesMultiselect(string partyType)
        {
            List <MultiSelectListItem> lst = new List <MultiSelectListItem>();

            try
            {
                List <Tbl_MP_Master_Party> lstDB = _dbContext.Tbl_MP_Master_Party.Where(x => x.PartyType == partyType).Where(X => X.IsActive == true).OrderBy(x => x.PartyName).ToList();
                foreach (Tbl_MP_Master_Party item in lstDB)
                {
                    MultiSelectListItem model = new MultiSelectListItem()
                    {
                        ID          = item.PK_PartyId,
                        Description = string.Format("{0} ({1})\nEmail: {2}  Website: {3}\nGSTIN: {4}", item.PartyName, item.PartyCode, item.EmailID, item.Website, item.GSTNO),
                        Code        = item.PartyCode
                    };
                    lst.Add(model);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceParties::GetAllPartiesMultiselect", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(lst);
        }
        public BindingList <MultiSelectListItem> GelAllAssigneesForSchedule(int scheduleID)
        {
            BindingList <MultiSelectListItem> assignedEmployees = new BindingList <MultiSelectListItem>();

            try
            {
                BindingList <MultiSelectListItem>         allEmployees = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceMASTERS(_dbContext)).GetAllEmployeesMultiSelect());
                List <TBL_MP_CRM_ScheduleCallLogAssignee> assignees    = _dbContext.TBL_MP_CRM_ScheduleCallLogAssignee.Where(x => x.ScheduleID == scheduleID).Where(x => x.IsDeleted == false).ToList();
                foreach (TBL_MP_CRM_ScheduleCallLogAssignee item in assignees)
                {
                    MultiSelectListItem selItem = allEmployees.Where(x => x.ID == item.EmployeeID).FirstOrDefault();
                    if (selItem != null)
                    {
                        assignedEmployees.Add(selItem);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ServiceScheduleCallLog::GelAllAssigneesForSchedule", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            return(assignedEmployees);
        }
예제 #7
0
 private void SetFollowupButtonStatus()
 {
     try
     {
         ScheduleCallAddEditModel model = (new ServiceScheduleCallLog()).GetSchdeuledCallAddEditModelForSchedule(this.SelectedScheduleID);
         if (model != null)
         {
             MultiSelectListItem item = model.listAssignees.Where(x => x.ID == Program.CURR_USER.EmployeeID).FirstOrDefault();
             if (!ReadOnly)
             {
                 if (item == null)
                 {
                     btnAddNewFollowup.Enabled = btnEditFollowup.Enabled = btnDeleteFollowup.Enabled = btnEditSchedule.Enabled = btnDeleteSchedule.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                 }
                 else
                 {
                     btnAddNewFollowup.Enabled = btnEditFollowup.Enabled = btnDeleteFollowup.Enabled = btnEditSchedule.Enabled = btnDeleteSchedule.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ctrlScheduleCallLog::SetFollowupButtonStatus", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private static string GetSelectedItemText(
            IEnumerable <MultiSelectListItem> items,
            bool includeParent,
            bool ignoreFirstLevel)
        {
            var textBuffer = new StringBuilder();
            MultiSelectListItem previousParent = null;
            var orderedList = items.OrderBy(s => s.Parent != null &&
                                            ((ignoreFirstLevel && !s.Parent.IsFirstLevel) || !ignoreFirstLevel) ?
                                            s.Parent.Text.Substring(0, 4) + ": " :
                                            string.Empty + s.Text.Substring(0, 4))
                              .ToList();
            var firstTime = true;

            foreach (var item in orderedList)
            {
                item.Selected = true;

                var text = string.Empty;

                if ((includeParent && item.Parent != null) &&
                    ((ignoreFirstLevel && !item.Parent.IsFirstLevel) || !ignoreFirstLevel))
                {
                    if (previousParent != item.Parent)
                    {
                        if (!firstTime)
                        {
                            text = "\n";
                        }

                        firstTime = false;

                        previousParent = item.Parent;
                        text           = text + item.Parent.Text + ": ";
                    }

                    text += item.Text;
                }
                else
                {
                    text = item.Text;
                }

                textBuffer.AppendFormat("{0}, ", text);
            }

            if (textBuffer.Length > 0)
            {
                textBuffer.Length = textBuffer.Length - 2;
            }

            return(textBuffer.ToString());
        }
예제 #9
0
        public bool UpdateRoleModules(int roleID, BindingList <MultiSelectListItem> roleModules)
        {
            bool result = false;

            try
            {
                // INSETRING MODULE NOT FOUND IN DATABASE
                foreach (MultiSelectListItem item in roleModules)
                {
                    int moduelID = int.Parse(item.Code);
                    TBL_MP_Master_RoleModule dbRoleModule = (from xx in _dbContext.TBL_MP_Master_RoleModule where xx.FK_RoleId == roleID && xx.FK_ModuleId == moduelID select xx).FirstOrDefault();
                    if (dbRoleModule == null)
                    {
                        _dbContext.TBL_MP_Master_RoleModule.Add(new TBL_MP_Master_RoleModule()
                        {
                            FK_RoleId = roleID, FK_ModuleId = moduelID
                        });
                        _dbContext.SaveChanges();
                    }
                }

                // DELETING MODULE NOT FOUND IN COLLECTION
                String deleteIDs = string.Empty;
                List <TBL_MP_Master_RoleModule> dbItems = _dbContext.TBL_MP_Master_RoleModule.Where(x => x.FK_RoleId == roleID).ToList();
                foreach (TBL_MP_Master_RoleModule item in dbItems)
                {
                    MultiSelectListItem mItem = roleModules.Where(x => x.Code == item.FK_ModuleId.ToString()).FirstOrDefault();
                    if (mItem == null)
                    {
                        deleteIDs += item.FK_ModuleId.ToString() + DefaultStringSeperator;
                    }
                }
                if (deleteIDs != string.Empty)
                {
                    deleteIDs = deleteIDs.TrimEnd(DefaultStringSeperator).Replace(DefaultStringSeperator, ',');
                    string strQuery = string.Format("DELETE FROM TBL_MP_Master_RoleModule WHERE FK_ROLEID={0} AND FK_MODULEID IN ({1})", roleID, deleteIDs);
                    _dbContext.Database.ExecuteSqlCommand(strQuery);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += "\n" + ex.InnerException.Message;
                }
                MessageBox.Show(errMessage, "ServiceRoles::UpdateRoleModules", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
예제 #10
0
        public List <MultiSelectListItem> GetMultiSelectListContactsForParty(int partyID)
        {
            List <MultiSelectListItem> contacts = new List <MultiSelectListItem>();

            try
            {
                List <Tbl_MP_Master_PartyContact_Detail> dbList = _dbContext.Tbl_MP_Master_PartyContact_Detail.Where(xx => xx.FK_PartyID == (int?)partyID).ToList();
                foreach (Tbl_MP_Master_PartyContact_Detail item in dbList)
                {
                    string strText1 = string.Empty;
                    string strText2 = string.Empty;
                    strText1 = string.Format("{0}\n{1}", item.ContactPersoneName.ToUpper(), item.Address.Trim());
                    if (item.FK_Designation_Text != null)
                    {
                        strText1 += string.Format("{0}", item.FK_Designation_Text);
                    }
                    if (item.FK_Department_Text != null)
                    {
                        strText1 += string.Format("{0}", item.FK_Department_Text);
                    }

                    strText2 += string.Format("Mobile: {0} {1}\n", item.MobileNo, item.AltMobileNo);
                    strText2 += string.Format("Telephone: {0} {1}\n", item.TelephoneNo, item.AltTelephoneNo);
                    strText2 += string.Format("email: {0}\n", item.EmailID);

                    MultiSelectListItem model = new MultiSelectListItem();
                    model.ID          = item.PK_PartyContactDetails;
                    model.Selected    = false;
                    model.Code        = strText1;
                    model.Description = strText2;
                    model.EntityType  = APP_ENTITIES.CONTACTS;
                    contacts.Add(model);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceContacts::GetAllContactsForParty", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(contacts);
        }
예제 #11
0
        public List <MultiSelectListItem> ConvertToMultiSelectListItem(List <SelectListItem> lst)
        {
            List <MultiSelectListItem> newList = new List <MultiSelectListItem>();

            try
            {
                foreach (var selItem in lst)
                {
                    MultiSelectListItem item = new MultiSelectListItem()
                    {
                        Description = selItem.Description,
                        Code        = selItem.Code,
                        ID          = selItem.ID
                    };
                    newList.Add(item);
                }
            }
            catch (Exception ex)
            {
                KryptonMessageBox.Show(ex.Message, "AppCommon::ConvertToMultiSelectListItem");
            }
            return(newList);
        }
예제 #12
0
 private void btnDeleteModule_Click(object sender, EventArgs e)
 {
     try
     {
         // IN GRID WE HAVE {{CODE}} COLUMN TO HOLD MODULE-ID
         MultiSelectListItem selItem = _roleModulesList.Where(x => x.ID == this.SelectedRoleModuleID).FirstOrDefault();
         if (selItem != null)
         {
             string strMessage = "Are You sure to remove " + selItem.Description + " from the List of Assigned Modules";
             if (MessageBox.Show(strMessage, "CONFIRM", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 this.Cursor = Cursors.WaitCursor;
                 (new ServiceRoles()).RemoveRoleModule(this.SelectedRoleModuleID);
                 PopulateRoleModules();
                 this.Cursor = Cursors.Default;
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
         MessageBox.Show(errMessage, "pageRoleManager::btnDeleteModule_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #13
0
 public System.Data.DataTable UpdateRowTotalQuantity(System.Data.DataTable dtSourceBOQ, BindingList <MultiSelectListItem> services)
 {
     try
     {
         //UPDATE TOTAL QUANTITY FIELD FOR EACHROW IN DATATABLE
         foreach (DataRow row in dtSourceBOQ.Rows)
         {
             int totQty = 0;
             foreach (DataColumn col in dtSourceBOQ.Columns)
             {
                 MultiSelectListItem selService = services.Where(x => x.Description == col.ColumnName).FirstOrDefault();
                 if (selService != null)
                 {
                     if (row.ItemArray[col.Ordinal] != DBNull.Value)
                     {
                         totQty += int.Parse(row[col.ColumnName].ToString());
                     }
                 }
             }
             if (totQty == 0)
             {
                 row[COL_HAS_SERVICES] = false;
             }
             else
             {
                 row[COL_HAS_SERVICES] = true;
                 row[COL_TOTAL_QTY]    = totQty;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ServiceSalesEnquiryBOQ::UpdateRowTotalQuantity", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     return(dtSourceBOQ);
 }
예제 #14
0
        public void PrepareForInsert()
        {
            DB_MODEL = new TBL_MP_CRM_ScheduleCallLog();
            string strCaption          = string.Empty;
            string strContactNames     = string.Empty;
            string strContactNumbers   = string.Empty;
            string strContactAddresses = string.Empty;

            try
            {
                switch (this.SOURCE_ENTITY)
                {
                case APP_ENTITIES.SALES_LEAD:
                    LeadMasterInfoModel leadInfo = (new ServiceSalesLead()).GetLeadMasterInfo(this.SOURCE_ENTITY_ID);
                    strCaption            = string.Format("LEAD: {0} {1} dt. {2}", leadInfo.LeadNo, leadInfo.LeadName, leadInfo.LeadDate.Value.ToString("dd MMM yyyy"));
                    DB_MODEL.CustomerName = leadInfo.LeadName;

                    List <SelectContactModel> listContacts = (new ServiceSalesLead()).GetContactsForLeadID(this.SOURCE_ENTITY_ID);
                    DB_MODEL.ContactPerson = string.Empty;
                    foreach (SelectContactModel model in listContacts)
                    {
                        string[] names = model.Description1.Split('\n');
                        DB_MODEL.ContactPerson += names[0] + ", ";
                        DB_MODEL.ContactNumber += model.Description2 + ", ";
                        DB_MODEL.Location      += model.Description1.Replace(names[0], "");
                    }

                    DB_MODEL.ContactPerson = DB_MODEL.ContactPerson.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.ContactNumber = DB_MODEL.ContactNumber.TrimEnd(' ').TrimEnd(',');

                    break;

                case APP_ENTITIES.SALES_ENQUIRY:
                    TBL_MP_CRM_SalesEnquiry dbEnquiry = (new ServiceSalesEnquiry()).GetEnquiryMasterDBInfo(this.SOURCE_ENTITY_ID);
                    strCaption            = string.Format("ENQUIRY: {0} {1} dt. {2}", dbEnquiry.SalesEnquiry_No, dbEnquiry.Project_Name, dbEnquiry.SalesEnquiry_Date.ToString("dd MMM yyyy"));
                    DB_MODEL.CustomerName = dbEnquiry.Tbl_MP_Master_Party.PartyName;
                    List <TBL_MP_CRM_SM_ContactReferences> listEnquiryContacts = (new ServiceSalesEnquiry()).GetAllCompanyContactsForSalesEnquiryDB(this.SOURCE_ENTITY_ID);
                    strContactNames = strContactNumbers = strContactAddresses = string.Empty;
                    foreach (TBL_MP_CRM_SM_ContactReferences refContact in listEnquiryContacts)
                    {
                        strContactNames     += string.Format("{0}\n", refContact.Tbl_MP_Master_PartyContact_Detail.ContactPersoneName);
                        strContactAddresses += string.Format("{0}\n\n", refContact.Tbl_MP_Master_PartyContact_Detail.Address);
                        strContactNumbers   += string.Format("Mobile: {0}  {1}", refContact.Tbl_MP_Master_PartyContact_Detail.MobileNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltMobileNo);
                        strContactNumbers   += string.Format("Tel: {0}  {1}\n", refContact.Tbl_MP_Master_PartyContact_Detail.TelephoneNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltTelephoneNo);
                    }

                    DB_MODEL.ContactPerson = strContactNames.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.ContactNumber = strContactNumbers.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.Location      = strContactAddresses;
                    break;

                case APP_ENTITIES.SALES_QUOTATION:
                    TBL_MP_CRM_SalesQuotation dbQuote = (new ServiceSalesQuotation()).GetSalesQuotationMasterDBInfo(this.SOURCE_ENTITY_ID);
                    strCaption            = string.Format("ENQUIRY: {0} dt. {1}", dbQuote.Quotation_No, dbQuote.Quotation_Date.ToString("dd MMM yyyy"));
                    DB_MODEL.CustomerName = dbQuote.Tbl_MP_Master_Party.PartyName;
                    List <TBL_MP_CRM_SM_ContactReferences> listQuoteContacts = (new ServiceSalesQuotation()).GetAllCompanyContactsForSalesQuotationDB(this.SOURCE_ENTITY_ID);
                    strContactNames = strContactNumbers = strContactAddresses = string.Empty;
                    foreach (TBL_MP_CRM_SM_ContactReferences refContact in listQuoteContacts)
                    {
                        strContactNames     += string.Format("{0}\n", refContact.Tbl_MP_Master_PartyContact_Detail.ContactPersoneName);
                        strContactAddresses += string.Format("{0}\n\n", refContact.Tbl_MP_Master_PartyContact_Detail.Address);
                        strContactNumbers   += string.Format("Mobile: {0}  {1}", refContact.Tbl_MP_Master_PartyContact_Detail.MobileNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltMobileNo);
                        strContactNumbers   += string.Format("Tel: {0}  {1}\n", refContact.Tbl_MP_Master_PartyContact_Detail.TelephoneNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltTelephoneNo);
                    }

                    DB_MODEL.ContactPerson = strContactNames.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.ContactNumber = strContactNumbers.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.Location      = strContactAddresses;
                    break;

                case APP_ENTITIES.SALES_ORDER:
                    TBL_MP_CRM_SalesOrder dbOrder = (new ServiceSalesOrder()).GetSalesOrderDBInfoByID(this.SOURCE_ENTITY_ID);
                    strCaption            = string.Format("ORDER: {0} dt. {1}", dbOrder.SalesOrderNo, dbOrder.SalesOrderDate.ToString("dd MMM yyyy"));
                    DB_MODEL.CustomerName = dbOrder.Tbl_MP_Master_Party.PartyName;
                    List <TBL_MP_CRM_SM_ContactReferences> listOrderContacts = (new ServiceSalesOrder()).GetAllCompanyContactsForSalesOrderDB(this.SOURCE_ENTITY_ID);
                    strContactNames = strContactNumbers = strContactAddresses = string.Empty;
                    foreach (TBL_MP_CRM_SM_ContactReferences refContact in listOrderContacts)
                    {
                        strContactNames     += string.Format("{0}\n", refContact.Tbl_MP_Master_PartyContact_Detail.ContactPersoneName);
                        strContactAddresses += string.Format("{0}\n\n", refContact.Tbl_MP_Master_PartyContact_Detail.Address);
                        strContactNumbers   += string.Format("Mobile: {0}  {1}", refContact.Tbl_MP_Master_PartyContact_Detail.MobileNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltMobileNo);
                        strContactNumbers   += string.Format("Tel: {0}  {1}\n", refContact.Tbl_MP_Master_PartyContact_Detail.TelephoneNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltTelephoneNo);
                    }

                    DB_MODEL.ContactPerson = strContactNames.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.ContactNumber = strContactNumbers.TrimEnd(' ').TrimEnd(',');
                    DB_MODEL.Location      = strContactAddresses;
                    break;
                }

                DateTime currDatetime = AppCommon.GetServerDateTime();
                DB_MODEL.StartAt  = currDatetime;
                DB_MODEL.EndsAt   = currDatetime.AddDays(1);
                DB_MODEL.Reminder = currDatetime.AddHours(-1);
                HeaderTitle       = strCaption;

                BindingList <MultiSelectListItem> allEmployees = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceMASTERS()).GetAllEmployeesMultiSelect());
                this.listAssignees = new BindingList <MultiSelectListItem>();
                MultiSelectListItem emp = allEmployees.Where(x => x.ID == currEmpID).FirstOrDefault();
                if (emp != null)
                {
                    this.listAssignees.Add(emp);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ScheduleCallAddEditModel::PrepareForInsert", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #15
0
        public void PopulateDataGrid()
        {
            this.Items    = null;
            SelectedItems = null;
            switch (_ENTITY)
            {
            case APP_ENTITIES.AGENTS:
                headerGroupSelection.ValuesPrimary.Heading = "Select Agents";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.PartiesService.GetAllPartiesMultiselect("A"));
                break;

            case APP_ENTITIES.EMPLOYEES:
                headerGroupSelection.ValuesPrimary.Heading = "Select Employees";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.MasterService.GetAllEmployeesMultiSelect());
                break;

            case APP_ENTITIES.PARTIES:
                headerGroupSelection.ValuesPrimary.Heading = "Select Parties";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.MasterService.GetAllPartiesMultiSelect());
                break;

            case APP_ENTITIES.CUSTOMERS:
                headerGroupSelection.ValuesPrimary.Heading = "Select Customer";
                this.Items = (new ServiceParties()).GetAllPartiesOfTypeBindingListMultiSelect("C");;
                break;

            case APP_ENTITIES.CONTACTS:
                headerGroupSelection.ValuesPrimary.Heading = "Select Contacts";
                switch (this.SOURCE_ENTITY)
                {
                case APP_ENTITIES.SALES_LEAD:
                    List <SelectContactModel>  lst          = _UOM.SalesLeadService.GetContactsForLeadID(this.SOURCE_ENTITY_ID);
                    List <MultiSelectListItem> listContacts = new List <MultiSelectListItem>();
                    foreach (SelectContactModel model in lst)
                    {
                        MultiSelectListItem itm = new MultiSelectListItem()
                        {
                            ID          = model.ContactID,
                            Description = model.Description1,
                            EntityType  = APP_ENTITIES.CONTACTS
                        };
                        listContacts.Add(itm);
                    }
                    this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(listContacts);
                    break;

                case APP_ENTITIES.SALES_ENQUIRY:
                    BindingList <SelectListItem> lstContacts = (new ServiceSalesEnquiry()).GetAllContactsForSalesEnquiry(this.SOURCE_ENTITY_ID);
                    this.Items = new BindingList <MultiSelectListItem>();
                    if (lstContacts != null)
                    {
                        foreach (SelectListItem model in lstContacts)
                        {
                            MultiSelectListItem item = new MultiSelectListItem()
                            {
                                ID = model.ID, EntityType = APP_ENTITIES.CONTACTS, Description = model.Description
                            };
                            Items.Add(item);
                        }
                    }
                    break;
                }
                break;

            case APP_ENTITIES.ASSOCIATES_AND_CONTACTS:
                switch (this.SOURCE_ENTITY)
                {
                case APP_ENTITIES.SALES_LEAD:
                    this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.SalesLeadService.GetAllAssociatesAndContactForLead(this.SOURCE_ENTITY_ID));
                    break;

                case APP_ENTITIES.SALES_ENQUIRY:
                    this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.SalesEnquiryService.GetAllAssociatesAndContactForEnquiry(this.SOURCE_ENTITY_ID));
                    break;
                }
                headerGroupSelection.ValuesPrimary.Heading = "Select Contacts & Employees";
                break;

            case APP_ENTITIES.SALES_LEAD:
                headerGroupSelection.ValuesPrimary.Heading = "Select Open Sales Lead";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.SalesLeadService.GetLeadsMulitiSelectionList(Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.LeadStatusOpen].DEFAULT_VALUE).ToList());
                break;

            case APP_ENTITIES.SALES_LEAD_APPROVED_OPEN:
                headerGroupSelection.ValuesPrimary.Heading = "Select Open Sales Lead";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.SalesLeadService.GetApprovedOpenLeadsMulitiSelectionList().ToList());
                break;

            case APP_ENTITIES.BOQ_SERVICES:
                headerGroupSelection.ValuesPrimary.Heading = "Select Multiple Services";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.MasterService.GetAllServicesMultiSelect());
                break;

            case APP_ENTITIES.UOM_LIST:
                headerGroupSelection.ValuesPrimary.Heading = "Select UNIT OF MEASUREMENT";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.MasterService.GetAllUOMsMultiSelect());
                break;

            case APP_ENTITIES.INVENTORY_ITEMS_LIST:
                headerGroupSelection.ValuesPrimary.Heading = "Select Multiple Part Numbers";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceInventoryItems()).GetAllInventoryItemsMultiSelect());
                break;

            case APP_ENTITIES.APPLICATION_MODULES:
                headerGroupSelection.ValuesPrimary.Heading = "Select Multiple Application Modules";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceModules()).GetActiveModulesMultiSelectionList());
                break;

            case APP_ENTITIES.MODULES_FORMS:
                headerGroupSelection.ValuesPrimary.Heading = "Select Multiple Module Operations";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceModules()).GetMultiSelectActiveFormsForModule(this.SOURCE_ENTITY_ID));
                break;

            case APP_ENTITIES.ROLES:
                headerGroupSelection.ValuesPrimary.Heading = string.Format("Select {0} Roles ", (_singleSelect)?" a ":" Multiple ");
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceRoles()).GetAllActiveRolesMultiSelect());
                break;

            case APP_ENTITIES.INVENTORY_ASSEMBLY_ITEMS:
                headerGroupSelection.ValuesPrimary.Heading = string.Format("Select {0} Child Items", (_singleSelect) ? " a " : " Multiple ");
                this.Items = (new ServiceInventoryItems()).GetMultiselectInventoryItemListForAssembly(this.SOURCE_ENTITY_ID);
                break;

            case APP_ENTITIES.SALES_ENQUIRY:
                headerGroupSelection.ValuesPrimary.Heading = string.Format("Select {0} Sales Enquiry", (_singleSelect) ? " a " : " Multiple ");
                this.Items = (new ServiceSalesEnquiry()).GetMultiselectSalesEnquiriesList();
                break;

            case APP_ENTITIES.SALES_ENQUIRY_APPROVED_OPEN:
                headerGroupSelection.ValuesPrimary.Heading = "Select SALES ENQUIRY";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceSalesEnquiry()).GetApprovedOpenEnquiriesMulitiSelectionList().ToList());
                break;

            case APP_ENTITIES.SALES_QUOTATION_TERMS_AND_CONDITIONS:
                headerGroupSelection.ValuesPrimary.Heading = "SALES QUOTATION - TERMS & CONDITIONS";
                int _temp = Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.TermAndConditionSalesQuotationCategory].DEFAULT_VALUE;
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceTermsAndConditions()).GetAllTermsAndConditionsForCategoryMultiSelectListItem(_temp));
                break;

            case APP_ENTITIES.SALES_QUOTATION_REVIEW_SELECT_QUOTATION:
                this.Text = "Select Sales Quotartion for Review";
                headerGroupSelection.ValuesPrimary.Heading = "SALES QUOTATION";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceSalesQuotationReview()).GetAllQuotationsForSelectintoReview());
                break;

            case APP_ENTITIES.SALES_ORDER_SELECT_QUOTATION:
                this.Text = "Select Sales Quotation";
                headerGroupSelection.ValuesPrimary.Heading = "SALES QUOTATION(s)";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceSalesQuotation()).GetAllApprovedAndOpenSalesQuotations());
                break;

            case APP_ENTITIES.SALES_ORDER_TERMS_AND_CONDITIONS:
                headerGroupSelection.ValuesPrimary.Heading = "SALES ORDERS - TERMS & CONDITIONS";
                int soTNCCategoryID = Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.TermAndConditionSalesOrderCategory].DEFAULT_VALUE;
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceTermsAndConditions()).GetAllTermsAndConditionsForCategoryMultiSelectListItem(soTNCCategoryID));
                break;

            case APP_ENTITIES.ALL_PROJECTS:
                headerGroupSelection.ValuesPrimary.Heading = "Select Source Project";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceProject()).GetAllProjectsForMultipleSelection());
                break;

            case APP_ENTITIES.ACTIVE_PROJECT:
                headerGroupSelection.ValuesPrimary.Heading = "Select Source Project/Site";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceProject()).GetAllActiveProjectsForMultipleSelection());
                break;

            case APP_ENTITIES.SUPPLIERS:
                headerGroupSelection.ValuesPrimary.Heading = "Select Suppliers";
                this.Items = AppCommon.ConvertToBindingList <MultiSelectListItem>(_UOM.PartiesService.GetAllPartiesMultiselect("S"));
                break;
            }

            gridData.DataSource                = this.Items;
            gridData.Columns["ID"].Visible     = gridData.Columns["Code"].Visible = gridData.Columns["DescriptionToUpper"].Visible = gridData.Columns["EntityType"].Visible = false;
            gridData.Columns["Selected"].Width = (int)(gridData.Width * .1);
            gridData.Columns["Description"].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            if (this.Items != null)
            {
                headerGroupSelection.ValuesSecondary.Heading = string.Format("{0} records found.", this.Items.Count);
            }
        }