protected void btnSave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnSave_Click";
            int taxYear = 0;
            int cropYear = 0;
            bool ok = false;

            try {

                cropYear = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                taxYear = Convert.ToInt32(Common.UILib.GetDropDownText(ddlTaxYear));

                string tmp = txtRatePerTon.Text;
                decimal ratePerTon = 0;
                if (!Decimal.TryParse(tmp, out ratePerTon)) {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid Rate Per Ton.");
                    throw (warn);
                }

                decimal percentToApply = 0;
                tmp = txtPercentageToApply.Text;
                if (!Decimal.TryParse(tmp, out percentToApply)) {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid Percentage to Apply.");
                    throw (warn);
                }

                DateTime reportDate = DateTime.MinValue;
                tmp = txtReportDate.Text;
                if (tmp != "") {
                    if (!DateTime.TryParse(tmp, out reportDate)) {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid Report Date.");
                        throw (warn);
                    }
                }

                DateTime fiscalYearEndDate = DateTime.MinValue;
                tmp = txtFiscalYearEndDate.Text;
                if (tmp != "") {
                    if (!DateTime.TryParse(tmp, out fiscalYearEndDate)) {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid Fiscal Year End Date.");
                        throw (warn);
                    }
                }

                WSCAdmin.PassthroughAllSave(cropYear, taxYear, ratePerTon, percentToApply,
                    reportDate, fiscalYearEndDate, Globals.SecurityState.UserName);

                ok = true;

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }

            if (ok) {
                Response.Redirect("~/Admin/PassthroughManagement.aspx?YR=" + cropYear.ToString()
                    + "&UpdateOk=true");
            }
        }
