Exemplo n.º 1
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            QCTLinqDataContext db = new QCTLinqDataContext();
            Contractor         c  = new Contractor
            {
                Company        = txtCompany.Text,
                VendorNumber   = txtVendorNumber.Text,
                ContactName    = txtContactName.Text,
                MailingAddress = txtMailAddress.Text,
                Town           = txtTown.Text,
                PostalCode     = txtPostalCode.Text,
                Email          = txtEmail.Text,
                NCContact      = txtNCContact.Text,
                ExemptFromAuto = false
            };

            db.Contractors.InsertOnSubmit(c);
            db.SubmitChanges();
            int ID = c.ID;

            WSIB w = new WSIB
            {
                cID = ID
            };

            db.WSIBs.InsertOnSubmit(w);
            db.SubmitChanges();

            Response.Redirect("~/EditContractor.aspx?ID=" + ID);
        }
Exemplo n.º 2
0
        protected void btnSaveWSIB_Click(object sender, EventArgs e)
        {
            int  cID              = Int32.Parse(Request.QueryString["ID"]);
            bool newWSIB          = false;
            QCTLinqDataContext db = new QCTLinqDataContext();
            WSIB w = (from a in db.WSIBs
                      where a.cID == cID
                      select a).SingleOrDefault();

            if (w == null)
            {
                w       = new WSIB();
                w.cID   = cID;
                newWSIB = true;
            }

            w.WSIBCoverage            = ddWSIBCoverage.SelectedIndex > 0 ? int.Parse(ddWSIBCoverage.SelectedValue) : (int?)null;
            w.WSIBCertRecd            = ddCertRecd.Value;
            w.IndOpLetterRecd         = ddIndOpLetter.Value;
            w.IndOpIDNum              = txtIDNum.Text;
            w.WSIBExemptFormRecd      = ddWSIBExempt.Value;
            w.AODAFormSubmit          = ddAODASubmitted.Value;
            w.AODAStandardsCompliance = ddAODAStandardsCompliance.Value;
            w.NCHSPolicyReqd          = ddNCHSReqd.Value;
            w.NCHSPolicyRecd          = ddNCHSReceived.Value;
            w.MoL100Recd              = ddMoL100.SelectedValue;
            w.HSPolicy = ddContHS.SelectedValue;

            if (newWSIB)
            {
                db.WSIBs.InsertOnSubmit(w);
            }

            db.SubmitChanges();

            notWSIB.Type    = "success";
            notWSIB.Message = "Changes have been saved!";
            notWSIB.Visible = true;
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Functions.SecurePage();
                int cID;
                if (!String.IsNullOrEmpty(Request.QueryString["ID"]) && int.TryParse(Request.QueryString["ID"].ToString(), out cID))
                {
                    // populate links in various tabs
                    lnkNewInsurance.NavigateUrl = "~/InsurancePolicies/New.aspx?cID=" + cID;
                    lnkNewAgreemnt.NavigateUrl  = "~/Agreements.aspx?cID=" + cID + "&mode=add";
                    lnkNewPermit.NavigateUrl    = "~/Permits.aspx?cID=" + cID + "&mode=add";
                    lnkNewLicence.NavigateUrl   = "~/Licences.aspx?cID=" + cID + "&mode=add";
                    btnCancel.NavURL            = "~/ViewContractor.aspx?ID=" + cID;

                    ddPhoneType.DataSource     = Contractors.GetPhoneTypes();
                    ddPhoneType.DataTextField  = "Value";
                    ddPhoneType.DataValueField = "ID";
                    ddPhoneType.DataBind();

                    rptInsurance.DataSource = Contractors.GetInsurance(cID);
                    rptInsurance.DataBind();

                    rptAgreements.DataSource = Contractors.GetAgreements(cID);
                    rptAgreements.DataBind();

                    rptPermits.DataSource = Contractors.GetPermits(cID);
                    rptPermits.DataBind();

                    rptLicenses.DataSource = Contractors.GetLicenses(cID);
                    rptLicenses.DataBind();

                    ddWSIBCoverage.DataSource     = Contractors.GetWSIBTypes();
                    ddWSIBCoverage.DataTextField  = "Value";
                    ddWSIBCoverage.DataValueField = "ID";
                    ddWSIBCoverage.DataBind();

                    rptJobs.DataSource = Contractors.GetJobs(cID);
                    rptJobs.DataBind();

                    WSIB w = Contractors.GetWSIB(cID);

                    if (w != null)
                    {
                        ddWSIBCoverage.SelectedValue = w.WSIBCoverage.HasValue ? w.WSIBCoverage.ToString() : String.Empty;
                        if (ddWSIBCoverage.SelectedValue.Equals("1"))
                        {
                            phClearance.Visible = true;
                        }
                        else if (ddWSIBCoverage.SelectedValue.Equals("2"))
                        {
                            phIndOp.Visible = true;
                        }
                        else if (ddWSIBCoverage.SelectedValue.Equals("3"))
                        {
                            phWSIBExempt.Visible = true;
                        }
                        ddCertRecd.Value                = w.WSIBCertRecd;
                        ddIndOpLetter.Value             = w.IndOpLetterRecd;
                        txtIDNum.Text                   = w.IndOpIDNum;
                        ddWSIBExempt.Value              = w.WSIBExemptFormRecd;
                        ddAODASubmitted.Value           = w.AODAFormSubmit;
                        ddAODAStandardsCompliance.Value = w.AODAStandardsCompliance;
                        ddNCHSReqd.Value                = w.NCHSPolicyReqd;
                        phNCHSPolicyRecd.Visible        = ddNCHSReqd.Value == null ? false : (bool)ddNCHSReqd.Value;
                        ddNCHSReceived.Value            = w.NCHSPolicyRecd;
                        ddMoL100.SelectedValue          = w.MoL100Recd;
                        ddContHS.SelectedValue          = w.HSPolicy;
                    }

                    Contractor c = Contractors.GetContractor(cID);
                    CompanyTextBox.Text              = c.Company;
                    ltSubTitle.Text                  = "Editing " + c.Company;
                    VendorNumberTextBox.Text         = c.VendorNumber;
                    ContactNameTextBox.Text          = c.ContactName;
                    MailingAddressTextBox.Text       = c.MailingAddress;
                    TownTextBox.Text                 = c.Town;
                    PostalCodeTextBox.Text           = c.PostalCode;
                    EmailTextBox.Text                = c.Email;
                    txtNCContact.Text                = c.NCContact;
                    ddExemptFromAuto.Value           = c.ExemptFromAuto;
                    phExemptFromAutoComments.Visible = c.ExemptFromAuto == true;
                    txtExemptFromAutoComments.Text   = c.ExemptFromAutoComments;
                    txtContratorNotes.Text           = c.Notes;

                    rptPhones.DataSource = Contractors.GetPhoneNumbers(cID);
                    rptPhones.DataBind();

                    // if there are any status messages to display... display them!
                    if (Request.QueryString["msg"] != null)
                    {
                        switch (Request.QueryString["msg"])
                        {
                        case "insadded":
                            notInsurance.Type    = "success";
                            notInsurance.Message = "Insurance Policy added!";
                            notInsurance.Visible = true;
                            break;

                        case "insedited":
                            notInsurance.Type    = "success";
                            notInsurance.Message = "Insurance Policy updated!";
                            notInsurance.Visible = true;
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int ID = int.Parse(Request.QueryString["ID"]);

                if (Functions.CanEdit())
                {
                    btnEdit.NavURL = "~/EditContractor.aspx?ID=" + ID;
                }
                else
                {
                    btnEdit.Visible = false;
                }

                QCTLinqDataContext db = new QCTLinqDataContext();

                Contractor c = db.Contractors.Single(i => i.ID == ID);
                ltVendorNumber.Text       = c.VendorNumber;
                ltCompany.Text            = c.Company;
                ltContactName.Text        = c.ContactName;
                ltMailingAddress.Text     = c.MailingAddress;
                ltTown.Text               = c.Town;
                ltPostalCode.Text         = c.PostalCode;
                lnkEmail.NavigateUrl      = "mailto:" + c.Email;
                lnkEmail.Text             = c.Email;
                ltNCContact.Text          = c.NCContact;
                notExemptFromAuto.Visible = c.ExemptFromAuto == true ? true : false;
                notExemptFromAuto.Message = c.ExemptFromAuto == true ? "This contractor is exempt from auto insurance: " + c.ExemptFromAutoComments : String.Empty;
                lblContractorNotes.Text   = (c.Notes == null || c.Notes.Equals(String.Empty)) ? "No notes for this contractor." : c.Notes;

                rptPhones.DataSource = Contractors.GetPhoneNumbers(ID);
                rptPhones.DataBind();

                rptInsurance.DataSource = Contractors.GetInsurance(ID);
                rptInsurance.DataBind();

                rptAgreements.DataSource = Contractors.GetAgreements(ID);
                rptAgreements.DataBind();

                rptPermits.DataSource = Contractors.GetPermits(ID);
                rptPermits.DataBind();

                rptLicenses.DataSource = Contractors.GetLicenses(ID);
                rptLicenses.DataBind();

                rptJobs.DataSource = Contractors.GetJobs(ID);
                rptJobs.DataBind();

                WSIB w = Contractors.GetWSIB(ID);

                if (w != null)
                {
                    ltWSIBCoverage.Text = w.WSIBCoverage.HasValue ? w.TypeOfWSIB.Value : "---";
                    if (ltWSIBCoverage.Text.Equals("WSIB Clearance Certificate"))
                    {
                        phClearance.Visible = true;
                    }
                    else if (ltWSIBCoverage.Text.Equals("Independant Operator Letter"))
                    {
                        phIndOp.Visible = true;
                    }
                    else if (ltWSIBCoverage.Text.Equals("WSIB Exemption"))
                    {
                        phWSIBExempt.Visible = true;
                    }
                    ltlWSIBCert.Text     = w.WSIBCertRecd.ToYesNoString();
                    ltIndOp.Text         = w.IndOpLetterRecd.ToYesNoString();
                    ltIDNum.Text         = w.IndOpIDNum;
                    ltExemptionRecd.Text = w.WSIBExemptFormRecd.ToYesNoString();
                    ltCompSub.Text       = w.AODAFormSubmit.ToYesNoString();
                    ltAODAStandards.Text = w.AODAStandardsCompliance.ToYesNoString();
                    ltNCHSReqd.Text      = w.NCHSPolicyReqd.ToYesNoString();
                    phNCHS.Visible       = w.NCHSPolicyReqd == null ? false : w.NCHSPolicyReqd.Value;
                    ltNCHSRecd.Text      = w.NCHSPolicyRecd.ToYesNoString();
                    ltMoL100Recd.Text    = (w.MoL100Recd == null || w.MoL100Recd.Equals(String.Empty)) ? "---" : w.MoL100Recd;
                    ltConHS.Text         = (w.HSPolicy == null || w.HSPolicy.Equals(String.Empty)) ? "---" : w.HSPolicy;
                }
            }
        }