コード例 #1
0
 public pageSalesLead()
 {
     try
     {
         _UNIT = new ServiceUOW();
         InitializeComponent();
         Cursor   = Cursors.WaitCursor;
         _service = new ServiceSalesLead();
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "pageSalesLead::pageSalesLead", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
 public ControlSalesLeadGeneralDetails()
 {
     _service = new ServiceSalesLead();
     InitializeComponent();
 }
コード例 #3
0
 public ControlSalesLeadGeneralDetails(ServiceSalesLead service)
 {
     InitializeComponent();
     _service = service;
 }
コード例 #4
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();
            }
        }