private void PopulateOpportunityStatuses()
        {
            //current status
            bizActivity bizA = new bizActivity();
            Status      ins  = bizA.GetInitialStatus();

            this.ucMessanger1.ProcessMessages(bizA.MSGS, true);
            this.lblOpportunityStatus.Text = ins.StatusName;

            //next status
            List <Status> ns = bizA.GetNextStatuses(ins.StatusID);

            this.lblNextActivity.Text = "";
            foreach (Status s in ns)
            {
                this.lblNextActivity.Text += s.StatusName + ",";
            }
            char[] charsToTrim = { ',' };
            this.lblNextActivity.Text = this.lblNextActivity.Text.TrimEnd(charsToTrim);
        }
Exemplo n.º 2
0
        private void Insert()
        {
            Client    c   = new Client();
            bizClient biz = new bizClient();

            //CLIENT//
            //general
            c.Inactive = false;
            bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"];
            c.AccountExecutiveID = user.UserName;
            c.ClientCode         = this.txtClientCode.Text;
            c.ClientName         = this.txtClientName.Text;
            c.RegisteredName     = this.txtRegisteredName.Text;
            //c.InsuredName = this.txtInsuredName.Text;
            if (this.txtABNACN.Text != "")
            {
                c.ABNACN = this.txtABNACN.Text;
            }
            c.Source           = this.txtSource.Text;
            c.OfficeFacsimilie = this.txtOfficeFacsimilie.Text;
            c.OfficePhone      = this.txtOfficePhone.Text;
            //address
            if (this.txtAddress.Text != "")
            {
                c.Address = this.txtAddress.Text;
            }
            if (this.rblAddressTypes.SelectedIndex == 0)
            {
                if (this.ucAUPSS1.PostCode != "")
                {
                    c.PostCode = this.ucAUPSS1.PostCode;
                }
                if (this.ucAUPSS1.StateCode != "")
                {
                    c.StateCode = this.ucAUPSS1.StateCode;
                }
                if (this.ucAUPSS1.Suburb != "")
                {
                    c.Location = this.ucAUPSS1.Suburb;
                }
            }
            //industry
            if (this.lstIndustry.SelectedValue != "")
            {
                c.AnzsicCode = this.lstIndustry.SelectedValue;
            }
            if (this.ddlAssociation.SelectedValue != "")
            {
                c.AssociationCode = this.ddlAssociation.SelectedValue;
            }
            c.AssociationMemberNumber = this.txtAssociationMemberNumber.Text;
            //audit
            c.AddedBy = bizUser.GetCurrentUserName();
            c.Added   = DateTime.Now;

            //CONTACT//
            Contact    cl   = new Contact();
            bizContact bizC = new bizContact();

            if (this.ckbAddContact.Checked == true)
            {
                //general
                cl.ContactName = this.txtContactName.Text;
                cl.Title       = this.ddlTitle.SelectedValue;
                cl.Mobile      = this.txtMobile.Text;
                cl.DirectLine  = this.txtDirectLine.Text;
                cl.Email       = this.txtEmail.Text;
                //audit
                cl.AddedBy = bizUser.GetCurrentUserName();
                cl.Added   = DateTime.Now;
            }

            //OPPORTUNITY//
            Opportunity    o    = new Opportunity();
            bizOpportunity bizO = new bizOpportunity();

            //general
            o.OpportunityName = this.txtOpportunityName.Text;
            if (this.txtOpportunityDue.Text != "")
            {
                o.OpportunityDue = DateTime.Parse(this.txtOpportunityDue.Text);
            }
            o.IncumbentBroker  = this.txtIncumbentBroker.Text;
            o.IncumbentInsurer = this.txtIncumbentInsurer.Text;
            if (this.ddlClassification.SelectedValue != "")
            {
                o.ClassificationID = int.Parse(this.ddlClassification.SelectedValue);
            }
            if (this.ddlBusinessType.SelectedValue != "")
            {
                o.BusinessTypeID = int.Parse(this.ddlBusinessType.SelectedValue);
            }
            if (this.ddlFlagged.SelectedValue != "")
            {
                o.Flagged = bool.Parse(this.ddlFlagged.SelectedValue);
            }
            //audit
            o.AddedBy = bizUser.GetCurrentUserName();
            o.Added   = DateTime.Now;

            //ACTIVITY//
            Activity    na   = new Activity();
            bizActivity bizA = new bizActivity();

            //general
            na.OpportunityStatusID = bizA.GetInitialStatus().StatusID;
            if (this.txtFollowUpDate.Text != "")
            {
                na.FollowUpDate = DateTime.Parse(this.txtFollowUpDate.Text);
            }
            na.Inactive     = false;
            na.ActivityNote = "";
            //audit
            na.AddedBy = bizUser.GetCurrentUserName();
            na.Added   = DateTime.Now;

            //action
            if (biz.ValidateClient(c) == false)
            {
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                return;
            }
            if (this.ckbAddContact.Checked == true)
            {
                if (bizC.ValidateContact(cl) == false)
                {
                    this.ucMessanger1.ProcessMessages(bizC.MSGS, true);
                    return;
                }
                c.Contacts.Add(cl);
            }
            if (bizO.ValidateOpportunity(o) == false)
            {
                this.ucMessanger1.ProcessMessages(bizO.MSGS, true);
                return;
            }
            c.Opportunities.Add(o);
            if (bizA.ValidateActivity(na, true) == false)
            {
                this.ucMessanger1.ProcessMessages(bizA.MSGS, true);
                return;
            }
            o.Activities.Add(na);
            int oid = biz.InsertClient(c);

            if (oid != 0)
            {
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                Response.Redirect("ViewClient.aspx?cid=" + oid.ToString(), false);
            }
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);
        }
        private void Insert()
        {
            Opportunity    o   = new Opportunity();
            bizOpportunity biz = new bizOpportunity();

            //general opportunity
            o.ClientID        = int.Parse(Request.QueryString["cid"]);
            o.Inactive        = false;
            o.Flagged         = false;
            o.OpportunityName = this.txtOpportunityName.Text;
            if (this.txtOpportunityDue.Text != "")
            {
                o.OpportunityDue = DateTime.Parse(this.txtOpportunityDue.Text);
            }
            o.IncumbentBroker  = this.txtIncumbentBroker.Text;
            o.IncumbentInsurer = this.txtIncumbentInsurer.Text;
            if (this.ddlClassification.SelectedValue != "")
            {
                o.ClassificationID = int.Parse(this.ddlClassification.SelectedValue);
            }
            if (this.ddlBusinessType.SelectedValue != "")
            {
                o.BusinessTypeID = int.Parse(this.ddlBusinessType.SelectedValue);
            }
            if (this.ddlContact.SelectedValue != "")
            {
                o.ContactID = int.Parse(this.ddlContact.SelectedValue);
            }
            //audit
            o.AddedBy = bizUser.GetCurrentUserName();
            o.Added   = DateTime.Now;

            //general activity
            Activity    na   = new Activity();
            bizActivity bizA = new bizActivity();

            na.OpportunityStatusID = bizA.GetInitialStatus().StatusID;
            if (this.txtFollowUpDate.Text != "")
            {
                na.FollowUpDate = DateTime.Parse(this.txtFollowUpDate.Text);
            }
            na.Inactive     = false;
            na.ActivityNote = "";
            //audit
            na.AddedBy = bizUser.GetCurrentUserName();
            na.Added   = DateTime.Now;

            //action
            if (biz.ValidateOpportunity(o) == false)
            {
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);
                return;
            }
            o.Activities.Add(na);
            int oid = biz.InsertOpportunity(o);

            if (oid != 0)
            {
                Response.Redirect("ViewClient.aspx?cid=" + Request.QueryString["cid"], false);
            }
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);
        }
