コード例 #1
0
        private void PopulateConsultantInfo()
        {
            try
            {
                headerGroupConsultant.ValuesPrimary.Heading = "CONSULTANT:";
                txtConsultantInfo.Text = string.Empty;
                TBL_MP_CRM_SalesEnquiry objEnquiry = (new ServiceSalesEnquiry()).GetEnquiryMasterDBInfo(this.SelectedEnquiryID);
                if (objEnquiry == null)
                {
                    return;
                }
                if (objEnquiry.Enquiry_Genrated_By != "A")
                {
                    return;
                }
                this.SelectedConsultantID = (int)objEnquiry.FK_EnqGenerated_Agent_ID;
                Tbl_MP_Master_Party dbParty = (new ServiceParties()).GetPartyByPartyID(this.SelectedConsultantID);

                headerGroupConsultant.ValuesPrimary.Heading = string.Format("CONSULTANT: {0}", objEnquiry.Enquiry_Genrated_By_Name);
                string strInfo = objEnquiry.Enquiry_Genrated_By_Name.ToUpper();
                strInfo += string.Format("\nemail: {0} Website: {1}", dbParty.EmailID, dbParty.Website);
                strInfo += string.Format("\nGST NO: {0}", dbParty.GSTNO);
                txtConsultantInfo.Text            = strInfo;
                gridConsultantContacts.DataSource = (new ServiceContacts()).GetMultiSelectListContactsForParty(this.SelectedConsultantID);
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlSalesEnquiryClientIDetails::PopulateConsultantInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        public bool UndeleteParty(int partyID, string reason)
        {
            bool result = false;

            try
            {
                Tbl_MP_Master_Party editItem = _dbContext.Tbl_MP_Master_Party.Where(x => x.PK_PartyId == partyID).FirstOrDefault();
                editItem.DeleteDateTime = null;
                editItem.DeletedBy      = null;
                editItem.IsActive       = true;
                editItem.DeleteRemarks  = reason;
                _dbContext.SaveChanges();
                result = true;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceParties::UndeleteParty", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
コード例 #3
0
 private void PopulateSelectedSalesEnquiryInfo()
 {
     try
     {
         TBL_MP_CRM_SalesEnquiry objEnquiry = (new ServiceSalesEnquiry()).GetEnquiryMasterDBInfo(SelectedSalesEnquiryID);
         if (objEnquiry != null)
         {
             txtEnquiryNumber.Text         = string.Format("{0} dt. {1}", objEnquiry.SalesEnquiry_No, objEnquiry.SalesEnquiry_Date.ToString("dd MMM yyyy"));
             txtProjectName.Text           = objEnquiry.Project_Name;
             cboProjectSector.SelectedItem = ((List <SelectListItem>)cboProjectSector.DataSource).Where(x => x.ID == objEnquiry.FK_Userlist_ProjectType_ID).FirstOrDefault();
             PopulateCitiesDropdown((int)objEnquiry.FK_Project_State_ID);
             cboProjectLocation.SelectedItem = ((List <SelectListItem>)cboProjectLocation.DataSource).Where(x => x.ID == objEnquiry.FK_Project_City_ID).FirstOrDefault();
         }
         Tbl_MP_Master_Party party = objEnquiry.Tbl_MP_Master_Party;
         if (party != null)
         {
             cboClient.SelectedItem = ((List <SelectListItem>)cboClient.DataSource).Where(x => x.ID == objEnquiry.FK_Customer_ID).FirstOrDefault();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmSalesQuotation::PopulateSelectedSalesEnquiryInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #4
0
        public void ScatterData()
        {
            try
            {
                Tbl_MP_Master_Party model = _UOM.PartiesService.GetPartyByPartyID(this.SelectedID);
                if (model != null)
                {
                    txtPartyCode.Text      = model.PartyCode;
                    txtPartyName.Text      = model.PartyName;
                    this.SelectedPartyType = model.PartyType;
                    if (model.FK_IndustryType > 0)
                    {
                        cboIndustryType.SelectedItem = ((List <SelectListItem>)cboIndustryType.DataSource).Where(x => x.ID == model.FK_IndustryType).FirstOrDefault();
                    }

                    txtEmail.Text   = model.EmailID;
                    txtWebSite.Text = model.Website;

                    txtPANNumber.Text = model.PANNo;
                    txtGSTNo.Text     = model.GSTNO;
                }
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                if (ex.InnerException != null)
                {
                    strErr += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(strErr, "frmParty::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                errorProvider1.Clear();
                if (this.ValidateChildren())
                {
                    Tbl_MP_Master_Party model = null;
                    if (this.SelectedID == 0)
                    {
                        model                 = new Tbl_MP_Master_Party();
                        model.PartyCode       = txtPartyCode.Text;
                        model.PartyName       = txtPartyName.Text;
                        model.PartyType       = this.SelectedPartyType;
                        model.FK_IndustryType = ((SelectListItem)cboIndustryType.SelectedItem).ID;

                        model.EmailID = txtEmail.Text;
                        model.Website = txtWebSite.Text;

                        model.GSTNO     = txtGSTNo.Text;
                        model.PANNo     = txtPANNumber.Text;
                        model.IsActive  = true;
                        this.SelectedID = _UOM.PartiesService.AddNewParty(model);

                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        model = _UOM.PartiesService.GetPartyByPartyID(this.SelectedID);
                        if (model != null)
                        {
                            model.PartyCode       = txtPartyCode.Text;
                            model.PartyName       = txtPartyName.Text;
                            model.PartyType       = this.SelectedPartyType;
                            model.FK_IndustryType = ((SelectListItem)cboIndustryType.SelectedItem).ID;

                            model.EmailID = txtEmail.Text;
                            model.Website = txtWebSite.Text;

                            model.GSTNO = txtGSTNo.Text;
                            model.PANNo = txtPANNumber.Text;

                            _UOM.PartiesService.UpdateParty(model);

                            this.DialogResult = DialogResult.OK;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                if (ex.InnerException != null)
                {
                    strErr += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(strErr, "frmParty::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
ファイル: PageParties.cs プロジェクト: rupeshaveva/ExcelERP
 private void gridParties_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0)
         {
             if (gridParties.Rows.Count > 0)
             {
                 txtRemarks.Text      = String.Empty;
                 this.SelectedPartyID = (int)gridParties.Rows[e.RowIndex].Cells["ID"].Value;
                 string[] arrString = gridParties.Rows[e.RowIndex].Cells["Description"].Value.ToString().Split('\n');
                 headerContacts.Values.Heading = string.Format("{0} Contacts", arrString[0]);
                 bool active = bool.Parse(gridParties.Rows[e.RowIndex].Cells["IsActive"].Value.ToString());
                 if (!active)
                 {
                     btnDeleteParty.Text    = "&Undelete Party";
                     btnEditParty.Enabled   = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                     headerContacts.Enabled = false;
                     Tbl_MP_Master_Party dbParty = (new ServiceParties()).GetPartyByPartyID(this.SelectedPartyID);
                     if (dbParty != null)
                     {
                         string strTitle = string.Empty;
                         if (dbParty.DeletedBy != null)
                         {
                             strTitle = string.Format("DELETED BY {0} DT. {1}", ServiceEmployee.GetEmployeeNameByID((int)dbParty.DeletedBy), dbParty.DeleteDateTime.Value.ToString("dd MMM yy HH:mmtt"));
                         }
                         headerGroupDelete.ValuesPrimary.Heading = strTitle;
                         txtRemarks.Text = dbParty.DeleteRemarks;
                     }
                 }
                 else
                 {
                     headerGroupDelete.ValuesPrimary.Heading = "ACTIVE PARTY";
                     btnDeleteParty.Text    = "&Delete Party";
                     btnEditParty.Enabled   = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                     headerContacts.Enabled = true;
                     Tbl_MP_Master_Party dbParty = (new ServiceParties()).GetPartyByPartyID(this.SelectedPartyID);
                     if (dbParty != null)
                     {
                         txtRemarks.Text = dbParty.DeleteRemarks;
                     }
                 }
                 OnPartySelectionchange();
             }
             SetPermissionwiseButtonStatus();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageParties::gridParties_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #7
0
        public string GetPartyNameByPartyID(int partyID)
        {
            string strName            = string.Empty;
            Tbl_MP_Master_Party model = this.GetPartyByPartyID(partyID);

            if (model != null)
            {
                strName = model.PartyName;
            }
            return(strName);
        }
コード例 #8
0
        public int UpdateParty(Tbl_MP_Master_Party model)
        {
            try
            {
                //model.LastModifiedBy = Program.CURR_USER.EmployeeID;
                model.LastModifiedDate = AppCommon.GetServerDateTime();
                _dbContext.SaveChanges();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceParties::UpdateParty", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(model.PK_PartyId);
        }
コード例 #9
0
        public int AddNewParty(Tbl_MP_Master_Party model)
        {
            try
            {
                model.PartyCode       = this.GenerateNewPartyCode(model.PartyType);
                model.CreatedDatetime = AppCommon.GetServerDateTime();
                _dbContext.Tbl_MP_Master_Party.Add(model);
                _dbContext.SaveChanges();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceParties::AddNewParty", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(model.PK_PartyId);
        }
コード例 #10
0
        private void PopulateDescription()
        {
            try
            {
                switch (this.ENTITY)
                {
                case APP_ENTITIES.INVENTORY_ITEM:
                    TBL_MP_Master_Item dbItem = (new ServiceInventoryItems()).GetItemDBRecord(this.ENTITY_ID);
                    if (dbItem != null)
                    {
                        txtDescription.Text = string.Format("{0}\n{1}\nCODE: {2}", dbItem.Item_Name, dbItem.Long_Description, dbItem.ItemCode);
                    }
                    break;

                case APP_ENTITIES.PARTIES:
                    Tbl_MP_Master_Party dbParty = (new ServiceParties()).GetPartyByPartyID(this.ENTITY_ID);
                    if (dbParty != null)
                    {
                        txtDescription.Text = string.Format("{0} ({1})\n{2}", dbParty.PartyName, dbParty.PartyType, dbParty.PartyCode);
                    }
                    break;

                case APP_ENTITIES.INVENTORY_ITEM_ATTACHMENT:
                    TBL_MP_Master_Item_Attachments dbItemAttachment = (new ServiceInventoryItems()).GetInventoryItemAttachmentDBRecord(this.ENTITY_ID);
                    if (dbItemAttachment != null)
                    {
                        txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbItemAttachment.Title.ToUpper(), dbItemAttachment.TBL_MP_Master_Item.Item_Name, dbItemAttachment.TBL_MP_Master_Item.Long_Description);
                    }
                    break;

                case APP_ENTITIES.APPLICATION_MODULES:
                    Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID(this.ENTITY_ID);
                    if (dbModule != null)
                    {
                        txtDescription.Text = string.Format("NAME: {0}\nDISPLAY: {1}", dbModule.ModuleName, dbModule.DisplayName);
                    }
                    break;

                case APP_ENTITIES.MODULES_FORMS:
                    Tbl_MP_Master_Module_Forms dbForm = (new ServiceModules()).GetModuleFormDBRecordByID(this.ENTITY_ID);
                    if (dbForm != null)
                    {
                        txtDescription.Text = string.Format("NAME: {0}\nDISPLAY: {1}", dbForm.FormName, dbForm.DisplayName);
                    }
                    break;

                case APP_ENTITIES.ROLES:
                    TBL_MP_Master_Role dbRole = (new ServiceRoles()).GetRoleDBRecordByID(this.ENTITY_ID);
                    if (dbRole != null)
                    {
                        txtDescription.Text = string.Format("ROLE NAME: {0}\nROLE NO.: {1}", dbRole.RoleName, dbRole.RoleNo);
                    }
                    break;

                case APP_ENTITIES.SALES_LEAD_ATTACHMENT:
                    TBL_MP_CRM_SM_SalesLead_Attachment dbLeadAttachment = (new ServiceSalesLead()).GetSalesLeadAttachmentDBRecord(this.ENTITY_ID);
                    if (dbLeadAttachment != null)
                    {
                        txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbLeadAttachment.Title.ToUpper(), dbLeadAttachment.TBL_MP_CRM_SM_SalesLead.LeadNo, dbLeadAttachment.TBL_MP_Master_UserList.Description1);
                    }
                    break;

                case APP_ENTITIES.SALES_ENQUIRY_ATTACHMENT:
                    TBL_MP_CRM_SalesEnquiry_Attachments dbEnquiryAttachment = (new ServiceSalesEnquiry()).GetSalesEnquiryAttachmentDBRecord(this.ENTITY_ID);
                    if (dbEnquiryAttachment != null)
                    {
                        txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbEnquiryAttachment.Title.ToUpper(), dbEnquiryAttachment.TBL_MP_CRM_SalesEnquiry.SalesEnquiry_No, dbEnquiryAttachment.TBL_MP_Master_UserList.Description1);
                    }
                    break;

                case APP_ENTITIES.SALES_QUOTATION_ATTACHMENT:
                    TBL_MP_CRM_SalesQuotation_Attachments dbQuoteAttachment = (new ServiceSalesQuotation()).GetSalesQuotationAttachmentDBRecord(this.ENTITY_ID);
                    if (dbQuoteAttachment != null)
                    {
                        txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbQuoteAttachment.Title.ToUpper(), dbQuoteAttachment.TBL_MP_CRM_SalesQuotation.Quotation_No, dbQuoteAttachment.TBL_MP_Master_UserList.Description1);
                    }
                    break;

                case APP_ENTITIES.SALES_ORDER_ATTACHMENT:
                    TBL_MP_CRM_SalesOrder_Attachment dbOrderAttachment = (new ServiceSalesOrder()).GetSalesOrderAttachmentDBRecord(this.ENTITY_ID);
                    if (dbOrderAttachment != null)
                    {
                        txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbOrderAttachment.Title.ToUpper(), dbOrderAttachment.TBL_MP_CRM_SalesOrder.SalesOrderNo, dbOrderAttachment.TBL_MP_Master_UserList.Description1);
                    }
                    break;

                case APP_ENTITIES.EMPLOYEES_ATTACHMENT:
                    TBL_MP_Master_Employee_Attachment dbEmpAttachment = (new ServiceEmployee()).GetEmployeeAttachmentDBRecord(this.ENTITY_ID);
                    if (dbEmpAttachment != null)
                    {
                        txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbEmpAttachment.Title.ToUpper(), dbEmpAttachment.TBL_MP_Master_Employee.EmployeeCode, dbEmpAttachment.TBL_MP_Master_UserList.Description1);
                    }
                    break;

                case APP_ENTITIES.CONTACTS:
                    Tbl_MP_Master_PartyContact_Detail dbContact = (new ServiceContacts()).GetContactID(this.ENTITY_ID);
                    if (dbContact != null)
                    {
                        txtDescription.Text = string.Format("Contact Person Name : {0}\nAddress:{1}\nMobile No:{2}\nAt.Telephone No:{3}\nEmail ID:{4}\n FAX NO:{5}", dbContact.ContactPersoneName, dbContact.Address, dbContact.MobileNo, dbContact.TelephoneNo, dbContact.EmailID, dbContact.FaxNo);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmDelete::PopulateDescription", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #11
0
        public bool GatherData()
        {
            bool result = false;

            try
            {
                if (this.SelectedLeadID == 0)
                {
                    model = new TBL_MP_CRM_SM_SalesLead();
                }
                else
                {
                    model = _UNIT.SalesLeadService.GetLeadMasterDBInfo(this.SelectedLeadID);
                }

                if (model == null)
                {
                    MessageBox.Show("Cannot create Lead Master Object"); return(false);
                }

                model.LeadNo   = txtLeadNumber.Text.ToString();
                model.LeadDate = dtLeadDate.Value;
                if (model.LeadDate == null)
                {
                    MessageBox.Show("Select a valid Date of Lead creation", "GatherData", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (cboCompanies.SelectedItem != null)
                {
                    model.FK_PartyID = (int)cboCompanies.SelectedValue;
                    Tbl_MP_Master_Party party = _UNIT.PartiesService.GetPartyByPartyID((int)cboCompanies.SelectedValue);
                    if (party != null)
                    {
                        model.LeadName    = party.PartyName;
                        model.LeadEmailID = party.EmailID;
                        model.LeadWebsite = party.Website;
                    }
                }
                else
                {
                    MessageBox.Show("Select a valid Company and its Contacts to continue", "GatherData", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                model.LeadRequirement = txtLeadRequirements.Text;

                if (txtEstimatedValue.Text.Trim() != string.Empty)
                {
                    model.EstimatedValue       = Convert.ToDecimal(txtEstimatedValue.Text);
                    model.FK_EstimatedCurrency = (int)cboCurrency.SelectedValue;
                }
                else
                {
                    model.EstimatedValue = null;
                }

                if (cboAssignedTo.SelectedItem != null)
                {
                    model.FK_LeadAssignTo = (int)cboAssignedTo.SelectedValue;
                }
                else
                {
                    model.FK_LeadAssignTo = null;
                }
                if (model.FK_LeadAssignTo == null)
                {
                    MessageBox.Show("Select a valid Assignee for this Lead", "GatherData", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (cboProjectSector.SelectedItem != null)
                {
                    model.FK_ProjectType = (int)cboProjectSector.SelectedValue;
                }
                else
                {
                    model.FK_ProjectType = null;
                }


                model.FK_Status = (int)cboSalesLeadStatus.SelectedValue;
                if (model.FK_Status == closeStatusID || model.FK_Status == lostStatusID)
                {
                    model.ReasonClose = txtReasonLost.Text;
                }

                model.FK_LeadSource = (int)cboLeadSources.SelectedValue;
                if (model.FK_LeadSource != null)
                {
                    if (model.FK_LeadSource == Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.LeadSourceAgency].DEFAULT_VALUE)
                    {
                        model.FK_AgentID = (int)cboAgencies.SelectedValue;
                        if (model.FK_AgentID == null)
                        {
                            MessageBox.Show("Select a valid Agency/Consultant of Lead", "GatherData", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Select a valid Source of Lead", "GatherData", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }


                result = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "frmSalesLead::GatherData", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(result);
        }
コード例 #12
0
ファイル: frmSendMail.cs プロジェクト: rupeshaveva/ExcelERP
        private void ReceipentSelectionLink_Clicked(object sender, EventArgs e)
        {
            try
            {
                SELECTED_ENTITY = (APP_ENTITIES)((KryptonLinkLabel)sender).Tag;
                frmGridMultiSelect frm = new frmGridMultiSelect(SELECTED_ENTITY, SOURCE_ENTITY, SOURCE_ENTITY_ID);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    BindingList <MultiSelectListItem> selectedIDs = frm.SelectedItems;

                    if (selectedIDs != null)
                    {
                        string strAddresses = string.Empty;
                        if (txtMailTo.Text.Trim() != string.Empty)
                        {
                            if (!txtMailTo.Text.Trim().EndsWith(";"))
                            {
                                txtMailTo.Text += ";";
                            }
                        }
                        switch (SELECTED_ENTITY)
                        {
                        case APP_ENTITIES.EMPLOYEES:
                            foreach (MultiSelectListItem item in selectedIDs)
                            {
                                TBL_MP_Master_Employee emp = _UNIT.AppDBContext.TBL_MP_Master_Employee.Where(x => x.PK_EmployeeId == item.ID).FirstOrDefault();
                                if (emp != null)
                                {
                                    if (emp.EmailAddress.Trim() != string.Empty)
                                    {
                                        if (!txtMailTo.Text.Contains(emp.EmailAddress))
                                        {
                                            txtMailTo.Text += emp.EmailAddress + ";";
                                        }
                                    }
                                }
                            }
                            break;

                        case APP_ENTITIES.CONTACTS:
                            foreach (MultiSelectListItem item in selectedIDs)
                            {
                                Tbl_MP_Master_PartyContact_Detail contact = _UNIT.AppDBContext.Tbl_MP_Master_PartyContact_Detail.Where(x => x.PK_PartyContactDetails == item.ID).FirstOrDefault();
                                if (contact != null)
                                {
                                    if (contact.EmailID.Trim() != string.Empty)
                                    {
                                        if (!txtMailTo.Text.Contains(contact.EmailID))
                                        {
                                            txtMailTo.Text += contact.EmailID + ";";
                                        }
                                    }
                                }
                            }
                            break;

                        case APP_ENTITIES.PARTIES:
                            foreach (MultiSelectListItem item in selectedIDs)
                            {
                                Tbl_MP_Master_Party party = _UNIT.AppDBContext.Tbl_MP_Master_Party.Where(x => x.PK_PartyId == item.ID).FirstOrDefault();
                                if (party != null)
                                {
                                    if (party.EmailID.Trim() != string.Empty)
                                    {
                                        if (!txtMailTo.Text.Contains(party.EmailID))
                                        {
                                            txtMailTo.Text += party.EmailID + ";";
                                        }
                                    }
                                }
                            }
                            break;

                        case APP_ENTITIES.ASSOCIATES_AND_CONTACTS:
                            foreach (MultiSelectListItem item in selectedIDs)
                            {
                                switch (item.EntityType)
                                {
                                case APP_ENTITIES.EMPLOYEES:
                                    TBL_MP_Master_Employee emp = _UNIT.AppDBContext.TBL_MP_Master_Employee.Where(x => x.PK_EmployeeId == item.ID).FirstOrDefault();
                                    if (emp != null)
                                    {
                                        if (emp.EmailAddress.Trim() != string.Empty)
                                        {
                                            if (!txtMailTo.Text.Contains(emp.EmailAddress))
                                            {
                                                txtMailTo.Text += emp.EmailAddress + ";";
                                            }
                                        }
                                    }
                                    break;

                                case APP_ENTITIES.PARTIES:
                                    Tbl_MP_Master_Party party = _UNIT.AppDBContext.Tbl_MP_Master_Party.Where(x => x.PK_PartyId == item.ID).FirstOrDefault();
                                    if (party != null)
                                    {
                                        if (party.EmailID.Trim() != string.Empty)
                                        {
                                            if (!txtMailTo.Text.Contains(party.EmailID))
                                            {
                                                txtMailTo.Text += party.EmailID + ";";
                                            }
                                        }
                                    }
                                    break;

                                case APP_ENTITIES.CONTACTS:
                                    Tbl_MP_Master_PartyContact_Detail contact = _UNIT.AppDBContext.Tbl_MP_Master_PartyContact_Detail.Where(x => x.PK_PartyContactDetails == item.ID).FirstOrDefault();
                                    if (contact != null)
                                    {
                                        if (contact.EmailID.Trim() != string.Empty)
                                        {
                                            if (!txtMailTo.Text.Contains(contact.EmailID))
                                            {
                                                txtMailTo.Text += contact.EmailID + ";";
                                            }
                                        }
                                    }
                                    break;
                                }
                            }
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "frmSendMail::ReceipentSelectionLink_Clicked");
            }
        }
コード例 #13
0
        private void GeneratePartiesForSalesLead()
        {
            ServiceSalesLead _leadService    = new ServiceSalesLead();
            ServiceParties   _partyService   = new ServiceParties();
            ServiceContacts  _contactService = new ServiceContacts();

            List <TBL_MP_CRM_SM_SalesLead> dbLeads = _leadService.GetAllSalesLeadDBItems();

            if (dbLeads == null)
            {
                return;
            }
            progressBar1.Value   = 0;
            progressBar1.Minimum = 0; progressBar1.Maximum = dbLeads.Count;

            int progressVAl = 0;

            foreach (TBL_MP_CRM_SM_SalesLead lead in dbLeads)
            {
                lblTitle.Text = string.Format("{0} of {1}\n\n{2} {3}\n{4}", progressVAl + 1, progressBar1.Maximum, lead.LeadNo, lead.LeadDate.ToString("dd MMM yyyy"), lead.LeadName);

                Tbl_MP_Master_Party party = _partyService.GetPartyByPartyName(lead.LeadName);
                if (party != null)
                {
                    lead.FK_PartyID = party.PK_PartyId;
                    _leadService.UpdateSalesLeadMasterInfo(lead);
                    lblTitle.Text += string.Format("\nExisting Party found. Customer update in SalesLead PartyID:{0}", lead.FK_PartyID);
                }
                else
                {
                    party = new Tbl_MP_Master_Party()
                    {
                        PartyType       = "C",
                        FK_PartyType    = 2,
                        PartyName       = lead.LeadName,
                        FK_IndustryType = 8003,
                        EmailID         = lead.LeadEmailID,
                        Website         = lead.LeadWebsite,
                        IsActive        = true
                    };

                    int partyID = _partyService.AddNewParty(party);
                    Tbl_MP_Master_PartyContact_Detail contact = new Tbl_MP_Master_PartyContact_Detail()
                    {
                        FK_PartyID         = partyID,
                        ContactPersoneName = lead.ContactPersone,
                        Address            = lead.LeadAddress,
                        EmailID            = lead.LeadEmailID,
                        TelephoneNo        = lead.LeadPhoneNo,
                        MobileNo           = lead.LeadMobileNo,
                        FaxNo    = lead.LeadFAXNo,
                        IsActive = true,
                    };
                    _contactService.AddNewContact(contact);
                    lblTitle.Text += "\n\nNew Party & Contact created.";
                }
                progressVAl++;
                progressBar1.Value = progressVAl;
                Application.DoEvents();
            }
        }
コード例 #14
0
        private void ScatterData()
        {
            if (this.SalesQuotationID == 0)
            {
                return;
            }
            try
            {
                string strMessage = string.Empty;
                TBL_MP_CRM_SalesQuotation model = (new ServiceSalesQuotation()).GetSalesQuotationMasterDBInfo(this.SalesQuotationID);
                if (model != null)
                {
                    this.Text = "SALES QUOTATION (EDIT)";
                    txtQuotationNumber.Text     = model.Quotation_No;
                    txtQuotationNumber.ReadOnly = true;
                    dtQuotationDate.Value       = model.Quotation_Date;
                    txtQuotationValidDays.Text  = model.Quotation_ValidDays.ToString();
                    txtQuotationExpiryDate.Text = string.Format("{0}", model.Quotation_Date.AddDays(model.Quotation_ValidDays).ToString("dd MMM yyyy"));

                    cboQuotationStatus.SelectedItem     = ((List <SelectListItem>)cboQuotationStatus.DataSource).Where(x => x.ID == model.FK_Userlist_Quotation_Status_ID).FirstOrDefault();
                    cboQuotationPriority.SelectedItem   = ((List <SelectListItem>)cboQuotationPriority.DataSource).Where(x => x.ID == model.FK_Userlist_Priority_ID).FirstOrDefault();
                    cboSalesRepresentative.SelectedItem = ((List <SelectListItem>)cboSalesRepresentative.DataSource).Where(x => x.ID == model.FK_RepresentativeID).FirstOrDefault();
                    cboQuotationStatus.SelectNextControl(dtQuotationDate, true, false, false, true);
                    if (cboSalesRepresentative.SelectedItem == null)
                    {
                        string empName = ServiceEmployee.GetEmployeeNameByID(model.FK_RepresentativeID);
                        strMessage += string.Format("\nUnable to locate Employee {0} in active Employees list.", empName);
                        List <SelectListItem> lstemployees = (new ServiceEmployee()).GetAllActiveEmployees();
                        SelectListItem        newRep       = new SelectListItem()
                        {
                            ID = model.FK_RepresentativeID, Description = empName
                        };
                        lstemployees.Add(newRep);
                        cboSalesRepresentative.DataSource   = lstemployees;
                        cboSalesRepresentative.SelectedItem = newRep;
                    }
                    //BOQ REPRESENTATIVE
                    if (model.FK_BOQRepresentativeID > 0)
                    {
                        cboBOQRepresentative.SelectedItem = ((List <SelectListItem>)cboBOQRepresentative.DataSource).Where(x => x.ID == model.FK_BOQRepresentativeID).FirstOrDefault();
                    }

                    this.SelectedSalesEnquiryID = model.FK_Sales_Enquiry_ID;
                    PopulateSelectedSalesEnquiryInfo();
                    TBL_MP_CRM_SalesEnquiry objEnquiry = model.TBL_MP_CRM_SalesEnquiry;
                    if (objEnquiry != null)
                    {
                        txtEnquiryNumber.Text         = string.Format("{0} dt. {1}", objEnquiry.SalesEnquiry_No, objEnquiry.SalesEnquiry_Date.ToString("dd MMM yyyy"));
                        txtProjectName.Text           = objEnquiry.Project_Name;
                        cboProjectSector.SelectedItem = ((List <SelectListItem>)cboProjectSector.DataSource).Where(x => x.ID == model.FK_Userlist_ProjectSector_ID).FirstOrDefault();
                        PopulateCitiesDropdown((int)objEnquiry.FK_Project_State_ID);
                        cboProjectLocation.SelectedItem = ((List <SelectListItem>)cboProjectLocation.DataSource).Where(x => x.ID == model.FK_Project_City_ID).FirstOrDefault();
                    }
                    Tbl_MP_Master_Party party = model.Tbl_MP_Master_Party;
                    if (party != null)
                    {
                        cboClient.SelectedItem = ((List <SelectListItem>)cboClient.DataSource).Where(x => x.ID == model.FK_Customer_ID).FirstOrDefault();
                        if (cboClient.SelectedItem == null)
                        {
                            strMessage += string.Format("\nUnable to locate Customer {0} in active Customers list.", party.PartyName);
                        }
                    }

                    txtRemarks.Text = model.Remarks;
                    if (model.FK_Userlist_Quotation_Status_ID == this.STATUS_CLOSED_ID || model.FK_Userlist_Quotation_Status_ID == this.STATUS_LOST_ID)
                    {
                        txtReasonClosedLost.Text            = model.ReasonClose.ToString();
                        tabPageQuotationCloseReason.Visible = true;
                    }
                    else
                    {
                        tabPageQuotationCloseReason.Visible = false;
                    }

                    tabRemarks.SelectedPage = tabPageQuotationRemarks;

                    if (strMessage != string.Empty)
                    {
                        MessageBox.Show(strMessage);
                    }
                    dtQuotationDate.Focus();
                    Application.DoEvents();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmSalesQuotation::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }