Пример #1
0
        public void GatherData()
        {
            model = new Tbl_MP_Master_PartyContact_Detail();
            if (this.ContactID > 0)
            {
                model = _contactService.GetContactByContactID(this.ContactID);
            }

            model.ContactPersoneName = txtContactName.Text.Trim();
            model.Address            = txtAddress.Text;
            model.TelephoneNo        = txtPhoneNo.Text;
            model.AltTelephoneNo     = txtPhoneNoAlternate.Text;
            model.MobileNo           = txtMobileNo.Text;
            model.AltMobileNo        = txtMobileNoAlternate.Text;
            model.FaxNo = txtFAXNo.Text;

            model.EmailID = txtEmail.Text;
            if (cboDepartments.SelectedItem != null)
            {
                model.FK_Department      = ((SelectListItem)cboDepartments.SelectedItem).ID;
                model.FK_Department_Text = ((SelectListItem)cboDepartments.SelectedItem).Description;
            }
            if (cboDesignations.SelectedItem != null)
            {
                model.FK_Designation      = ((SelectListItem)cboDesignations.SelectedItem).ID;
                model.FK_Designation_Text = ((SelectListItem)cboDesignations.SelectedItem).Description;
            }
        }
Пример #2
0
        public void ScatterData()
        {
            model = _contactService.GetContactByContactID(this.ContactID);
            if (model != null)
            {
                txtContactName.Text       = model.ContactPersoneName;
                txtAddress.Text           = model.Address;
                txtPhoneNo.Text           = model.TelephoneNo;
                txtPhoneNoAlternate.Text  = model.AltTelephoneNo;
                txtMobileNo.Text          = model.MobileNo;
                txtMobileNoAlternate.Text = model.AltMobileNo;
                txtFAXNo.Text             = model.FaxNo;
                txtEmail.Text             = model.EmailID;

                if (model.FK_Department != null)
                {
                    SelectListItem item = ((List <SelectListItem>)cboDepartments.DataSource).Where(x => x.ID == model.FK_Department).FirstOrDefault();
                    if (item != null)
                    {
                        cboDepartments.SelectedItem = item;
                    }
                }
                if (model.FK_Designation != null)
                {
                    SelectListItem item = ((List <SelectListItem>)cboDesignations.DataSource).Where(x => x.ID == model.FK_Designation).FirstOrDefault();
                    if (item != null)
                    {
                        cboDesignations.SelectedItem = item;
                    }
                }
            }
        }
Пример #3
0
        public int UpdateContact(Tbl_MP_Master_PartyContact_Detail model)
        {
            try
            {
                _dbContext.SaveChanges();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceContacts::UpdateContact", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(model.PK_PartyContactDetails);
        }
Пример #4
0
        public bool UndeleteContact(int ContID, string reason)
        {
            bool result = false;

            try
            {
                Tbl_MP_Master_PartyContact_Detail editCont = _dbContext.Tbl_MP_Master_PartyContact_Detail.Where(x => x.PK_PartyContactDetails == ContID).FirstOrDefault();
                editCont.DeleteDateTime = null;
                editCont.DeletedBy      = null;
                editCont.IsActive       = true;
                editCont.DeleteRemarks  = reason;
                _dbContext.SaveChanges();
                result = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("{0}\n{1}", ex.Message, ex.InnerException.Message), "ServiceContacts::UndeleteContact", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
Пример #5
0
        public bool DeletePartyContact(int partyConID, int deletedBy)
        {
            bool result = false;

            try
            {
                Tbl_MP_Master_PartyContact_Detail dbPartyCon = _dbContext.Tbl_MP_Master_PartyContact_Detail.Where(x => x.PK_PartyContactDetails == partyConID).FirstOrDefault();
                dbPartyCon.DeleteDateTime = AppCommon.GetServerDateTime();
                dbPartyCon.DeletedBy      = deletedBy;
                dbPartyCon.IsActive       = false;
                //dbPartyCon.DeleteRemarks = reason;
                _dbContext.SaveChanges();
                result = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("{0}\n{1}", ex.Message, ex.InnerException.Message), "ServiceContacts::DeletePartyContact", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
Пример #6
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);
            }
        }
Пример #7
0
        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");
            }
        }
Пример #8
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();
            }
        }