Пример #2
0
        private void FindContract()
        {
            try {
                string query = txtQuery.Text;
                txtQuery.Text = "";

                int contractNo = 0;
                if (query.Length > 0)
                {
                    if (Common.CodeLib.IsNumeric(query))
                    {
                        contractNo = Convert.ToInt32(query);
                    }
                    else
                    {
                        Common.CWarning warn = new Common.CWarning("Please enter a number for the Contract Number.");
                        throw (warn);
                    }
                }

                FindContract(contractNo);
            }
            catch (Exception ex) {
                // Raise event to container
                ContractSelectorEventArgs cntArg = new ContractSelectorEventArgs(ex);
                OnShareholderFind(cntArg);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string reportDate = txtCpsReportDate.Text;
                string cropYear = ((MasterReportTemplate)Master).CropYear;
                string shid = txtCpsSHID.Text;

                if (reportDate == null || reportDate.Length == 0 || !Common.CodeLib.IsDate(reportDate)) {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid report date, mm/dd/yyyy");
                    throw (warn);
                }

                WSCReports.rptContractPayeeSummary rpt = new WSCReports.rptContractPayeeSummary();
                string pdf = rpt.ReportPackager(Int32.Parse(cropYear), DateTime.Parse(reportDate), shid, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #4
0
        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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");
                string contractNumber = Common.UILib.GetListText(lstCdsContract, ",");

                // Check required fields: contract number
                if (String.IsNullOrEmpty(contractNumber)) {
                    Common.CWarning warn = new Common.CWarning("You must select a Contract.");
                    throw (warn);
                }

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                string pdf = WSCReports.rptContractDeliverySummary.ReportPackager(Convert.ToInt32(cropYear), Convert.ToInt32(contractNumber), fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #6
0
        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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      reportDate    = txtCpsReportDate.Text;
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;
                string      shid          = txtCpsSHID.Text;

                if (reportDate == null || reportDate.Length == 0 || !Common.CodeLib.IsDate(reportDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid report date, mm/dd/yyyy");
                    throw (warn);
                }

                WSCReports.rptContractPayeeSummary rpt = new WSCReports.rptContractPayeeSummary();
                string pdf = rpt.ReportPackager(Int32.Parse(cropYear), DateTime.Parse(reportDate), shid, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth           = Globals.SecurityState;
                string      logoUrl        = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder  = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName       = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");
                string      contractNumber = Common.UILib.GetListText(lstCdsContract, ",");

                // Check required fields: contract number
                if (String.IsNullOrEmpty(contractNumber))
                {
                    Common.CWarning warn = new Common.CWarning("You must select a Contract.");
                    throw (warn);
                }

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                string pdf      = WSCReports.rptContractDeliverySummary.ReportPackager(Convert.ToInt32(cropYear), Convert.ToInt32(contractNumber), fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #9
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = txtFileName.Text;

                // Get File Name
                if (fileName.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                string pdf = "";

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                pdf = WSCReports.rptBeet1099.ReportPackager(cropYear, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }
                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #10
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = txtFileName.Text;

                // Get File Name
                if (fileName.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                string pdf = "";

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                pdf = WSCReports.rptBeet1099.ReportPackager(cropYear, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }
                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #11
0
        protected void btnOverrideDelete_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnOverrideDelete_Click";

            try {
                // First walk thru all business rules.
                if (grdContract.SelectedRow == null)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract to Delete from the grid.");
                    throw (warn);
                }

                int    cropYear         = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                int    directDeliveryID = Convert.ToInt32(grdContract.SelectedRow.Cells[(int)GrdContractCols.colDirectDeliveryID].Text);
                int    contractID       = Convert.ToInt32(grdContract.SelectedRow.Cells[(int)GrdContractCols.colContractID].Text);
                string rowVersion       = grdContract.SelectedRow.Cells[(int)GrdContractCols.colRowVersion].Text;

                // Delete it !
                BeetDirectDelivery.DirectDeliveryContractDelete(directDeliveryID, cropYear, contractID, rowVersion);

                ResetContractEdit();
                FillContractList();
                FillGridContract();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogoIconOnly());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                string fromDateTest = txtFromDate.Text;
                if (fromDateTest.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a From Date.");
                    throw (warn);
                }
                DateTime fromDate;
                try {
                    fromDate = Convert.ToDateTime(fromDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid From Date.");
                    throw (warn);
                }

                string toDateTest = txtToDate.Text;
                if (toDateTest.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a To Date.");
                    throw (warn);
                }
                DateTime toDate;
                try {
                    toDate = Convert.ToDateTime(toDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid To Date.");
                    throw (warn);
                }

                string shid = txtShid.Text;

                string pdf = WSCReports.rptDirectDeliveryStatement.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate,
                                                                                  shid, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogoIconOnly());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string cropYear = ((MasterReportTemplate)Master).CropYear;

                string fromDateTest = txtFromDate.Text;
                if (fromDateTest.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a From Date.");
                    throw (warn);
                }
                DateTime fromDate;
                try {
                    fromDate = Convert.ToDateTime(fromDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid From Date.");
                    throw (warn);
                }

                string toDateTest = txtToDate.Text;
                if (toDateTest.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a To Date.");
                    throw (warn);
                }
                DateTime toDate;
                try {
                    toDate = Convert.ToDateTime(toDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid To Date.");
                    throw (warn);
                }

                string shid = txtShid.Text;

                string pdf = WSCReports.rptDirectDeliveryStatement.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate,
                    shid, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #14
0
        protected void btnCalculate_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnCalculate_Click";

            try {
                Decimal qcBeetPaymentPerTon = 0, oldNorthBeetPaymentPerTon = 0, oldSouthBeetPaymentPerTon = 0;
                string  sugarContent, slmPct, netReturn;
                int     cropYear = Convert.ToInt32(ddlCropYear.SelectedItem.Text);

                sugarContent = txtSugarContent.Text;
                if (sugarContent.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a Sugar Content.");
                    throw (warn);
                }
                if (!Common.CodeLib.IsNumeric(sugarContent))
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for Sugar Content, like 16.54.");
                    throw (warn);
                }
                slmPct = txtSLM.Text;
                if (slmPct.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a SLM value.");
                    throw (warn);
                }
                if (!Common.CodeLib.IsNumeric(slmPct))
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for SLM, like 1.60.");
                    throw (warn);
                }
                netReturn = txtNetReturn.Text;
                if (netReturn.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a Net Return.");
                    throw (warn);
                }
                if (!Common.CodeLib.IsNumeric(netReturn))
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for Net Return, like 24.55.");
                    throw (warn);
                }

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    WSCPayment.CalculatePayment(conn, Convert.ToDecimal(sugarContent),
                                                Convert.ToDecimal(slmPct),
                                                Convert.ToDecimal(netReturn), cropYear, ref qcBeetPaymentPerTon,
                                                ref oldNorthBeetPaymentPerTon, ref oldSouthBeetPaymentPerTon);

                    lblQCPayment.Text = "$" + qcBeetPaymentPerTon.ToString();
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                // Minimally you must at least pick a factory
                if (_factoryList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must select at least one Factory");
                    throw (warn);
                }

                // Must enter a valid from date
                string   fromDateTemp = txtFromDate.Text;
                DateTime fromDate;
                if (String.IsNullOrEmpty(fromDateTemp) || !DateTime.TryParse(fromDateTemp, out fromDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid From Date.");
                    throw (warn);
                }

                string   toDateTemp = txtToDate.Text;
                DateTime toDate;
                if (String.IsNullOrEmpty(toDateTemp) || !DateTime.TryParse(toDateTemp, out toDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid To Date.");
                    throw (warn);
                }

                bool isPosted   = chkPosted.Checked;
                bool isPreview  = chkPreview.Checked;
                bool isHardCopy = chkWebHardCopyOnly.Checked;
                bool isEmail    = chkEmail.Checked;
                bool isFax      = false;        //	chkFax.Checked;

                string pdf = WSCReports.rptDailyGrowerTareDetailMaster.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate, _factoryList,
                                                                                      _stationList, _contractList, isPosted, isPreview, isHardCopy, isEmail, isFax, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #16
0
        protected void btnCalculate_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnCalculate_Click";

            try {

                Decimal qcBeetPaymentPerTon = 0, oldNorthBeetPaymentPerTon = 0, oldSouthBeetPaymentPerTon = 0;
                string sugarContent, slmPct, netReturn;
                int cropYear = Convert.ToInt32(ddlCropYear.SelectedItem.Text);

                sugarContent = txtSugarContent.Text;
                if (sugarContent.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a Sugar Content.");
                    throw (warn);
                }
                if (!Common.CodeLib.IsNumeric(sugarContent)) {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for Sugar Content, like 16.54.");
                    throw (warn);
                }
                slmPct = txtSLM.Text;
                if (slmPct.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a SLM value.");
                    throw (warn);
                }
                if (!Common.CodeLib.IsNumeric(slmPct)) {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for SLM, like 1.60.");
                    throw (warn);
                }
                netReturn = txtNetReturn.Text;
                if (netReturn.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a Net Return.");
                    throw (warn);
                }
                if (!Common.CodeLib.IsNumeric(netReturn)) {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for Net Return, like 24.55.");
                    throw (warn);
                }

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {

                    WSCPayment.CalculatePayment(conn, Convert.ToDecimal(sugarContent),
                        Convert.ToDecimal(slmPct),
                        Convert.ToDecimal(netReturn), cropYear, ref qcBeetPaymentPerTon,
                        ref oldNorthBeetPaymentPerTon, ref oldSouthBeetPaymentPerTon);

                    lblQCPayment.Text = "$" + qcBeetPaymentPerTon.ToString();
                }

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #17
0
        protected void btnChange_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnChange_Click";

            try {
                // Did page load already throw an error?
                if (((HtmlGenericControl)Master.FindControl("divWarning")).InnerHtml.Length > 0)
                {
                    return;
                }

                if (SHID.ToString() != txtSHID.Text)
                {
                    Common.CWarning wex = new Common.CWarning("Please press the Find button to ensure you're editing the correct Shareholder before trying to Save.");
                    throw (wex);
                }

                if (SHID == 0)
                {
                    Common.CWarning wex = new Common.CWarning("Please enter a SHID and press the Find button.");
                    throw (wex);
                }

                WSCSecurity auth = Globals.SecurityState;
                if (auth.AuthorizeShid(SHID, CropYear) < WSCSecurity.ShsPermission.shsReadWrite)
                {
                    Common.CWarning warn = new Common.CWarning("Sorry, you are not authorized to update this information");
                    throw (warn);
                }

                if (EmailAddress.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please create an email address for this member.");
                    throw (warn);
                }

                string warnMsg = null;
                WSCMember.ResetPassword(SHID.ToString(), EmailAddress, ref warnMsg);
                if (warnMsg == null)
                {
                    Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Password has been reset and sent to you via email.");
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning(warnMsg);
                    throw (warn);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #18
0
        protected void btnDirectDeliveryAdd_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnDirectDeliveryAdd_Click";

            try {
                string userName         = Common.AppHelper.GetIdentityName();
                int    cropYear         = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                int    directDeliveryID = 0;
                string rowVersion       = "";

                // Get the delivery station
                if (ddlEditDeliveryStation.SelectedItem == null)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Delivery Station in the Direct Delivery Edit area.");
                    throw (warn);
                }
                int deliveryStationNumber = Convert.ToInt32(ddlEditDeliveryStation.SelectedItem.Value);

                // Get the cotnract station
                if (ddlEditContractStation.SelectedItem == null)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract Station in the Direct Delivery Edit area.");
                    throw (warn);
                }
                int contractStationNumber = Convert.ToInt32(ddlEditContractStation.SelectedItem.Value);

                // Get the rate per ton.  Rate is not required, but if given it must be a decimal
                string  ratePerTonText = txtEditRatePerTon.Text;
                decimal dRatePerTon    = 0;
                if (ratePerTonText.Length > 0)
                {
                    try {
                        dRatePerTon = Convert.ToDecimal(ratePerTonText);
                    }
                    catch {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid dollar amount for the Rate Per Ton.");
                        throw (warn);
                    }
                }

                // Save it !
                BeetDirectDelivery.DirectDeliverySave(directDeliveryID, cropYear, contractStationNumber, deliveryStationNumber, dRatePerTon, rowVersion, userName);

                ResetDirectDeliveryEdit();
                ResetContractEdit();
                FillGridDirectDelivery();
                FillContractList();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #19
0
        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", "CheckDelete(event);");

                if (!Page.IsPostBack)
                {
                    FillDomainData();
                }
                else
                {
                    // =====================================
                    // Take ACTION: perform prep work here.
                    // =====================================
                    string action = txtAction.Text;
                    txtAction.Text = "";

                    switch (action)
                    {
                    case "FindBank":

                        // Check for bank id
                        if (txtBankID.Text.Length > 0)
                        {
                            if (txtBankID.Text.Length > 0)
                            {
                                try {
                                    Int32 tmp = Int32.Parse(txtBankID.Text);
                                }
                                catch {
                                    Common.CWarning warn = new Common.CWarning("You did not enter a reasonable bank number.");
                                    throw (warn);
                                }
                            }
                            int bankID = Convert.ToInt32(txtBankID.Text);
                            txtBankID.Text = "";

                            ShowBankDetail(bankID);
                        }
                        break;
                    }
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #20
0
        protected void btnDirectDeliveryAdd_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnDirectDeliveryAdd_Click";
            try {

                string userName = Common.AppHelper.GetIdentityName();
                int cropYear = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                int directDeliveryID = 0;
                string rowVersion = "";

                // Get the delivery station
                if (ddlEditDeliveryStation.SelectedItem == null) {
                    Common.CWarning warn = new Common.CWarning("Please select a Delivery Station in the Direct Delivery Edit area.");
                    throw (warn);
                }
                int deliveryStationNumber = Convert.ToInt32(ddlEditDeliveryStation.SelectedItem.Value);

                // Get the cotnract station
                if (ddlEditContractStation.SelectedItem == null) {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract Station in the Direct Delivery Edit area.");
                    throw (warn);
                }
                int contractStationNumber = Convert.ToInt32(ddlEditContractStation.SelectedItem.Value);

                // Get the rate per ton.  Rate is not required, but if given it must be a decimal
                string ratePerTonText = txtEditRatePerTon.Text;
                decimal dRatePerTon = 0;
                if (ratePerTonText.Length > 0) {
                    try {
                        dRatePerTon = Convert.ToDecimal(ratePerTonText);
                    }
                    catch {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid dollar amount for the Rate Per Ton.");
                        throw (warn);
                    }
                }

                // Save it !
                BeetDirectDelivery.DirectDeliverySave(directDeliveryID, cropYear, contractStationNumber, deliveryStationNumber, dRatePerTon, rowVersion, userName);

                ResetDirectDeliveryEdit();
                ResetContractEdit();
                FillGridDirectDelivery();
                FillContractList();

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #21
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                string shid          = ((HarvestReportTemplate)Master).TextShid;
                string logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName      = shid + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                int cropYear = 0;
                int calYear  = 0;
                if (radCalYear.Checked)
                {
                    calYear = Convert.ToInt32(ddlYear.Text);
                }
                else
                {
                    cropYear = Convert.ToInt32(ddlYear.Text);
                }

                int iShid = 0;
                if (!int.TryParse(shid, out iShid))
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for the SHID.  Enter a specific SHID or 0 to return all shareholders.");
                    throw(warn);
                }

                string pdf = WSCReports.rptBeetPaymentBreakdown.ReportPackager(iShid, Convert.ToInt32(cropYear), calYear, fileName, logoUrl, pdfTempFolder);
                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            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);
                }
            }
        }
Пример #22
0
        protected override void OnPreRender(EventArgs e)
        {
            try {
                if (!_isErrorState)
                {
                    if (MemberID == 0)
                    {
                        Common.CWarning warn = new Common.CWarning("Enter a valid SHID and press the Find button.");
                        throw (warn);
                    }
                    else
                    {
                        string warnMsg = "";
                        if (ContractNumber == 0)
                        {
                            warnMsg = "You need to add a contract before editing Field Contracting information";
                        }
                        else
                        {
                            if (_eventWarningMsg.Length > 0)
                            {
                                warnMsg = _eventWarningMsg;
                            }
                            else
                            {
                                if (SequenceNumberMax == 0)
                                {
                                    warnMsg = "You need to add a field to this contract before editing Field Contracting information";
                                }
                            }
                        }

                        if (warnMsg.Length > 0)
                        {
                            Common.CWarning warn = new WSCIEMP.Common.CWarning(warnMsg);
                            throw (warn);
                        }
                    }
                }
            }
            catch (Exception ex) {
                // Raise event to container
                Common.CErrorEventArgs args = new Common.CErrorEventArgs(ex);
                OnExceptionShow(args);
            }

            base.OnPreRender(e);
        }
Пример #23
0
        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);
            }
        }
Пример #24
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = txtCcFileName.Text;

                // Check required fields: crop year, start #, stop #, file name.
                string contractNumberStart = txtCcContractNumberStart.Text;
                if (contractNumberStart.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter the First Contract Number.");
                    throw (warn);
                }
                string contractNumberStop = txtCcContractNumberStop.Text;
                if (contractNumberStop.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter the Last Contract Number.");
                    throw (warn);
                }
                if (fileName.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                string pdf      = WSCReports.rptContractCards.ReportPackager(cropYear, contractNumberStart, contractNumberStop, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #25
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                int    memberID     = ((HarvestReportTemplate)Master).MemberID;
                string cropYear     = ((HarvestReportTemplate)Master).CropYear;
                int    shid         = ((HarvestReportTemplate)Master).SHID;
                string busName      = ((HarvestReportTemplate)Master).BusName;
                string deliveryDate = Common.UILib.GetListText(lstDdsDeliveryDay, ",");

                if (shid == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a SHID.");
                    throw (warn);
                }

                if (deliveryDate.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Delivery Date.");
                    throw (warn);
                }

                string pdf = WSCReports.rptDeliveryByDaySummary.ReportPackager(Convert.ToInt32(cropYear), memberID, shid,
                                                                               busName, deliveryDate, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";

            try {
                Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));
                _shs = Globals.ShsData;

                HtmlGenericControl body = (HtmlGenericControl)this.Master.FindControl("MasterBody");
                body.Attributes.Add("onload", "DoOnLoad();");

                locPDF.Text = "";
                ShowHideFrames();

                if (!Page.IsPostBack)
                {
                    FillCropYear();
                    FindAddress(_shs.SHID);
                    InitShareholder();

                    if (MemberID > 0)
                    {
                        FillFieldGrid();
                        FillFieldLabResults();
                        FillOtherLabResults();
                    }
                    else
                    {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid SHID and press the Find button.");
                        throw (warn);
                    }
                }

                _busName = lblBusName.Text;
                if (ddlCropYear.SelectedIndex != -1)
                {
                    CropYear = Convert.ToInt32(ddlCropYear.SelectedValue);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #27
0
        protected void btnOverrideUpdate_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnOverrideUpdate_Click";

            try {
                // First walk thru all business rules.
                if (grdContract.SelectedRow == null)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract to edit.");
                    throw (warn);
                }

                string userName         = Common.AppHelper.GetIdentityName();
                int    cropYear         = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                int    directDeliveryID = Convert.ToInt32(grdContract.SelectedRow.Cells[(int)GrdContractCols.colDirectDeliveryID].Text);
                int    contractID       = Convert.ToInt32(grdContract.SelectedRow.Cells[(int)GrdContractCols.colContractID].Text);
                string rowVersion       = grdContract.SelectedRow.Cells[(int)GrdContractCols.colRowVersion].Text;

                // Get the rate per ton.  Rate is not required, but if given it must be a decimal
                string  ratePerTonText = txtEditContractRatePerTon.Text;
                decimal dRatePerTon    = 0;
                if (ratePerTonText.Length > 0)
                {
                    try {
                        dRatePerTon = Convert.ToDecimal(ratePerTonText);
                    }
                    catch {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid dollar amount for the Contract Rate Per Ton.");
                        throw (warn);
                    }
                }

                // Save it !
                BeetDirectDelivery.DirectDeliveryContractSave(directDeliveryID, cropYear, contractID, dRatePerTon, rowVersion, userName);

                ResetContractEdit();
                FillContractList();
                FillGridContract();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #28
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                string statementDate = txtStatementDate.Text.Trim();
                string shid          = txtPsSHID.Text;
                string fromShid      = txtPsFromSHID.Text;
                string toShid        = txtPsToSHID.Text;
                string footerText    = rptParam_Footer.Value;

                string paymentDesc = Common.UILib.GetDropDownText(ddlPsPaymentDesc);
                if (paymentDesc.StartsWith("None"))
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment having a Payment Date.");
                    throw (warn);
                }

                int  paymentID    = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlPsPaymentDesc));
                bool isCumulative = chkPsIsPaymentSummaryCumulative.Checked;

                string pdf = WSCReports.rptPaymentSummary.ReportPackager(Convert.ToInt32(cropYear), statementDate, shid, fromShid, toShid,
                                                                         paymentID, isCumulative, footerText, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #29
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                bool   isCumulative = chkGtIsTransmittalCumulative.Checked;
                string paymentDesc  = Common.UILib.GetDropDownText(ddlGtPaymentDesc);
                if (paymentDesc.StartsWith("None"))
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment other than 'None Available'.");
                    throw (warn);
                }
                int paymentNumber = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlGtPaymentDesc));

                string contractList = Common.UILib.GetListText(lstGtContract, ",");
                if (contractList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract.");
                    throw (warn);
                }

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                string pdf      = WSCReports.rptGroTransmittal.ReportPackager(Convert.ToInt32(cropYear), paymentNumber, paymentDesc, null, null,
                                                                              null, "", "", contractList, isCumulative, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #30
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string cropYear = ((MasterReportTemplate)Master).CropYear;

                string statementDate = txtStatementDate.Text.Trim();
                string shid = txtPsSHID.Text;
                string fromShid = txtPsFromSHID.Text;
                string toShid = txtPsToSHID.Text;
                string footerText = rptParam_Footer.Value;

                string paymentDesc = Common.UILib.GetDropDownText(ddlPsPaymentDesc);
                if (paymentDesc.StartsWith("None")) {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment having a Payment Date.");
                    throw (warn);
                }

                int paymentID = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlPsPaymentDesc));
                bool isCumulative = chkPsIsPaymentSummaryCumulative.Checked;

                string pdf = WSCReports.rptPaymentSummary.ReportPackager(Convert.ToInt32(cropYear), statementDate, shid, fromShid, toShid,
                    paymentID, isCumulative, footerText, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #31
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                string cropYear = ((HarvestReportTemplate)Master).CropYear;

                int shid = ((HarvestReportTemplate)Master).SHID;
                if (shid == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must first Find a SHID.");
                    throw (warn);
                }

                string contractList = Common.UILib.GetListText(lstTtcContract, ",");
                if (contractList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must first select a contract.");
                    throw (warn);
                }

                bool   isCSV = radTtcPrintCSV.Checked;
                string pdf   = WSCReports.rptTonsByTruckByContract.ReportPackager(Convert.ToInt32(cropYear), shid, contractList.Replace(" ", ""), isCSV, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #32
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = txtCcFileName.Text;

                // Check required fields: crop year, start #, stop #, file name.
                string contractNumberStart = txtCcContractNumberStart.Text;
                if (contractNumberStart.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter the First Contract Number.");
                    throw (warn);
                }
                string contractNumberStop = txtCcContractNumberStop.Text;
                if (contractNumberStop.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter the Last Contract Number.");
                    throw (warn);
                }
                if (fileName.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                string pdf = WSCReports.rptContractCards.ReportPackager(cropYear, contractNumberStart, contractNumberStop, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #33
0
        private void FillForm()
        {
            const string METHOD_NAME = "FillForm";

            try {
                ClearForm();

                int cropYear = Convert.ToInt32(((MasterReportTemplate)Master).CropYear);

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCAdmin.PassthroughAllGetByYear(conn, cropYear)) {
                        if (dr.Read())
                        {
                            int iFiscalYear   = dr.GetOrdinal("pssaFiscalYearEndDate");
                            int iPercentApply = dr.GetOrdinal("pssaPercentageToApply");
                            int iRatePerTon   = dr.GetOrdinal("pssaRatePerTon");
                            int iReportDate   = dr.GetOrdinal("pssaReportDate");
                            int iTaxYear      = dr.GetOrdinal("pssaTaxYear");

                            // Copy values into form
                            txtCropYear.Text          = cropYear.ToString();
                            txtFiscalYearEndDate.Text = dr.GetString(iFiscalYear);
                            txtPctToApply.Text        = dr.GetDecimal(iPercentApply).ToString("N3");
                            txtRatePerTon.Text        = dr.GetDecimal(iRatePerTon).ToString("N6");
                            txtReportDate.Text        = dr.GetString(iReportDate);
                            txtTaxYear.Text           = dr.GetInt32(iTaxYear).ToString();
                        }
                        else
                        {
                            Common.CWarning warn = new Common.CWarning(@"Before Printing you *MUST* set Coop values in Ag Admin\Passthrough Management for Crop Year "
                                                                       + cropYear.ToString());
                            throw(warn);
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Пример #34
0
        // ===============================================
        // ** Address Finder Helper Routines.
        // ===============================================
        protected void btnResolveShid_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnResolveShid_Click";

            try {
                string shid = txtSHID.Text;
                if (Common.CodeLib.IsValidSHID(shid))
                {
                    int iShid = Convert.ToInt32(shid);

                    ClearBankDetail();
                    ClearEquityBankDetail();
                    ShowSHIDDetail(iShid, 0);

                    // Show any related bank details
                    int addressID = 0;
                    if (txtAddressID.Text.Length > 0)
                    {
                        addressID = Convert.ToInt32(txtAddressID.Text);
                    }

                    int memberID = 0;
                    if (txtMemberID.Text.Length > 0)
                    {
                        memberID = Convert.ToInt32(txtMemberID.Text);
                    }

                    ShowBankPayeeList(addressID, _cropYear);
                    ShowBankEquityList(memberID, _cropYear);
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid SHID.");
                    throw (warn);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #35
0
        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);
            }
        }
Пример #36
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                bool isCumulative = chkGtIsTransmittalCumulative.Checked;
                string paymentDesc = Common.UILib.GetDropDownText(ddlGtPaymentDesc);
                if (paymentDesc.StartsWith("None")) {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment other than 'None Available'.");
                    throw (warn);
                }
                int paymentNumber = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlGtPaymentDesc));

                string contractList = Common.UILib.GetListText(lstGtContract, ",");
                if (contractList.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract.");
                    throw (warn);
                }

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                string pdf = WSCReports.rptGroTransmittal.ReportPackager(Convert.ToInt32(cropYear), paymentNumber, paymentDesc, null, null,
                    null, "", "", contractList, isCumulative, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #37
0
        protected void btnCloseStatus_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnCloseStatus_Click";

            try {
                GridViewRow row  = grdResult.SelectedRow;
                string      path = row.Cells[Convert.ToInt32(ErrorResultColumn.errColPath)].Text;

                if (Common.CodeLib.IsNumeric(path))
                {
                    int      appErrorInfoID = Convert.ToInt32(path);
                    string   appName        = Common.UILib.GetDropDownText(ddlEditApplication);
                    string   severity       = Common.UILib.GetDropDownText(ddlEditSeverity);
                    DateTime errorDate      = Convert.ToDateTime(row.Cells[Convert.ToInt32(ErrorResultColumn.errColDate)].Text);
                    string   errorStatus    = "Closed";
                    string   errorAction    = txtEditAction.Text;
                    string   errorCode      = txtEditErrorCode.Text;
                    string   errorText      = txtErrorText.Text;
                    string   loginServer    = txtEditServer.Text;
                    string   loginClient    = txtEditClient.Text;
                    string   loginUser      = txtEditUser.Text;
                    string   userName       = Common.AppHelper.GetIdentityName();

                    AppError.AppErrorFileSave(appErrorInfoID, appName, severity, errorDate, errorStatus, errorAction,
                                              loginServer, loginClient, loginUser, errorCode, userName, errorText);
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("You cannot set the status of a file based error.  You need to first Import this error.");
                    throw (warn);
                }

                ClearEditValues();
                FillResultsGrid();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                string cropYear = ((HarvestReportTemplate)Master).CropYear;

                int shid = ((HarvestReportTemplate)Master).SHID;
                if (shid == 0) {
                    Common.CWarning warn = new Common.CWarning("You must first Find a SHID.");
                    throw (warn);
                }

                string contractList = Common.UILib.GetListText(lstTtcContract, ",");
                if (contractList.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("You must first select a contract.");
                    throw (warn);
                }

                bool isCSV = radTtcPrintCSV.Checked;
                string pdf = WSCReports.rptTonsByTruckByContract.ReportPackager(Convert.ToInt32(cropYear), shid, contractList.Replace(" ", ""), isCSV, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #39
0
        protected void btnCloseStatus_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnCloseStatus_Click";

            try {

                GridViewRow row = grdResult.SelectedRow;
                string path = row.Cells[Convert.ToInt32(ErrorResultColumn.errColPath)].Text;

                if (Common.CodeLib.IsNumeric(path)) {

                    int appErrorInfoID = Convert.ToInt32(path);
                    string appName = Common.UILib.GetDropDownText(ddlEditApplication);
                    string severity = Common.UILib.GetDropDownText(ddlEditSeverity);
                    DateTime errorDate = Convert.ToDateTime(row.Cells[Convert.ToInt32(ErrorResultColumn.errColDate)].Text);
                    string errorStatus = "Closed";
                    string errorAction = txtEditAction.Text;
                    string errorCode = txtEditErrorCode.Text;
                    string errorText = txtErrorText.Text;
                    string loginServer = txtEditServer.Text;
                    string loginClient = txtEditClient.Text;
                    string loginUser = txtEditUser.Text;
                    string userName = Common.AppHelper.GetIdentityName();

                    AppError.AppErrorFileSave(appErrorInfoID, appName, severity, errorDate, errorStatus, errorAction,
                        loginServer, loginClient, loginUser, errorCode, userName, errorText);

                } else {
                    Common.CWarning warn = new Common.CWarning("You cannot set the status of a file based error.  You need to first Import this error.");
                    throw (warn);
                }

                ClearEditValues();
                FillResultsGrid();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #40
0
        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);
            }
        }
Пример #41
0
        private void FindAddress()
        {
            try {
                int shid = 0;
                if (Common.CodeLib.IsValidSHID(txtSHID.Text))
                {
                    shid = Convert.ToInt32(txtSHID.Text);
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for the SHID.");
                    throw (warn);
                }

                FindAddress(shid);
            }
            catch (Exception ex) {
                // Raise event to container
                ContractSelectorEventArgs cntArg = new ContractSelectorEventArgs(ex);
                OnShareholderFind(cntArg);
            }
        }
Пример #42
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                RebuildDeliveryDates();

                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                int cropYear = Convert.ToInt32(((HarvestReportTemplate)Master).CropYear);

                string cntNo = Common.UILib.GetListText(lstDgtdContract, ",");
                if (cntNo.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please Choose a Contract.");
                    throw (warn);
                }
                int contractNumber = Convert.ToInt32(cntNo);

                string pdf = WSCReports.rptDailyGrowerTareDetail.ReportPackager(cropYear, contractNumber, _deliveryDates, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #43
0
        protected void btnAdrFind_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnAdrFind_Click";

            try {
                FindAddress();

                if (MemberID > 0)
                {
                    FillFieldGrid();
                    FillFieldLabResults();
                    FillOtherLabResults();
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid SHID and press the Find button.");
                    throw (warn);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #44
0
        protected void btnRemoveLab_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnRemoveLab_Click";

            try {
                if (grdFieldLabResults.SelectedRow == null)
                {
                    Common.CWarning warn = new Common.CWarning("You must first select a lab from the Field's Soil Sample Lab Results grid.");
                    throw (warn);
                }
                int soilSampleLabID = Convert.ToInt32(grdFieldLabResults.SelectedRow.Cells[0].Text.Replace(BLANK_CELL, ""));

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    WSCField.FieldSampleLabRemove(conn, 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 DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                RebuildDeliveryDates();

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                int cropYear = Convert.ToInt32(((HarvestReportTemplate)Master).CropYear);

                string cntNo = Common.UILib.GetListText(lstDgtdContract, ",");
                if (cntNo.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please Choose a Contract.");
                    throw (warn);
                }
                int contractNumber = Convert.ToInt32(cntNo);

                string pdf = WSCReports.rptDailyGrowerTareDetail.ReportPackager(cropYear, contractNumber, _deliveryDates, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #46
0
        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", "CheckDelete(event);");

                if (!Page.IsPostBack) {
                    FillDomainData();
                } else {

                    // =====================================
                    // Take ACTION: perform prep work here.
                    // =====================================
                    string action = txtAction.Text;
                    txtAction.Text = "";

                    switch (action) {

                        case "FindBank":

                            // Check for bank id
                            if (txtBankID.Text.Length > 0) {

                                if (txtBankID.Text.Length > 0) {
                                    try {
                                        Int32 tmp = Int32.Parse(txtBankID.Text);
                                    }
                                    catch {
                                        Common.CWarning warn = new Common.CWarning("You did not enter a reasonable bank number.");
                                        throw (warn);
                                    }
                                }
                                int bankID = Convert.ToInt32(txtBankID.Text);
                                txtBankID.Text = "";

                                ShowBankDetail(bankID);

                            }
                            break;
                    }
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                // ------------------------------------------------------------------------
                // We need BOTH the url path and file system path to the payment file.
                // ------------------------------------------------------------------------
                string cropYear = ((MasterReportTemplate)Master).CropYear;
                string paymentDesc = Common.UILib.GetDropDownText(ddlPaymentNumber);
                string fileName = cropYear.ToString() + " Payment " + paymentDesc + ".csv";
                string urlPath = WSCReportsExec.GetPDFFolderPath() + @"/" + fileName;
                string filePath = Page.MapPath(urlPath);

                string fromDateTest = txtFromDate.Text;
                if (fromDateTest.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a From Date.");
                    throw (warn);
                }
                DateTime fromDate;
                try {
                    fromDate = Convert.ToDateTime(fromDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid From Date.");
                    throw (warn);
                }

                string toDateTest = txtToDate.Text;
                if (toDateTest.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please enter a To Date.");
                    throw (warn);
                }
                DateTime toDate;
                try {
                    toDate = Convert.ToDateTime(toDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid To Date.");
                    throw (warn);
                }

                int paymentDescID = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlPaymentNumber));

                string warnMsg;
                WSCReports.rptDirectDeliveryExport.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate, paymentDescID, filePath, out warnMsg);

                if (warnMsg.Length > 0) {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), warnMsg);
                }

                lnkPaymentFile.Visible = true;
                lnkPaymentFile.NavigateUrl = urlPath;
                lnkPaymentFile.Text = "Click Here to Open Your Export Payment File";
                Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Payment Export Complete!");

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #48
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";

            try {

                Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));
                _shs = Globals.ShsData;

                HtmlGenericControl body = (HtmlGenericControl)this.Master.FindControl("MasterBody");
                body.Attributes.Add("onload", "DoOnLoad();");

                locPDF.Text = "";
                ShowHideFrames();

                if (!Page.IsPostBack) {

                    FillCropYear();
                    FindAddress(_shs.SHID);
                    InitShareholder();

                    if (MemberID > 0) {

                        FillFieldGrid();
                        FillFieldLabResults();
                        FillOtherLabResults();

                    } else {

                        Common.CWarning warn = new Common.CWarning("Please enter a valid SHID and press the Find button.");
                        throw (warn);
                    }
                }

                _busName = lblBusName.Text;
                if (ddlCropYear.SelectedIndex != -1) {
                    CropYear = Convert.ToInt32(ddlCropYear.SelectedValue);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #49
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnSave_Click";

            try {

                string sDate = txtDate.Text;
                if (sDate.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please select a Date");
                    throw (warn);
                }
                DateTime rehaulDate = Convert.ToDateTime(sDate);
                if (rehaulDate < DateTime.Now.AddYears(-1)) {
                    Common.CWarning warn = new Common.CWarning("You can only change data within a year of today.");
                    throw (warn);
                }

                string factoryNumber = Common.UILib.GetDropDownValue(ddlFactory);

                // Get non-Station items
                string chipsPctTailings = txtChipsPctTailings.Text;
                if (chipsPctTailings.Length > 0 && !Common.CodeLib.IsNumeric(chipsPctTailings)) {
                    Common.CWarning warn = new Common.CWarning("Chips Percent Tailings must be entered as a number.");
                    throw (warn);
                }

                string rehaulLoadAvgWt = txtRehaulAvgWt.Text;
                if (rehaulLoadAvgWt.Length > 0 && !Common.CodeLib.IsNumeric(rehaulLoadAvgWt)) {
                    Common.CWarning warn = new Common.CWarning("Re-haul Load Average Weight must be entered as a number.");
                    throw (warn);
                }

                string yardLoadAvgWt = txtYardAvgWt.Text;
                if (yardLoadAvgWt.Length > 0 && !Common.CodeLib.IsNumeric(yardLoadAvgWt)) {
                    Common.CWarning warn = new Common.CWarning("Yard Load Average Weight must be entered as a number.");
                    throw (warn);
                }

                string chipsDiscardedTons = txtChipsDiscarded.Text;
                if (chipsDiscardedTons.Length > 0 && !Common.CodeLib.IsNumeric(chipsDiscardedTons)) {
                    Common.CWarning warn = new Common.CWarning("Chips Discarded (tons) must be entered as a number.");
                    throw (warn);
                }

                string beetsSlidLoads = txtBeetsSlidLoads.Text;
                if (beetsSlidLoads.Length > 0 && !Common.CodeLib.IsNumeric(beetsSlidLoads)) {
                    Common.CWarning warn = new Common.CWarning("Beets Slid Loads must be entered as a number.");
                    throw (warn);
                }

                // Get Station items
                string stationNumberList = "";
                string rehaulLoadList = "";
                for (int i = 0; i < rptrStations.Items.Count; i++) {

                    RepeaterItem ri = rptrStations.Items[i];
                    string rehaulLoads = ((TextBox)ri.FindControl("txtRehaulLoads")).Text;
                    string stationName = ((Label)ri.FindControl("lblStationName")).Text;
                    string stationNumber = stationName.Substring(0, 2);

                    if (rehaulLoads.Length > 0 && !Common.CodeLib.IsNumeric(rehaulLoads)) {
                        Common.CWarning warn = new Common.CWarning("Re-haul Loads for Station," + stationName + " , must be entered as a number.");
                        throw (warn);
                    }

                    if (rehaulLoads.Length > 0) {

                        try {
                            if (Convert.ToInt32(rehaulLoads) > 0) {
                                stationNumberList += Convert.ToInt32(stationNumber).ToString() + ",";
                                rehaulLoadList += rehaulLoads + ",";
                            }
                        }
                        catch {
                            Common.CWarning warn = new Common.CWarning("Re-haul Loads for Station," + stationName +
                                " , must be entered as a whole number and not as " + rehaulLoads.ToString() + ".");
                            throw (warn);
                        }
                    }
                }

                if (stationNumberList.Length > 0) {
                    stationNumberList = stationNumberList.Substring(0, stationNumberList.Length - 1);
                    rehaulLoadList = rehaulLoadList.Substring(0, rehaulLoadList.Length - 1);
                }

                int cropYear = 0;
                if (rehaulDate.Month <= 6) {
                    cropYear = rehaulDate.Year - 1;
                } else {
                    cropYear = rehaulDate.Year;
                }

                int factoryID = Convert.ToInt32(factoryNumber) / 10;

                LimsEx.RehaulDailySave(cropYear, factoryID, rehaulDate, chipsPctTailings, rehaulLoadAvgWt, yardLoadAvgWt, chipsDiscardedTons, beetsSlidLoads,
                    stationNumberList, rehaulLoadList);

                Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Your edits were successfully saved.");

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #50
0
        protected void btnAdrFind_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnAdrFind_Click";

            try {

                FindAddress();

                if (MemberID > 0) {
                    FillFieldGrid();
                    FillFieldLabResults();
                    FillOtherLabResults();
                } else {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid SHID and press the Find button.");
                    throw (warn);
                }

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #51
0
        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);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnSave_Click";

            try {

                int currentCropYear = Convert.ToInt32(WSCField.GetCropYears()[0].ToString());

                if (currentCropYear != CropYear) {
                    Common.CWarning wex = new Common.CWarning("Sorry, you cannot update information for a prior crop year.");
                    throw (wex);
                }

                if (!Common.CodeLib.IsValidSHID(txtSHID.Text)) {
                    Common.CWarning wex = new Common.CWarning("Please enter a valid SHID.");
                    throw (wex);
                }

                if (SHID.ToString() != txtSHID.Text) {
                    Common.CWarning wex = new Common.CWarning("Please press the Find button to ensure you're editing the correct Shareholder before trying to Save.");
                    throw (wex);
                }

                if (SHID == 0) {
                    Common.CWarning wex = new Common.CWarning("Please enter a SHID and press the Find button.");
                    throw (wex);
                }

                WSCSecurity auth = Globals.SecurityState;
                if (auth.AuthorizeShid(SHID, CropYear) < WSCSecurity.ShsPermission.shsReadWrite) {

                    Common.CWarning wex = new Common.CWarning("Sorry, you are not authorized to update this information");
                    throw (wex);
                }

                // Validate Email or fax when needed.
                string sendRptOption = GetSendRptOption();

                if (txtEmail.Text.Length > 0 || sendRptOption == SEND_RPT_OPT_EMAIL) {

                    if (!Common.CodeLib.ValidateEmail(txtEmail.Text)) {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Please enter the information in the correct format");
                        Common.AppHelper.ShowWarning(lblEmail, "Required to receive reports by email.");
                        return;
                    }
                }

                if (txtFax.Text.Length > 0 || sendRptOption == SEND_RPT_OPT_FAX) {

                    if (!Common.CodeLib.ValidateFax(txtFax.Text)) {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Please enter the information in the correct format");
                        Common.AppHelper.ShowWarning(lblFax, "Required to receive reports by fax.");
                        return;
                    }
                }

                try {

                    WSCMember.UpdateSendRptOption(MemberID, sendRptOption);
                    Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Your changes have been successfully updated!");
                }
                catch (System.Exception ex) {
                    if (Common.AppHelper.IsDebugBuild()) {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), ex);
                    } else {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Unable to save your changes at this time.", ex);
                        Common.AppHelper.LogException(ex, HttpContext.Current);
                    }
                    return;
                }

                try {

                    WSCMember.UpdateAddress(MemberID, txtEmail.Text, txtFax.Text, Globals.SecurityState.UserName);
                    Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Your changes have been successfully updated!");
                }
                catch (System.Exception ex) {
                    if (Common.AppHelper.IsDebugBuild()) {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), ex);
                    } else {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Unable to save your changes at this time.", ex);
                        Common.AppHelper.LogException(ex, HttpContext.Current);
                    }
                }

                if (((HtmlGenericControl)Master.FindControl("divWarning")).InnerHtml.Length == 0) {
                    Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Your information has been updated!");
                }
            }
            catch (Exception ex) {

                ResetShareholder();
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #53
0
        private void FillContractPerfGrid()
        {
            const string METHOD_NAME = "FillContractPerfGrid";
            const string DIV_STD_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: ";
            try {

                int shid = SHID;
                int cropYear = CropYear;
                string regionCode = "";
                string areaCode = "";
                int divHeight = 160;
                int growerPerformanceID = 0;
                string style = DIV_STD_STYLE;

                txtGrowerPerformanceID.Text = "";

                divPerfResultsEmpty.Attributes.Add("class", "DisplayOff");
                divPerfResultsEmpty.InnerHtml = "";

                if (grdRegionArea.SelectedRow != null) {
                    txtGrowerPerformanceID.Text = grdRegionArea.SelectedRow.Cells[0].Text;
                    growerPerformanceID = Convert.ToInt32(txtGrowerPerformanceID.Text);
                    regionCode = grdRegionArea.SelectedRow.Cells[1].Text;
                    areaCode = grdRegionArea.SelectedRow.Cells[2].Text;
                } else {

                    if (grdRegionArea.Rows.Count == 0) {

                        style += divHeight.ToString() + "px;";
                        divPerf.Attributes.Add("style", style);

                        Common.CWarning warn = new Common.CWarning("Please select a Crop Year that has harvest tons for this SHID.");
                        throw (warn);
                    }
                }

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {

                    ArrayList cntPerfs = WSCField.ShareholderSummaryContracts(conn, shid, cropYear, regionCode, areaCode);

                    // Do we have any valid data?  If not show warning.
                    if (cntPerfs.Count == 1) {

                        ContractPerformanceState perf = (ContractPerformanceState)cntPerfs[0];
                        if (perf.SHID == "") {

                            divPerfResultsEmpty.Attributes.Add("class", "WarnNoData");
                            divPerfResultsEmpty.InnerHtml = @"Please select a Region / Area from the above gird.";
                        }
                    } else {
                        divHeight += 17 * (cntPerfs.Count + 6);
                    }

                    style += divHeight.ToString() + "px;";
                    divPerf.Attributes.Add("style", style);

                    MakeCntPerfTable(cntPerfs);

                }
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Пример #54
0
        protected void btnChange_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnChange_Click";

            try {

                // Did page load already throw an error?
                if (((HtmlGenericControl)Master.FindControl("divWarning")).InnerHtml.Length > 0) {
                    return;
                }

                if (SHID.ToString() != txtSHID.Text) {
                    Common.CWarning wex = new Common.CWarning("Please press the Find button to ensure you're editing the correct Shareholder before trying to Save.");
                    throw (wex);
                }

                if (SHID == 0) {
                    Common.CWarning wex = new Common.CWarning("Please enter a SHID and press the Find button.");
                    throw (wex);
                }

                WSCSecurity auth = Globals.SecurityState;
                if (auth.AuthorizeShid(SHID, CropYear) < WSCSecurity.ShsPermission.shsReadWrite) {

                    Common.CWarning warn = new Common.CWarning("Sorry, you are not authorized to update this information");
                    throw (warn);
                }

                if (EmailAddress.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please create an email address for this member.");
                    throw (warn);
                }

                string warnMsg = null;
                WSCMember.ResetPassword(SHID.ToString(), EmailAddress, ref warnMsg);
                if (warnMsg == null) {
                    Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Password has been reset and sent to you via email.");
                } else {
                    Common.CWarning warn = new Common.CWarning(warnMsg);
                    throw (warn);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #55
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnSave_Click";

            try {

                string sGrowerPerformanceID = txtGrowerPerformanceID.Text;
                int growerPerformanceID = 0;

                if (sGrowerPerformanceID.Length == 0) {
                    Common.CWarning warn = new Common.CWarning("Please select a Region / Area from the top most grid.");
                    throw (warn);
                } else {
                    growerPerformanceID = Convert.ToInt32(sGrowerPerformanceID);
                }

                string sFertilityChoice = "";
                bool isFertilityOkay = chkFertilityOkay.Checked;
                bool isFertilityBad = chkFertilityBad.Checked;

                if (isFertilityOkay && isFertilityBad) {
                    Common.CWarning warn = new Common.CWarning("You cannot set Fertility to both Okay and Needs Improvement.");
                    throw (warn);
                }
                if (isFertilityOkay) {
                    sFertilityChoice = "Y";
                } else {
                    if (isFertilityBad) {
                        sFertilityChoice = "N";
                    }
                }

                string sIrrigationChoice = "";
                bool isIrrigationOkay = chkIrrigationOkay.Checked;
                bool isIrrigationBad = chkIrrigationBad.Checked;

                if (isIrrigationOkay && isIrrigationBad) {
                    Common.CWarning warn = new Common.CWarning("You cannot set Irrigation Water Management to both Okay and Needs Improvement.");
                    throw (warn);
                }
                if (isIrrigationOkay) {
                    sIrrigationChoice = "Y";
                } else {
                    if (isIrrigationBad) {
                        sIrrigationChoice = "N";
                    }
                }

                string sStandChoice = "";
                bool isStandOkay = chkStandOkay.Checked;
                bool isStandBad = chkStandBad.Checked;

                if (isStandOkay && isStandBad) {
                    Common.CWarning warn = new Common.CWarning("You cannot set Stand Establishment to both Okay and Needs Improvement.");
                    throw (warn);
                }
                if (isStandOkay) {
                    sStandChoice = "Y";
                } else {
                    if (isStandBad) {
                        sStandChoice = "N";
                    }
                }

                string sWeedChoice = "";
                bool isWeedOkay = chkWeedOkay.Checked;
                bool isWeedBad = chkWeedBad.Checked;

                if (isWeedOkay && isWeedBad) {
                    Common.CWarning warn = new Common.CWarning("You cannot set Weed Control to both Okay and Needs Improvement.");
                    throw (warn);
                }
                if (isWeedOkay) {
                    sWeedChoice = "Y";
                } else {
                    if (isWeedBad) {
                        sWeedChoice = "N";
                    }
                }

                string sDiseaseChoice = "";
                bool isDiseaseOkay = chkDiseaseOkay.Checked;
                bool isDiseaseBad = chkDiseaseBad.Checked;

                if (isDiseaseOkay && isDiseaseBad) {
                    Common.CWarning warn = new Common.CWarning("You cannot set Disease & Insect Control to both Okay and Needs Improvement.");
                    throw (warn);
                }
                if (isDiseaseOkay) {
                    sDiseaseChoice = "Y";
                } else {
                    if (isDiseaseBad) {
                        sDiseaseChoice = "N";
                    }
                }

                string sVarietyChoice = "";
                bool isVarietyOkay = chkVarietyOkay.Checked;
                bool isVarietyBad = chkVarietyBad.Checked;

                if (isVarietyOkay && isVarietyBad) {
                    Common.CWarning warn = new Common.CWarning("You cannot set Proper Variety Selection to both Okay and Needs Improvement.");
                    throw (warn);
                }
                if (isVarietyOkay) {
                    sVarietyChoice = "Y";
                } else {
                    if (isVarietyBad) {
                        sVarietyChoice = "N";
                    }
                }

                string sFertility = txtFertilityRec.Text;
                string sIrrigation = txtIrrigationRec.Text;
                string sStand = txtStandRec.Text;
                string sWeed = txtWeedRec.Text;
                string sDisease = txtDiseaseRec.Text;
                string sVariety = txtVarietyRec.Text;

                WSCSecurity auth = Globals.SecurityState;
                string userName = auth.UserName;

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    WSCField.GrowerAdviceSave(conn, growerPerformanceID, sFertilityChoice, sFertility,
                        sIrrigationChoice, sIrrigation, sStandChoice, sStand, sWeedChoice, sWeed, sDiseaseChoice, sDisease,
                        sVarietyChoice, sVariety, userName);
                }

                Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "** Edits Successfully Saved **");
                RefreshAfterUpdate();

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #56
0
        protected void btnRemoveLab_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnRemoveLab_Click";

            try {
                if (grdFieldLabResults.SelectedRow == null) {
                    Common.CWarning warn = new Common.CWarning("You must first select a lab from the Field's Soil Sample Lab Results grid.");
                    throw (warn);
                }
                int soilSampleLabID = Convert.ToInt32(grdFieldLabResults.SelectedRow.Cells[0].Text.Replace(BLANK_CELL, ""));

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    WSCField.FieldSampleLabRemove(conn, soilSampleLabID);
                }

                FillFieldLabResults();
                FillOtherLabResults();

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #57
0
        protected void btnAdrFind_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnAdrFind_Click";

            try {

                FindAddress();
                ClearContractSummary();
                ResetGrowerAdvice();

                if (MemberID > 0) {

                    FillContractSummary();
                    FillContractPerfGrid();
                    FillGrowerAdvice();

                } else {

                    ResetShareholder();
                    grdRegionArea.DataSource = null;
                    grdRegionArea.DataBind();
                    ResetGrowerAdvice();

                    Common.CWarning warn = new Common.CWarning("Please enter a valid SHID and press the Find button.");
                    throw (warn);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #58
0
        private void FillForm()
        {
            const string METHOD_NAME = "FillForm";

            try {

                ClearForm();

                int cropYear = Convert.ToInt32(((MasterReportTemplate)Master).CropYear);

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {

                    using (SqlDataReader dr = WSCAdmin.PassthroughAllGetByYear(conn, cropYear)) {

                        if (dr.Read()) {

                            int iFiscalYear = dr.GetOrdinal("pssaFiscalYearEndDate");
                            int iPercentApply = dr.GetOrdinal("pssaPercentageToApply");
                            int iRatePerTon = dr.GetOrdinal("pssaRatePerTon");
                            int iReportDate = dr.GetOrdinal("pssaReportDate");
                            int iTaxYear = dr.GetOrdinal("pssaTaxYear");

                            // Copy values into form
                            txtCropYear.Text = cropYear.ToString();
                            txtFiscalYearEndDate.Text = dr.GetString(iFiscalYear);
                            txtPctToApply.Text = dr.GetDecimal(iPercentApply).ToString("N3");
                            txtRatePerTon.Text = dr.GetDecimal(iRatePerTon).ToString("N6");
                            txtReportDate.Text = dr.GetString(iReportDate);
                            txtTaxYear.Text = dr.GetInt32(iTaxYear).ToString();
                        } else {

                            Common.CWarning warn = new Common.CWarning(@"Before Printing you *MUST* set Coop values in Ag Admin\Passthrough Management for Crop Year "
                            + cropYear.ToString());
                            throw(warn);
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Пример #59
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");

                string reportDate = txtEsReportDate.Text;
                string paymentCropYear = ((MasterReportTemplate)Master).CropYear;
                string shid = txtEsSHID.Text;
                bool isActive = chkEsActiveOnly.Checked;

                if (reportDate == null || reportDate.Length == 0 || !Common.CodeLib.IsDate(reportDate)) {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid report date, mm/dd/yyyy");
                    throw (warn);
                }

                DateTime activityFromDate = DateTime.MinValue;
                DateTime activityToDate = DateTime.MinValue;

                string testActivityFromDate = txtActivityFromDate.Text;
                string testActivityToDate = txtActivityToDate.Text;

                if (!String.IsNullOrEmpty(testActivityFromDate)) {
                    if (!DateTime.TryParse(testActivityFromDate, out activityFromDate)) {
                        Common.CWarning warn = new Common.CWarning("The Activity From Date is not a valid date.  Please enter as mm/dd/yyyy");
                        throw (warn);
                    }
                }

                if (!String.IsNullOrEmpty(testActivityToDate)) {
                    if (!DateTime.TryParse(testActivityToDate, out activityToDate)) {
                        Common.CWarning warn = new Common.CWarning("The Activity To Date is not a valid date.  Please enter as mm/dd/yyyy");
                        throw (warn);
                    }
                }

                if (activityFromDate != DateTime.MinValue || activityToDate != DateTime.MinValue) {
                    if (activityFromDate == DateTime.MinValue || activityToDate == DateTime.MinValue) {
                        if (!DateTime.TryParse(testActivityToDate, out activityToDate)) {
                            Common.CWarning warn = new Common.CWarning("When using the Optional Activity Dates, you must enter both the From and To Dates.");
                            throw (warn);
                        }
                    }
                    if (activityToDate < activityFromDate) {
                        Common.CWarning warn = new Common.CWarning("When using the Optional Activity Dates, the From Date must be less than the To Date");
                        throw (warn);
                    }
                }

                bool isLienInfoWanted = chkIsLienInfoWanted.Checked;

                WSCReports.rptEquityStatement rptEqStmt = new WSCReports.rptEquityStatement();
                string pdf = rptEqStmt.ReportPackager(Int32.Parse(paymentCropYear), DateTime.Parse(reportDate), shid, isActive, fileName, logoUrl, pdfTempFolder,
                    activityFromDate, activityToDate, isLienInfoWanted);

                if (pdf.Length > 0) {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Пример #60
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnPrint_Click";

            try {

                ArrayList shidList = new ArrayList(1);
                _shs = Globals.ShsData;
                shidList.Add(SHID);

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + "Shareholder Summary".Replace(" ", "");

                if (grdRegionArea.SelectedIndex != -1) {

                    string regionCode = grdRegionArea.SelectedRow.Cells[1].Text;
                    string regionName = grdRegionArea.SelectedRow.Cells[3].Text;
                    string areaCode = grdRegionArea.SelectedRow.Cells[2].Text;
                    string areaName = grdRegionArea.SelectedRow.Cells[4].Text;
                    string growerPerformanceID = grdRegionArea.SelectedRow.Cells[0].Text;

                    string busName = _busName;

                    // pro-actively refresh the manually crafted table before we make the call to generate the PDF.
                    FillContractPerfGrid();

                    string locpdf = WSCReports.rptShareholderSummary.ReportPackager( CropYear, shidList, busName,
                        growerPerformanceID, regionCode, areaCode, regionName, areaName, auth.UserName, fileName, logoUrl, pdfTempFolder);

                    if (locpdf.Length > 0) {
                        // convert file system path to virtual path
                        locpdf = locpdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                    }

                    locPDF.Text = locpdf;

                } else {
                    Common.CWarning warn = new Common.CWarning("Please select a Region / Area from the top grid, or use the Print All button.");
                }

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }