/// <summary> /// Saving a new insurance company /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmitNewIns_Click(object sender, EventArgs e) { if (txtNewInsuranceCompanyName.Text.Length > 0) { // build and populate the insurance company... QCTLinqDataContext db = new QCTLinqDataContext(); InsuranceCompany ins = new InsuranceCompany { Name = txtNewInsuranceCompanyName.Text, Email = txtNewInsComEmail.Text, Active = true }; // save the changes db.InsuranceCompanies.InsertOnSubmit(ins); db.SubmitChanges(); // now that the new insurance comapny is in the db, let's re-populate the dropdown... PopulateInsuranceCompanies(); // ... and automatically select it! ddInsuranceCompanies.SelectedValue = ins.ID.ToString(); // let's populate the associated email as well. txtInsEmail.Text = ins.Email; // let's clear the fields we used to create the new insurance policy txtNewInsuranceCompanyName.Text = txtNewInsComEmail.Text = String.Empty; } }
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); }
protected void btnSubmit_Click(object sender, EventArgs e) { int cID = int.Parse(Request.QueryString["cID"]); int ID = int.Parse(Request.QueryString["ID"]); string mode = Request.QueryString["mode"]; QCTLinqDataContext db = new QCTLinqDataContext(); Permit p = new Permit(); if (mode.Equals("edit")) { p = db.Permits.Single(permit => permit.ID == ID); } else { p.cID = cID; } p.TypeOfPermit = ddTypeOfPermit.SelectedIndex > 0 ? int.Parse(ddTypeOfPermit.SelectedValue) : (int?)null; p.CGLIns = ddCGL.Value; p.AutoIns = ddAutoInsurance.Value; p.TypeOfSecurity = ddTypeOfSecurity.SelectedIndex > 0 ? int.Parse(ddTypeOfSecurity.SelectedValue) : (int?)null; p.ExpDate = dddExpiryDate.Date; if (!mode.Equals("edit")) { db.Permits.InsertOnSubmit(p); } db.SubmitChanges(); notAgreement.Message = "Permit saved!"; notAgreement.Type = "success"; notAgreement.Visible = true; Functions.ScrollToTop(Page); }
public static void EditPolicy(int ID, InsurancePolicyEditor p) { QCTLinqDataContext db = new QCTLinqDataContext(); // create and populate! InsurancePolicy ins = db.InsurancePolicies.Single(i => i.ID == ID); ins.TenantsLegalLiability = p.TenantsLiability; ins.CertReqFor = p.CertificateRequestFor; ins.TypeOfPolicy = p.TypeOfPolicy; ins.PerOccurance = p.PerOccurance; ins.ProductsCompletedOps = p.ProductsCompletedOps; ins.NonOwnedAuto = p.NonOwnedAuto; ins.CrossLiability = p.CrossLiability; ins.NCasAddIns = p.NorfolkCountyAsAdditionallyInsured; ins.PolicyNumber = p.PolicyNumber; ins.PolicyLimit = p.PolicyLimit; ins.PolicyLimitOther = p.PolicyLimitOther; ins.ExpiryDate = p.ExpiryDate; ins.insID = p.InsuranceCompany; ins.BrokerID = p.Broker; ins.BrokerEmailID = p.BrokerEmail; ins.CertSigned = p.CertificateSigned; ins.Active = p.Active; // save to database! db.SubmitChanges(); // let's look at the uploaded file if (p.Files.Count > 0) // see if there's a file to attach... { UploadInsuranceDocument(ins.ID, p.Files); } }
// protected void btnSubmit_Click(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); int cID = Int32.Parse(Request.QueryString["cID"]); string mode = Request.QueryString["mode"]; QCTLinqDataContext db = new QCTLinqDataContext(); Licence l = new Licence(); if (mode.Equals("edit")) { l = db.Licences.Single(li => li.ID == ID); } else { l.cID = cID; } l.TypeOfLicence = txtTypeOfLicense.Text; l.CopyReceived = ddCopyReceived.Value; l.LicFiledWith = txtFiledWith.Text; l.Dept = ddDivision.DivisionID; if (!mode.Equals("edit")) { db.Licences.InsertOnSubmit(l); } db.SubmitChanges(); notNotification.Type = "success"; notNotification.Message = "Permit saved!"; notNotification.Visible = true; Functions.ScrollToTop(Page); }
public static List <Licence> GetLicenses(int cID) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from l in db.Licences where l.cID == cID select l; return(q.ToList()); }
public static List <Permit> GetPermits(int cID) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from p in db.Permits where p.cID == cID select p; return(q.ToList()); }
/// <summary> /// Saves the changes to a modified broker email /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEditBrokerEmail_Click(object sender, EventArgs e) { QCTLinqDataContext db = new QCTLinqDataContext(); InsuranceBrokerEmail email = db.InsuranceBrokerEmails.Single(u => u.ID == int.Parse(ddBrokerEmail.SelectedValue)); email.Email = txtNewBrokerEmail.Text; db.SubmitChanges(); PopulateBrokerEmails(email.bID); ddBrokerEmail.SelectedValue = email.ID.ToString(); }
protected void btnEditBroker_Click(object sender, EventArgs e) { QCTLinqDataContext db = new QCTLinqDataContext(); int ID = int.Parse(ddBroker.SelectedValue); InsuranceBroker b = db.InsuranceBrokers.Single(a => a.ID == ID); b.Name = txtNewBroker.Text; db.SubmitChanges(); ddBroker.SelectedItem.Text = b.Name; }
protected void btnSaveAutoExemption_Click(object sender, EventArgs e) { QCTLinqDataContext db = new QCTLinqDataContext(); int cID = int.Parse(Request.QueryString["ID"]); Contractor c = db.Contractors.Single(u => u.ID == cID); c.ExemptFromAuto = ddExemptFromAuto.Value; c.ExemptFromAutoComments = txtExemptFromAutoComments.Text; db.SubmitChanges(); notSaveExemption.Visible = true; }
protected void btnSaveNotes_Click(object sender, EventArgs e) { lblNotesSaved.Visible = false; int cID = Int32.Parse(Request.QueryString["ID"]); QCTLinqDataContext db = new QCTLinqDataContext(); Contractor c = db.Contractors.Single(u => u.ID == cID); c.Notes = txtContratorNotes.Text; db.SubmitChanges(); lblNotesSaved.Visible = true; }
/// <summary> /// Adds an insurance broker /// </summary> /// <param name="name">Name of the insurance broker</param> public static void AddInsuranceBroker(string name) { QCTLinqDataContext db = new QCTLinqDataContext(); InsuranceBroker b = new InsuranceBroker { Name = name, Active = true }; db.InsuranceBrokers.InsertOnSubmit(b); db.SubmitChanges(); }
public static List <AgreementDetails> GetAgreements(int cID) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from a in db.Agreements where a.cID == cID select new AgreementDetails() { Agreement = a, TypeOfAgreement = a.TypeOfAgreement1.Value }; return(q.ToList()); }
/// <summary> /// Adds an email address associated with an insurance broker /// </summary> /// <param name="email">Email address of the broker</param> /// <param name="bID">ID of the related broker</param> public static void AddInsuranceBrokerEmail(string email, int bID) { QCTLinqDataContext db = new QCTLinqDataContext(); InsuranceBrokerEmail e = new InsuranceBrokerEmail { Email = email, bID = bID, Active = true }; db.InsuranceBrokerEmails.InsertOnSubmit(e); db.SubmitChanges(); }
/// <summary> /// Adds an insurance company /// </summary> /// <param name="name">Name of the insurance company</param> /// <param name="email">Email address of the insurance company</param> public static void AddInsuranceCompany(string name, string email) { QCTLinqDataContext db = new QCTLinqDataContext(); InsuranceCompany i = new InsuranceCompany { Name = name, Email = email, Active = true }; db.InsuranceCompanies.InsertOnSubmit(i); db.SubmitChanges(); }
protected void Page_Load(object sender, EventArgs e) { String mode = Request.QueryString["mode"]; if (!Page.IsPostBack) { if (mode.Equals("edit")) { Functions.SecurePage(); } int ID = Int32.Parse(Request.QueryString["ID"]); int cID = Int32.Parse(Request.QueryString["cID"]); Contractor c = Classes.Contractors.GetContractor(cID); if (mode.Equals("edit") || mode.Equals("read")) { btnDelete.Visible = true; ltSubTitle.Text = "Edit licence of: " + c.Company; QCTLinqDataContext db = new QCTLinqDataContext(); Licence l = db.Licences.Single(li => li.ID == ID); txtTypeOfLicense.Text = l.TypeOfLicence; ddCopyReceived.Value = l.CopyReceived; txtFiledWith.Text = l.LicFiledWith; ddDivision.DivisionID = l.Dept; } if (mode.Equals("read")) { Functions.DisableControls(Page); btnSubmit.Visible = false; btnDelete.Visible = false; ltSubTitle.Text = "View Licences"; btnCancel.Visible = false; } else if (mode.Equals("delete")) { ltSubTitle.Text = "Delete Licence of " + c.Company; pnDelete.Visible = true; pnDetails.Visible = false; btnCancel.Visible = false; btnDelete.Visible = false; } else { ltSubTitle.Text = "Add Licence to: " + c.Company; } btnCancel.NavURL = "~/EditContractor.aspx?ID=" + cID.ToString() + "#licences"; btnDelete.NavURL = "~/Licences.aspx?ID=" + ID.ToString() + "&cID=" + cID.ToString() + "&mode=delete"; } }
public static List <JobDetails> GetJobs(int cID) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from j in db.Tags where j.cID == cID join t in db.lookupTags on j.tID equals t.ID select new JobDetails() { Job = j, JobTitle = t.Job }; return(q.ToList()); }
public static List <InsuranceDetails> GetInsurance(int cID) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from i in db.InsurancePolicies where i.cID == cID select new InsuranceDetails() { InsurancePolicy = i, Type = i.TypeOfPolicy1.Type, Value = i.PolicyLimit.HasValue ? i.PolicyLimit1.Value : i.PolicyLimitOther }; return(q.ToList()); }
public static List <PhoneDetails> GetPhoneNumbers(int cID) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from p in db.ContractorsPhones where p.cID == cID select new PhoneDetails() { ID = p.ID, PhoneNumber = p.PhoneNumber, PhoneType = p.lookupPhoneType.Value }; return(q.ToList()); }
private int _GetDepartment(int?DivisionID) { if (DivisionID.HasValue) { QCTLinqDataContext db = new QCTLinqDataContext(); int?dept = (from d in db.Divisions where d.ID == DivisionID select d.Department).SingleOrDefault(); return((int)dept); } else { return(0); } }
/// <summary> /// Add a new email to a selected broker /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmitNewBrokerEmail_Click(object sender, EventArgs e) { QCTLinqDataContext db = new QCTLinqDataContext(); int brokerID = int.Parse(ddBroker.SelectedValue); InsuranceBrokerEmail email = new InsuranceBrokerEmail { bID = brokerID, Email = txtNewBrokerEmail.Text, Active = true }; db.InsuranceBrokerEmails.InsertOnSubmit(email); db.SubmitChanges(); PopulateBrokerEmails(brokerID); ddBrokerEmail.SelectedValue = email.ID.ToString(); }
protected void lnkConfirmDelete_Click(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); QCTLinqDataContext db = new QCTLinqDataContext(); Licence l = db.Licences.Single(li => li.ID == ID); db.Licences.DeleteOnSubmit(l); db.SubmitChanges(); notNotification.Message = "Licence has been deleted!"; notNotification.Type = "success"; notNotification.Visible = true; lnkConfirmDelete.Visible = false; lnkCancelDelete.Visible = false; btnCancel.Visible = true; pnDelete.Visible = false; }
protected void lnkConfirmDelete_Click(object sender, EventArgs e) { int ID = int.Parse(Request.QueryString["ID"]); QCTLinqDataContext db = new QCTLinqDataContext(); Permit p = db.Permits.Single(permit => permit.ID == ID); db.Permits.DeleteOnSubmit(p); db.SubmitChanges(); notAgreement.Message = "Permit has been deleted!"; notAgreement.Type = "success"; notAgreement.Visible = true; lnkConfirmDelete.Visible = false; lnkCancelDelete.Visible = false; btnCancel.Visible = true; pnDelete.Visible = false; }
protected void lnkConfirmDelete_Click(object sender, EventArgs e) { using (QCTLinqDataContext db = new QCTLinqDataContext()) { int ID = int.Parse(Request.QueryString["ID"]); Agreement ag = Classes.Agreements.GetAgreement(ID); db.Agreements.DeleteOnSubmit(ag); db.SubmitChanges(); } notAgreement.Message = "Insurance Policy has been deleted!"; notAgreement.Type = "success"; notAgreement.Visible = true; lnkConfirmDelete.Visible = false; lnkCancelDelete.Visible = false; btnCancel.Visible = true; pnDelete.Visible = false; }
protected void imgDelete_Click(object sender, EventArgs e) { ImageButton btn = sender as ImageButton; int ID = Convert.ToInt32(btn.Attributes["PhoneID"]); QCTLinqDataContext db = new QCTLinqDataContext(); ContractorsPhone p = (from c in db.ContractorsPhones where c.ID == ID select c).SingleOrDefault(); if (p != null) { db.ContractorsPhones.DeleteOnSubmit(p); db.SubmitChanges(); rptPhones.DataSource = Contractors.GetPhoneNumbers(int.Parse(Request.QueryString["ID"])); rptPhones.DataBind(); } }
protected void lnkRemoveJob_Click(object sender, EventArgs e) { LinkButton btn = sender as LinkButton; int ID = Convert.ToInt32(btn.Attributes["ItemID"]); QCTLinqDataContext db = new QCTLinqDataContext(); Tag tag = (from t in db.Tags where t.ID == ID select t).Single(); db.Tags.DeleteOnSubmit(tag); db.SubmitChanges(); int cID = Int32.Parse(Request.QueryString["ID"]); rptJobs.DataSource = Contractors.GetJobs(cID); rptJobs.DataBind(); }
public string[] GetTags(string prefixText) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from t in db.lookupTags where t.Job.StartsWith(prefixText) select t; string[] tags = new string[q.Count()]; int i = 0; foreach (lookupTag tag in q) { tags.SetValue(tag.Job, i); i++; } return(tags); }
public static List <ContractorsWithServices> GetContractorsByService(String service) { QCTLinqDataContext db = new QCTLinqDataContext(); var contractors = from t in db.lookupTags join Tags in db.Tags on new { ID = t.ID } equals new { ID = Convert.ToInt32(Tags.tID) } join c in db.AvailableContractors on new { CID = Convert.ToInt32(Tags.cID) } equals new { CID = c.ID } where t.Job.Contains(service) select new ContractorsWithServices { ID = c.ID, Company = c.Company, Email = c.Email, IsValid = (c.HasValidCGL == 1 && c.HasHSPolicy == 1 && c.HasAODA == 1 && (c.ExemptFromAuto == true || c.ValidAuto == 1)) ? true : false, MatchingService = t.Job }; return(contractors.ToList()); }
public static List <AvailableContractorDetails> GetContractors(String searchName, bool ShowAvailableOnly) { QCTLinqDataContext db = new QCTLinqDataContext(); var q = from c in db.AvailableContractors select new AvailableContractorDetails { ID = c.ID, Company = c.Company, VendorNumber = c.VendorNumber, Town = c.Town, Email = c.Email, HasValidCGL = c.HasValidCGL, HasHSPolicy = c.HasHSPolicy, HasAODA = c.HasAODA, ValidWSIB = c.ValidWSIB, ValidAuto = c.ValidAuto, ExemptFromAuto = c.ExemptFromAuto, IsValid = (c.HSPolicyNotReqd == 1) || (c.HasHSPolicy == 1), //IsValid = (c.HasValidCGL == 1 && c.HasHSPolicy == 1 && c.HasAODA == 1 && (c.ValidAuto == 1 || c.ExemptFromAuto == true)), //IsValid = true, ContactName = c.ContactName, PostalCode = c.PostalCode }; if (!searchName.Equals(String.Empty)) { var z = from c in q where c.Company.Contains(searchName) select c; q = z; } if (ShowAvailableOnly) { var z = from c in q where c.IsValid == true select c; q = z; } return(q.ToList()); }
/// <summary> /// Edit the selected insurance company /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEditIns_Click(object sender, EventArgs e) { if (ddInsuranceCompanies.SelectedIndex > 0) { QCTLinqDataContext db = new QCTLinqDataContext(); // pull the insurance company based on the selected object int ID = int.Parse(ddInsuranceCompanies.SelectedValue); InsuranceCompany ins = db.InsuranceCompanies.Where(i => i.ID == ID).Single(); // update the values ins.Name = txtNewInsuranceCompanyName.Text; ins.Email = txtNewInsComEmail.Text; // save the changes! db.SubmitChanges(); // let's clear and repopulate the dropdown menu PopulateInsuranceCompanies(); // select the appropriate selection ddInsuranceCompanies.SelectedValue = ID.ToString(); // populate the email address and name txtInsEmail.Text = ins.Email; } }