private void FillDescriptions() { const string METHOD_NAME = "FillDescriptions"; try { ddlDescription.Items.Clear(); using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.GetLookupList(conn, ddlType.SelectedValue, null)) { while (dr.Read()) { ListItem item = new ListItem(dr.GetString(dr.GetOrdinal("lkp_description")), (dr.GetBoolean(dr.GetOrdinal("lkp_is_active")) == true ? "1" : "0") + "^" + dr.GetString(dr.GetOrdinal("lkp_description"))); ddlDescription.Items.Add(item); } } } if (ddlDescription.SelectedIndex == -1) { ddlDescription.SelectedIndex = 0; } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
protected void btnDelete_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnDelete_Click"; bool isOk = false; string factoryArea = ""; try { GridViewRow row = grdResults.SelectedRow; if (row == null) { Common.CWarning cex = new Common.CWarning("Please select a variety before pressing Delete."); throw (cex); } factoryArea = ddlFactoryArea.SelectedItem.Text; string varietyName = row.Cells[0].Text; bool isDelete = true; WSCField.SeedVarietySave(factoryArea, varietyName, isDelete); txtVarietyName.Text = ""; grdResults.SelectedIndex = -1; isOk = true; } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } if (isOk) { Response.Redirect("~/SHS/SeedVariety.aspx?DeleteOk=true&lastArea=" + factoryArea); } }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; try { Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning")); if (!Page.IsPostBack) { WSCField.FillCropYear(ddlCropYear, DateTime.Now.Year.ToString()); FillRequired(); FillFinished(); _cropYear = Int32.Parse(Common.UILib.GetDropDownText(ddlCropYear)); FillPaymentDescription(); EnableDisablePayments(); } else { _cropYear = Int32.Parse(Common.UILib.GetDropDownText(ddlCropYear)); } } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); // ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
private void SelectFsaState(string stateName) { Domain domain = WSCField.GetDomainData(); int selectedIndex = -1; foreach (System.Web.UI.WebControls.ListItem item in ddlFSAState.Items) { if (item.Text == stateName) { item.Selected = true; selectedIndex = ddlFSAState.Items.IndexOf(item); } else { item.Selected = false; } } ddlFSAState.SelectedIndex = selectedIndex; // Fill FSA County Dropdown ddlFSACounty.Items.Clear(); foreach (TItem2 item in domain.CountyList.Items) { if (item.Field1 == stateName) { ddlFSACounty.Items.Add(item.Field2); } } }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; try { Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning")); if (!Page.IsPostBack) { WSCField.FillCropYear(ddlCropYear, DateTime.Now.Year.ToString()); FillFactory(); FillStation(); FillContract(); FillPayment(); btnSaveExcessPct.Enabled = false; } else { //------------------------------------------------------------------------- // Getting each list from the native control is odd, but having the // selections as CSV type strings if very handy. //------------------------------------------------------------------------- System.Collections.Specialized.NameValueCollection nv = Page.Request.Form; _factoryList = nv[lstFactory.ClientID.Replace("_", "$")]; _stationList = nv[lstStation.ClientID.Replace("_", "$")]; _contractList = nv[lstContract.ClientID.Replace("_", "$")]; _paymentList = nv[lstPayment.ClientID.Replace("_", "$")]; if (_factoryList == null) { _factoryList = ""; } if (_stationList == null) { _stationList = ""; } if (_contractList == null) { _contractList = ""; } if (_paymentList == null) { _paymentList = ""; } } } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
protected void btnAddField_Click(object sender, EventArgs e) { try { if (UsrCntSelector.IsChangedSHID) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You changed the SHID without pressing the Find button. Please press Find."); return; } WSCSecurity auth = Globals.SecurityState; if (!UsrCntSelector.IsOwner) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Sorry, you are not authorized to update this information"); return; } // Add the field if it has a valid lld_id if (UsrCntSelector.LldID == 0) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You must first Save this field before adding it to the Contract."); return; } if (UsrCntSelector.CntLLDID > 0) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "This field is already contracted for this season."); return; } if (!(UsrCntSelector.ContractID > 0)) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You must first select a contract before adding a field to the contract."); return; } // okay, add the field to the contract. int cntlld_cntlld_id_out = 0; WSCField.CntLldAddField(UsrCntSelector.ContractID, UsrCntSelector.LldID, UsrCntSelector.CropYear, auth.UserName, ref cntlld_cntlld_id_out); // Bounce sequence number to max value if (cntlld_cntlld_id_out > 0) { int newMaxSeq = UsrCntSelector.SequenceNumberMax + 1; UsrCntSelector.SetSequenceNumber(newMaxSeq, newMaxSeq); } ShowContractFieldDetail(); } catch (Exception ex) { ShowError(ex, "Unable to Add this Field to this Contract at this time."); } }
private void ShowFieldDetail(int cntlldID) { try { ClearFieldDeail(); using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.FieldGetDetailByCntLLD(conn, cntlldID)) { if (dr.Read()) { UsrCntSelector.CntLLDID = dr.GetInt32(dr.GetOrdinal("fld_cntlld_id")); UsrCntSelector.FieldID = dr.GetInt32(dr.GetOrdinal("fld_field_id")); UsrCntSelector.LldID = dr.GetInt32(dr.GetOrdinal("fld_lld_id")); Common.UILib.SelectDropDown(ddlRotationLength, dr.GetString(dr.GetOrdinal("fld_rotation_len"))); Common.UILib.SelectDropDown(ddlPriorCrop, dr.GetString(dr.GetOrdinal("fld_prev_crop_type"))); Common.UILib.SelectDropDown(ddlBeetYears, dr.GetString(dr.GetOrdinal("fld_beet_years"))); chkRhizomania.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_rhizomania")); chkAphanomyces.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_aphanomyces")); chkCurlyTop.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_curly_top")); chkFusarium.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_fusarium")); chkRhizoctonia.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_rhizoctonia")); chkNematode.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_nematode")); chkCercospora.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_cercospora")); chkRootAphid.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_root_aphid")); chkPowderyMildew.Checked = dr.GetBoolean(dr.GetOrdinal("fld_suspect_powdery_mildew")); Common.UILib.SelectDropDown(ddlWaterSource, dr.GetString(dr.GetOrdinal("fld_irrigation_source"))); Common.UILib.SelectDropDown(ddlIrrigation, dr.GetString(dr.GetOrdinal("fld_irrigation_method"))); Common.UILib.SelectDropDown(ddlPostAphanomyces, dr.GetString(dr.GetOrdinal("fld_post_Aphanomyces"))); Common.UILib.SelectDropDown(ddlPostCercospora, dr.GetString(dr.GetOrdinal("fld_post_Cercospora"))); Common.UILib.SelectDropDown(ddlPostCurlyTop, dr.GetString(dr.GetOrdinal("fld_post_CurlyTop"))); Common.UILib.SelectDropDown(ddlPostFusarium, dr.GetString(dr.GetOrdinal("fld_post_Fusarium"))); Common.UILib.SelectDropDown(ddlPostNematode, dr.GetString(dr.GetOrdinal("fld_post_Nematode"))); Common.UILib.SelectDropDown(ddlPostPowderyMildew, dr.GetString(dr.GetOrdinal("fld_post_PowderyMildew"))); Common.UILib.SelectDropDown(ddlPostRhizoctonia, dr.GetString(dr.GetOrdinal("fld_post_Rhizoctonia"))); Common.UILib.SelectDropDown(ddlPostRhizomania, dr.GetString(dr.GetOrdinal("fld_post_Rhizomania"))); Common.UILib.SelectDropDown(ddlPostRootAphid, dr.GetString(dr.GetOrdinal("fld_post_RootAphid"))); Common.UILib.SelectDropDown(ddlLandOwnership, dr.GetString(dr.GetOrdinal("fld_ownership"))); Common.UILib.SelectDropDown(ddlTillage, dr.GetString(dr.GetOrdinal("fld_tillage"))); chkPostWater.Checked = dr.GetBoolean(dr.GetOrdinal("fld_post_water")); } } } } catch (Exception ex) { Common.CException wex = new Common.CException("FieldContracting.ShowFieldDetail", ex); throw (wex); } }
private void GetFactoryAreaList() { try { DataTable dt = WSCField.FactoryAreaGetAll(); foreach (DataRow row in dt.Rows) { this._factoryVarietyList.AddItem(row["factoryNumber"].ToString(), row["factoryArea"].ToString()); } } catch (Exception ex) { WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + "GetFactoryAreaList", ex); throw (wex); } }
private void GetSeedVarietyList() { try { DataTable dt = WSCField.SeedVarietyGetByArea(""); foreach (DataRow row in dt.Rows) { this._varietyList.AddItem(row["svtyFactoryArea"].ToString(), row["svtyVariety"].ToString()); } } catch (Exception ex) { WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + "GetSeedVarietyList", ex); throw (wex); } }
private void FillFieldLabResults() { const string METHOD_NAME = "FillFieldLabResults"; try { int cropYear = CropYear; int fieldID = 0; int divHeight = 120; divFieldLabResultsEmpty.Attributes.Add("class", "DisplayOff"); divFieldLabResultsEmpty.InnerHtml = ""; if (grdFieldResults.SelectedRow != null) { fieldID = Convert.ToInt32(grdFieldResults.SelectedRow.Cells[0].Text.Replace(BLANK_CELL, "")); } using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { ArrayList labs = WSCField.SoilSampleLabGetByField(conn, fieldID, cropYear); // Do we have any valid data? If not show warning. if (labs.Count == 1) { SoilSampleLabState lab = (SoilSampleLabState)labs[0]; if (lab.SoilSampleLabID == 0 && fieldID > 0) { divFieldLabResultsEmpty.Attributes.Add("class", "WarnNoData"); divFieldLabResultsEmpty.InnerHtml = "No soil sample labs are assigned to the selected field " + "in crop year " + cropYear.ToString(); } } else { divHeight += 17 * (labs.Count + 1); } string style = "BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; OVERFLOW: auto; BORDER-LEFT: black 1px solid; WIDTH: 935px; BORDER-BOTTOM: black 1px solid; HEIGHT: " + divHeight.ToString() + "px;"; divFieldLabs.Attributes.Add("style", style); grdFieldLabResults.SelectedIndex = -1; grdFieldLabResults.DataSource = labs; grdFieldLabResults.DataBind(); } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
protected void btnAddLab_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnAddLab_Click"; try { if (grdFieldResults.SelectedRow == null) { Common.CWarning warn = new Common.CWarning("You must first select a field in the Contract Fields grid."); throw (warn); } ArrayList selectedIDs = GetSelectedIDs(grdOtherLabResults, "chkAllLabsSelection", "lblAllLabsSoilSampleLabID"); if (selectedIDs.Count == 0) { Common.CWarning warn = new Common.CWarning("You must select a lab result in the All Lab Results grid."); throw (warn); } if (selectedIDs.Count > 1) { Common.CWarning warn = new Common.CWarning("Please select only one All Lab Results lab to add to the Field."); throw (warn); } string fieldName = grdOtherLabResults.SelectedRow.Cells[3].Text.Replace(BLANK_CELL, ""); if (fieldName.Length > 0) { string contract = grdOtherLabResults.SelectedRow.Cells[2].Text.Replace(BLANK_CELL, ""); Common.CWarning warn = new Common.CWarning("This lab already belongs to contract " + contract + " and field " + fieldName + "."); throw (warn); } int cropYear = CropYear; int fieldID = Convert.ToInt32(grdFieldResults.SelectedRow.Cells[0].Text.Replace(BLANK_CELL, "")); int soilSampleLabID = Convert.ToInt32(grdOtherLabResults.SelectedRow.Cells[1].Text.Replace(BLANK_CELL, "")); using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { WSCField.FieldSampleLabSave(conn, fieldID, cropYear, soilSampleLabID); } FillFieldLabResults(); FillOtherLabResults(); } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
private void GetLostReasonList() { try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.GetLookupList(conn, "LOST_REASON")) { while (dr.Read()) { this._lostReasonList.AddItem(dr.GetString(dr.GetOrdinal("lkp_description"))); } } } } catch (Exception ex) { WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + "GetLostReasonList", ex); throw (wex); } }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; try { Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning")); if (!Page.IsPostBack) { WSCField.FillCropYear(ddlCropYear, DateTime.Now.Year.ToString()); } } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
private void ShowFieldDescription(int contractID, int sequenceNumber) { try { ClearFieldDescription(); using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.CntLldGetDetail(conn, UsrCntSelector.ContractID, UsrCntSelector.SequenceNumber)) { if (dr.Read()) { UsrCntSelector.CntLLDID = dr.GetInt32(dr.GetOrdinal("cntlld_cntlld_id")); UsrCntSelector.LldID = dr.GetInt32(dr.GetOrdinal("cntlld_lld_id")); UsrCntSelector.FieldName = dr.GetString(dr.GetOrdinal("cntlld_field_name")); UsrCntSelector.FsaNumber = dr.GetString(dr.GetOrdinal("cntlld_fsa_number")); UsrCntSelector.FieldState = dr.GetString(dr.GetOrdinal("cntlld_state")); lblFieldName.Text = dr.GetString(dr.GetOrdinal("cntlld_field_name")); lblFsaNumber.Text = dr.GetString(dr.GetOrdinal("cntlld_fsa_number")); lblState.Text = dr.GetString(dr.GetOrdinal("cntlld_state")); lblCounty.Text = dr.GetString(dr.GetOrdinal("cntlld_county")); lblTownship.Text = dr.GetString(dr.GetOrdinal("cntlld_township")); lblRange.Text = dr.GetString(dr.GetOrdinal("cntlld_range")); lblSection.Text = dr.GetString(dr.GetOrdinal("cntlld_section")); lblQuadrant.Text = dr.GetString(dr.GetOrdinal("cntlld_quadrant")); lblQuarterQuadrant.Text = dr.GetString(dr.GetOrdinal("cntlld_quarter_quadrant")); lblLongitude.Text = (dr.GetDecimal(dr.GetOrdinal("cntlld_latitude"))).ToString(); lblLatitude.Text = (dr.GetDecimal(dr.GetOrdinal("cntlld_longitude"))).ToString(); lblFsaOfficial.Text = (dr.GetBoolean(dr.GetOrdinal("cntlld_fsa_official")) ? "Yes" : "No"); lblAcres.Text = dr.GetInt32(dr.GetOrdinal("cntlld_acres")).ToString(); lblDescription.Text = dr.GetString(dr.GetOrdinal("cntlld_description")); lblFsaState.Text = dr.GetString(dr.GetOrdinal("cntlld_fsa_state")); lblFsaCounty.Text = dr.GetString(dr.GetOrdinal("cntlld_fsa_county")); lblFarmNo.Text = dr.GetString(dr.GetOrdinal("cntlld_farm_number")); lblTractNo.Text = dr.GetString(dr.GetOrdinal("cntlld_tract_number")); lblFieldNo.Text = dr.GetString(dr.GetOrdinal("cntlld_field_number")); lblQuarterField.Text = dr.GetString(dr.GetOrdinal("cntlld_quarter_field")); } } } } catch (Exception ex) { Common.CException wex = new Common.CException("FieldContracting.ShowFieldDescription", ex); throw (wex); } }
private void FillCropYear() { if (ddlCropYear.Items.Count > 0) { CropYear = Int32.Parse(ddlCropYear.SelectedValue); } if (CropYear == 0) { CropYear = _shs.CropYear; } if (CropYear == 0) { CropYear = Convert.ToInt32(WSCField.GetCropYears()[0].ToString()); } WSCField.FillCropYear(ddlCropYear, CropYear.ToString()); }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning")); ((HarvestReportTemplate)Master).LocPDF = ""; ((HarvestReportTemplate)Master).PrintReady += new CommandEventHandler(DoPrintReady); try { // Hide Master page Crop Year control DropDownList ddlMasterCropYear = (DropDownList)((HarvestReportTemplate)Master).FindControl("ddlCropYear"); ddlMasterCropYear.CssClass = "DisplayOff"; HtmlGenericControl lblMasterCropYear = (HtmlGenericControl)((HarvestReportTemplate)Master).FindControl("lblCropYear"); lblMasterCropYear.Attributes.Add("class", "DisplayOff"); if (!Page.IsPostBack) { radCalYear.Checked = true; WSCField.FillCropYear(ddlYear, DateTime.Now.Year.ToString()); // Only allow years from 2010 forward. for (int i = ddlYear.Items.Count - 1; i >= 0; i--) { if (Convert.ToInt32(ddlYear.Items[i].Value) < 2010) { ddlYear.Items.Remove(ddlYear.Items[i]); } } } _shs = Globals.ShsData; } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); if (Common.AppHelper.IsDebugBuild()) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), wex); } else { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Unable to load page correctly at this time.", wex); Common.AppHelper.LogException(wex, HttpContext.Current); } } }
protected void btnDelete_Click(object sender, EventArgs e) { try { if (UsrCntSelector.IsChangedSHID) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You changed the SHID without pressing the Find button. Please press Find."); return; } WSCSecurity auth = Globals.SecurityState; if (!UsrCntSelector.IsOwner) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Sorry, you are not authorized to update this information"); return; } // Delete this Field \ Land Description when it has a valid LLD_ID. // Otherwise just blow it off and do a little reset. int lld_id = UsrCntSelector.LldID; if (lld_id > 0) { WSCField.LegalLandDescDelete(lld_id); } else { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You must be viewing a field already in the system in order to delete it."); return; } int seq = 0; int seqMax = 0; if (UsrCntSelector.SequenceNumber > 0) { seq = 1; seqMax = UsrCntSelector.SequenceNumberMax - 1; } ClearFieldDetail(); UsrCntSelector.InitControl(UsrCntSelector.SHID, UsrCntSelector.CropYear, UsrCntSelector.ContractNumber, seq); } catch (Exception ex) { ShowError(ex, @"Unable to Delete this Land Description \ Field at this time."); } }
private void GetPlantSpacingList() { try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.GetLookupList(conn, "PLANT_SPACING")) { this._plantSpacingList.AddItem("0"); while (dr.Read()) { this._plantSpacingList.AddItem(dr.GetString(dr.GetOrdinal("lkp_description"))); } } } } catch (Exception ex) { WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + "GetPlantSpacingList", ex); throw (wex); } }
protected void Page_Load(object sender, EventArgs e) { HtmlGenericControl script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.Attributes.Add("src", Page.ResolveUrl("~/Script/Common.js")); Page.Header.Controls.Add(script); // ** ** ** Add JQuery.js to page Head tag ** ** ** //script = new HtmlGenericControl("script"); //script.Attributes.Add("type", "text/javascript"); //script.Attributes.Add("src", Page.ResolveUrl("~/Script/JQuery.js")); //Page.Header.Controls.Add(script); // ** ** ** Add MyJQuery.js extensions to page Head tag ** ** ** script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.Attributes.Add("src", Page.ResolveUrl("~/Script/MyJQuery.js")); Page.Header.Controls.Add(script); // ** ** ** Add JQueryUI.css (custom version) to page Head tag ** ** ** //HtmlLink linkBlock = new HtmlLink(); //linkBlock.Href = Page.ResolveUrl("~/Script/JQueryUI/css/blitzer/jquery-ui.css"); //linkBlock.Attributes.Add("rel", "stylesheet"); //linkBlock.Attributes.Add("type", "text/css"); //Page.Header.Controls.Add(linkBlock); // ** ** ** Add JQueryUI.js to page Head tag ** ** ** //script = new HtmlGenericControl("script"); //script.Attributes.Add("type", "text/javascript"); //script.Attributes.Add("src", Page.ResolveUrl("~/Script/JQueryUI/js/jquery-ui.js")); //Page.Header.Controls.Add(script); lblDateStamp.Text = DateTime.Now.ToString("MMMM dd, yyyy"); litYear.Text = DateTime.Now.Year.ToString(); ddlReports.Attributes.Add("onchange", "PopReport(this)"); if (ddlCropYear.Items.Count == 0) { string cy = WSCField.GetCropYears()[0].ToString(); WSCField.FillCropYear(ddlCropYear, cy); } }
private void FillOtherLabResults() { const string METHOD_NAME = "FillOtherLabResults"; try { int shid = SHID; int cropYear = CropYear; int divHeight = 160; divOtherLabResultsEmpty.Attributes.Add("class", "DisplayOff"); divOtherLabResultsEmpty.InnerHtml = ""; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { ArrayList labs = WSCField.SoilSampleLabGetByGrower(conn, shid, cropYear); // Do we have any valid data? If not show warning. if (labs.Count == 1) { SoilSampleLabState lab = (SoilSampleLabState)labs[0]; if (lab.SoilSampleLabID == 0 && shid > 0) { divOtherLabResultsEmpty.Attributes.Add("class", "WarnNoData"); divOtherLabResultsEmpty.InnerHtml = "No soil sample labs are assigned to SHID " + shid.ToString() + " in crop year " + cropYear.ToString(); } } else { divHeight += 17 * (labs.Count + 1); } string style = "BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; OVERFLOW: auto; BORDER-LEFT: black 1px solid; WIDTH: 935px; BORDER-BOTTOM: black 1px solid; HEIGHT: " + divHeight.ToString() + "px;"; divOtherLabs.Attributes.Add("style", style); grdOtherLabResults.SelectedIndex = -1; grdOtherLabResults.DataSource = labs; grdOtherLabResults.DataBind(); } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void FillDomainData() { Domain domain = WSCField.GetDomainData(); ddlState.Items.Clear(); foreach (TItem item in domain.StateList.Items) { ddlState.Items.Add(item.Name); } ddlFSAState.Items.Clear(); foreach (TItem item in domain.StateList.Items) { ddlFSAState.Items.Add(item.Name); } // Section ddlSection.Items.Clear(); foreach (TItem item in domain.SectionList.Items) { ddlSection.Items.Add(item.Name); } // Quadrant ddlQuadrant.Items.Clear(); foreach (TItem item in domain.QuadrantList.Items) { ddlQuadrant.Items.Add(item.Name); } // Quarter Quadrant ddlQuarterQuadrant.Items.Clear(); foreach (TItem item in domain.QuarterQuadrantList.Items) { ddlQuarterQuadrant.Items.Add(item.Name); } // Quarter Field ddlQuarterField.Items.Clear(); foreach (TItem item in domain.QuarterQuadrantList.Items) { ddlQuarterField.Items.Add(item.Name); } }
protected void btnSaveContract_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnSaveContract_Click"; try { if (UsrCntSelector.IsChangedSHID) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You changed the SHID without pressing the Find button. Please press Find."); return; } if (UsrCntSelector.FieldID == 0) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), " You cannot Save unless you are viewing a contracted field."); return; } WSCSecurity auth = Globals.SecurityState; if (!UsrCntSelector.IsOwner) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Sorry, you are not authorized to update this information"); return; } WSCField.FieldContractingSave(UsrCntSelector.FieldID, Common.UILib.GetDropDownText(ddlRotationLength), Common.UILib.GetDropDownText(ddlPriorCrop), Common.UILib.GetDropDownText(ddlBeetYears), chkRhizomania.Checked, chkAphanomyces.Checked, chkCurlyTop.Checked, chkFusarium.Checked, chkRhizoctonia.Checked, chkNematode.Checked, chkCercospora.Checked, chkRootAphid.Checked, chkPowderyMildew.Checked, Common.UILib.GetDropDownText(ddlPostAphanomyces), Common.UILib.GetDropDownText(ddlPostCercospora), Common.UILib.GetDropDownText(ddlPostCurlyTop), Common.UILib.GetDropDownText(ddlPostFusarium), Common.UILib.GetDropDownText(ddlPostNematode), Common.UILib.GetDropDownText(ddlPostPowderyMildew), Common.UILib.GetDropDownText(ddlPostRhizoctonia), Common.UILib.GetDropDownText(ddlPostRhizomania), Common.UILib.GetDropDownText(ddlPostRootAphid), chkPostWater.Checked, Common.UILib.GetDropDownText(ddlWaterSource), Common.UILib.GetDropDownText(ddlIrrigation), Common.UILib.GetDropDownText(ddlLandOwnership), Common.UILib.GetDropDownText(ddlTillage), auth.UserName); ShowFieldDetail(UsrCntSelector.CntLLDID); } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
private void GetBeetYearList() { const string METHOD_NAME = "GetBeetYearList"; try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.GetLookupList(conn, "BEET_YEARS")) { this._fieldBeetYearsList.AddItem("0"); while (dr.Read()) { this._fieldBeetYearsList.AddItem(dr.GetString(dr.GetOrdinal("lkp_description"))); } } } } catch (Exception ex) { WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void GetLandOwnershipList() { const string METHOD_NAME = "GetLandOwnershipList"; try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCField.GetLookupList(conn, "LAND_OWNERSHIP")) { this._landOwnershipList.AddItem(NO_VALUE); while (dr.Read()) { this._landOwnershipList.AddItem(dr.GetString(dr.GetOrdinal("lkp_description"))); } } } } catch (Exception ex) { WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; try { Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning")); btnProcess.Attributes.Add("onclick", "confirm('Are you sure you want to calculate this payment? Press Ok to continue or Cancel to abort.');"); if (!Page.IsPostBack) { WSCField.FillCropYear(ddlCropYear, DateTime.Now.Year.ToString()); FillFactory(); FillPayment(); } } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; try { Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning")); btnDelete.Attributes.Add("onclick", "confirm('Are you sure you want to delete this Row Width?');"); if (!Page.IsPostBack) { WSCField.FillCropYear(ddlCropYear, DateTime.Now.Year.ToString()); FillRowWidth(); FillRowWidthDetails(); } } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
protected void btnAdd_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnAdd_Click"; bool isOk = false; string factoryArea = ""; try { string variety = txtVarietyName.Text; if (String.IsNullOrEmpty(variety)) { Common.CWarning cex = new Common.CWarning("Please enter a variety name before pressing Add."); throw(cex); } // Make sure enterd variety name is not already in the grid. foreach (GridViewRow row in grdResults.Rows) { if (row.Cells[0].Text == variety) { Common.CWarning cex = new Common.CWarning("The Variety Name entered is already in the list. Please enter a different name or change Factory Area."); throw (cex); } } factoryArea = ddlFactoryArea.SelectedItem.Text; string varietyName = variety; bool isDelete = false; WSCField.SeedVarietySave(factoryArea, varietyName, isDelete); isOk = true; } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } if (isOk) { Response.Redirect("~/SHS/SeedVariety.aspx?AddOk=true&lastArea=" + factoryArea); } }
private void FillSeedVarietyGrid() { const string METHOD_NAME = "FillSeedVarietyGrid"; try { string factoryArea = ddlFactoryArea.SelectedItem.Text; grdResults.DataSource = null; grdResults.DataBind(); DataTable dt = WSCField.SeedVarietyGetByArea(factoryArea); grdResults.SelectedIndex = -1; grdResults.DataSource = dt; grdResults.DataBind(); } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
protected void btnRemoveField_Click(object sender, EventArgs e) { try { if (UsrCntSelector.IsChangedSHID) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You changed the SHID without pressing the Find button. Please press Find."); return; } WSCSecurity auth = Globals.SecurityState; if (!UsrCntSelector.IsOwner) { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Sorry, you are not authorized to update this information"); return; } // Remove the field from the contract if it has a valid cntlld entry. if (UsrCntSelector.SequenceNumber > 0) { int cntlld_id = UsrCntSelector.CntLLDID; if (cntlld_id > 0) { WSCField.CntLldDelete(cntlld_id); } UsrCntSelector.SequenceNumberMax = UsrCntSelector.SequenceNumberMax - 1; UsrCntSelector.SetSequenceNumber(UsrCntSelector.SequenceNumberMax, 1); ShowContractFieldDetail(); } else { Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You must be viewing a field on this contract before removing a field from the contract."); return; } } catch (Exception ex) { ShowError(ex, "Unable to Remove this Field to this Contract at this time."); } }
protected void Page_Load(object sender, EventArgs e) { const string METHOD_NAME = "Page_Load"; try { Common.AppHelper.HideWarning(addrWarning); Common.AppHelper.HideWarning(indWarning); if (!Page.IsPostBack) { this.MySHID = null; this.IndTable = new List <Individual>(); WSCField.FillCropYear(ddlCropYear, DateTime.Now.Year.ToString()); } txtSHID.Attributes.Add("onkeypress", "CheckEnterKey(event);"); } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex, "Unable to load page correctly at this time.", addrWarning); } }