Exemplo n.º 4
0
        private void PopulateActivityDetails()
        {
            bizMessage  bizM = new bizMessage();
            bizSetting  bizS = new bizSetting();
            bizActivity biz  = new bizActivity();

            Activity a;

            a = biz.GetActivity(Convert.ToInt32(Request.QueryString["aid"]));
            this.ucMessanger1.ProcessMessages(biz.MSGS, true);

            if (a == null)
            {
                return;
            }

            this.lblActivityStatus.Text = a.Status.StatusName;
            this.lblActivityNote.Text   = a.ActivityNote.Replace("\n", "<br />");
            this.lblFollowUpDate.Text   = string.Format("{0:dd-MMM-yy}", a.FollowUpDate);
            if (a.ContactID.HasValue == true)
            {
                this.lblContact.Text = a.Contact.ContactName;
            }

            ((Main)Master).HeaderDetails = "Activity added by "
                                           + bizActiveDirectory.GetUserFullName(a.AddedBy)
                                           + " (" + string.Format("{0:dd-MMM-yy}", a.Added) + ")";

            if (a.Modified.HasValue == true)
            {
                ((Main)Master).HeaderDetails += " / modified by "
                                                + bizActiveDirectory.GetUserFullName(a.ModifiedBy)
                                                + " (" + string.Format("{0:dd-MMM-yy}", a.Modified.Value) + ")";
            }

            //inactive
            if (a.Inactive == true)
            {
                this.tblActivity.Disabled    = true;
                this.btnInactivate.Visible   = false;
                this.btnSendEmail.Visible    = false;
                this.btnAddActivity.Visible  = false;
                this.btnEditActivity.Visible = false;
            }
            else
            {
                if (biz.GetInitialStatus().StatusID == a.OpportunityStatusID)
                {
                    this.btnInactivate.Visible = false;
                }

                if (this.lblOpportunityStatus.Text != this.lblActivityStatus.Text)
                {
                    this.btnInactivate.Visible = false;
                }

                this.btnSendEmail.Visible = a.ContactID.HasValue;
                if (a.ContactID.HasValue == true)
                {
                    if (a.Contact.Email != "")
                    {
                        this.btnSendEmail.OnClientClick = "javascript:location.href='mailto:" + a.Contact.Email + "'";
                    }
                }
            }
        }