protected void btnNew_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; } NewContractAlertOn(); // This process creates a temporary new field, but Does Not clear or reset // the sequence list for any current contract. int seqMax = UsrCntSelector.SequenceNumberMax; UsrCntSelector.ResetField(); UsrCntSelector.SetSequenceNumber(seqMax, 0); ClearFieldDetail(); //txtOtherLldContracts.Text = ""; } catch (Exception ex) { ShowError(ex, "Unable to generate a New Field at this time."); } }
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."); } }
protected void btnReset_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; } int seqMax = UsrCntSelector.SequenceNumberMax; UsrCntSelector.ResetField(); UsrCntSelector.SetSequenceNumber(seqMax, 0); ClearFieldDetail(); NewContractAlertOff(); } catch (Exception ex) { ShowError(ex, "Unable to Resest the Field at this time."); } }
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 btnSvrFindField_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnSvrFindField_Click"; try { if (txtLldID.Text.Length > 0) { int lldID = Convert.ToInt32(txtLldID.Text); txtLldID.Text = ""; int maxFields = UsrCntSelector.SequenceNumberMax; UsrCntSelector.ResetField(); UsrCntSelector.SetSequenceNumber(maxFields, 0); ShowFieldDetail(lldID); } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }