protected void gv_onSorting(object sender, GridViewSortEventArgs e) { GridView gridView = sender as GridView; IQueryable <UmpireMaster> umpires = null; int clientID = Core.SessionHelper.getClientId(); if (clientID > 0) { umpires = UmpireManager.GetAll(clientID); } else { umpires = UmpireManager.GetAll(); } bool descending = false; if (ViewState[e.SortExpression] == null) { descending = false; } else { descending = !(bool)ViewState[e.SortExpression]; } ViewState[e.SortExpression] = descending; gridView.DataSource = umpires.orderByExtension(e.SortExpression, descending); gridView.DataBind(); }
protected void gvUmpire_RowCommand(object sender, GridViewCommandEventArgs e) { int umpireID = 0; if (e.CommandName == "DoEdit") { hdId.Value = e.CommandArgument.ToString(); umpireID = Convert.ToInt32(e.CommandArgument.ToString()); UmpireMaster umpire = UmpireManager.Get(umpireID); txtName.Text = umpire.UmpireName; txtAddress.Text = umpire.Address1; txtAddress2.Text = umpire.Address2; txtFedID.Text = umpire.FederalTaxID; if (umpire.StateID != null) { ddlState.SelectedValue = umpire.StateID.ToString(); CollectionManager.FillCollection(ddlCity, "CityId", "CityName", City.GetAll((int)umpire.StateID)); } if (umpire.CityID != null) { ddlCity.SelectedValue = umpire.CityID.ToString(); CollectionManager.FillCollection(ddlLossZip, "ZipCodeID", "ZipCode", ZipCode.getByCityID((int)umpire.CityID)); } if (!string.IsNullOrEmpty(umpire.ZipCode)) { ddlLossZip.SelectedValue = umpire.ZipCode; } txtEmail.Text = umpire.Email; txtPhone.Text = umpire.Phone; pnlEdit.Visible = true; pnlGrid.Visible = false; } else if (e.CommandName == "DoDelete") { umpireID = Convert.ToInt32(e.CommandArgument.ToString()); AppraiserMaster appraiser = AppraiserManager.Get(umpireID); if (appraiser != null) { appraiser.Status = false; AppraiserManager.Save(appraiser); } } loadUmpires(); }
protected void loadUmpires() { IQueryable <UmpireMaster> umpires = null; int clientID = Core.SessionHelper.getClientId(); if (clientID > 0) { umpires = UmpireManager.GetAll(clientID); } else { umpires = UmpireManager.GetAll(); } gvUmpire.DataSource = umpires.ToList(); gvUmpire.DataBind(); }
protected void saveUmpire() { // 2013-08-07 tortega int clientID = Core.SessionHelper.getClientId(); using (TransactionScope scope = new TransactionScope()) { bool exists = UmpireManager.IsExist(txtName.Text.Trim(), Convert.ToInt32(hdId.Value)); if (exists) { lblMessage.Text = "Umpire name already exists."; lblMessage.Visible = true; txtName.Focus(); return; } UmpireMaster umpire = UmpireManager.Get(Convert.ToInt32(hdId.Value)); umpire.UmpireName = txtName.Text; umpire.BusinessName = txtBusinessName.Text; umpire.FederalTaxID = txtFedID.Text.Trim(); umpire.Address1 = txtAddress.Text.Trim(); umpire.Address2 = txtAddress2.Text.Trim(); umpire.StateID = Convert.ToInt32(ddlState.SelectedValue); umpire.CityID = Convert.ToInt32(ddlCity.SelectedValue); umpire.ZipCode = ddlLossZip.SelectedValue; umpire.FederalTaxID = txtFedID.Text.Trim(); umpire.Email = txtEmail.Text; umpire.Phone = txtPhone.Text; umpire.Status = true; // 2013-08-07 tortega if (clientID > 0) { umpire.ClientId = clientID; } UmpireManager.Save(umpire); scope.Complete(); } }
private void bindDDL() { //IQueryable<AdjusterMaster> adjusters = null; IQueryable <ContractorMaster> contractors = null; IQueryable <AppraiserMaster> appraisers = null; IQueryable <UmpireMaster> umpires = null; List <LeadSourceMaster> sources = null; int clientID = SessionHelper.getClientId(); if (clientID > 0) { // adjusters = AdjusterManager.GetAll(clientID); contractors = ContractorManager.GetAll(clientID); appraisers = AppraiserManager.GetAll(clientID); umpires = UmpireManager.GetAll(clientID); sources = LeadSourceManager.GetAll(clientID); } else { // adjusters = AdjusterManager.GetAll(); contractors = ContractorManager.GetAll(); appraisers = AppraiserManager.GetAll(); umpires = UmpireManager.GetAll(); sources = LeadSourceManager.GetAll(); } if (appraisers != null) { CollectionManager.FillCollection(ddlAppraiser, "AppraiserId", "AppraiserName", appraisers.ToList()); } CollectionManager.FillCollection(ddlContractor, "ContractorId", "ContractorName", contractors.ToList()); CollectionManager.FillCollection(ddlUmpire, "UmpireId", "UmpireName", umpires.ToList()); //CollectionManager.FillCollection(ddlLeadStatus, "StatusId", "StatusName", StatusManager.GetAll()); //CollectionManager.FillCollection(ddlSubStatus, "SubStatusId", "SubStatusName", SubStatusManager.GetAll()); //CollectionManager.FillCollection(ddlAdjuster, "AdjusterId", "AdjusterName", adjusters); CollectionManager.FillCollection(ddlLeadSource, "LeadSourceId", "LeadSourceName", sources); //CollectionManager.FillCollection(ddlInspectorName, "InspectorId", "InspectorName", InspectorManager.GetAll()); //CollectionManager.FillCollection(ddlSiteInspection, "SiteInspectionCompleteId", "SiteInspectionCompleteName", SiteInspectionManager.GetAll()); CollectionManager.FillCollection(ddlOwnerSame, "OwnerSameId", "OwnerSame", OwnerSameManager.GetAll()); //CollectionManager.FillCollection(ddlWebFormSource, "WebformSourceId", "WebformSource", WebFormSourceManager.GetAll()); //CollectionManager.FillCollection(ddlOtherSource, "OtherSourceId", "OtherSource", OtherSourceManager.GetAll()); //Fillchk(chkTypeOfDamage, "TypeOfDamageId", "TypeOfDamage", TypeofDamageManager.GetAll()); ///CollectionManager.FillCollection(ddlTypeOfProperty, "TypeOfPropertyId", "TypeOfProperty", TypeOfPropertyManager.GetAll()); //CollectionManager.FillCollection(ddlHabitable, "HabitableId", "Habitable", HabitableManager.GetAll()); //CollectionManager.FillCollection(ddlWindPolicy, "WindPolicyId", "WindPolicy", WindPolicyManager.GetAll()); //CollectionManager.FillCollection(ddlFloodPolicy, "FloodPolicyId", "FloodPolicy", FloodPolicyManager.GetAll()); //CollectionManager.FillCollection(ddlRepotedInsurer, "ReportedToInsurerId", "ReportedToInsurer", ReportedToInsurerManager.GetAll()); }