예제 #1
0
        private static void CalcSubTotals(List <ListDirectDeliveryStatementItem> stateList, int index, out decimal firstNetTons, out decimal ninetySixPct, out decimal payAmt)
        {
            const string METHOD_NAME = "CalcSubTotals";

            int    maxIndex = stateList.Count;
            string payee    = stateList[index].Payee;
            ListDirectDeliveryStatementItem state = null;

            firstNetTons = 0;
            ninetySixPct = 0;
            payAmt       = 0;

            try {
                while (index < maxIndex && stateList[index].Payee == payee)
                {
                    state         = stateList[index];
                    firstNetTons += state.FirstNetTons;
                    ninetySixPct += state.NinetySixPct;
                    payAmt       += state.PaymentAmount;

                    index += 1;
                }
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #2
0
        private void FindSHID(string newShid)
        {
            const string METHOD_NAME = "FindSHID";

            try {
                ResetShareholder();

                int shid = 0;
                if (Common.CodeLib.IsValidSHID(newShid))
                {
                    shid = Convert.ToInt32(newShid);
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid SHID.");
                    throw (warn);
                }
                SHID = shid;

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

                ResetMemberInfo(SHID.ToString());
                ShowMemberInfo();
            }
            catch (Exception ex) {
                Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #3
0
        public static string ReportPackager(int cropYear, DateTime fromDate, DateTime toDate, int paymentID, string fileName, string pdfTempfolder, out string warnMsg)
        {
            const string  METHOD_NAME = "ReportPackager";
            DirectoryInfo pdfDir      = null;
            string        filePath    = "";

            try {
                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "")
                {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(cropYear, fromDate, toDate, paymentID, filePath, out warnMsg);

                return(filePath);
            }
            catch (System.Exception ex) {
                string errMsg = "";

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + ": " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #4
0
        public static string ReportPackager(int cropYear, string shid, string fromShid,
                                            string toShid, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string  METHOD_NAME = "ReportPackager: ";
            DirectoryInfo pdfDir      = null;

            FileInfo[] pdfFiles = null;
            string     filePath = "";

            try {
                try {
                    pdfDir = new DirectoryInfo(pdfTempfolder);

                    // Build the output file name by getting a list of all PDF files
                    // that begin with this session ID: use this as a name incrementer.
                    pdfFiles  = pdfDir.GetFiles(fileName + "*.pdf");
                    fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf";

                    filePath = pdfDir.FullName + @"\" + fileName;

                    ReportBuilder(cropYear, shid, fromShid, toShid, filePath, logoUrl);
                }
                catch (System.Exception ex) {
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                    throw (wscEx);
                }

                return(filePath);
            }
            catch (System.Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
예제 #5
0
        public static void AddTruckTotals(ref Document document, string loadCount, string dirtWeight, string netWeight, DailyGrowerTareDetailEvent pgEvent)
        {
            const string METHOD_NAME = "AddTruckTotals";

            try {
                PdfPTable table = PdfReports.CreateTable(_primaryTableLayout, 1);

                // Let the PDF Page event handler take care of adding column labels on page breaks.
                pgEvent.HeaderNameList    = _truckDetailHdrNames;
                pgEvent.HeaderTableLayout = _primaryTableLayout;

                PdfReports.AddText2Table(table, " ", _normalFont);
                PdfReports.AddText2Table(table, "Load Count:", _labelFont);
                PdfReports.AddText2Table(table, loadCount, _normalFont);
                PdfReports.AddText2Table(table, " ", _normalFont);
                PdfReports.AddText2Table(table, " ", _normalFont);
                PdfReports.AddText2Table(table, dirtWeight, _normalFont, "right");
                PdfReports.AddText2Table(table, " ", _normalFont);
                PdfReports.AddText2Table(table, netWeight, _normalFont, "right");
                PdfReports.AddText2Table(table, " ", _normalFont, _primaryTableLayout.Length);

                PdfReports.AddTableNoSplit(document, pgEvent, table);
                pgEvent.HeaderNameList    = null;
                pgEvent.HeaderTableLayout = null;
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
예제 #6
0
        public static SqlDataReader SecurityRegionGetAll(SqlConnection conn)
        {
            const string  METHOD_NAME = MOD_NAME + "SecurityRegionGetAll.";
            SqlDataReader dr          = null;

            try {
                string procName = "bawpRegionGetAll";

                if (conn.State != System.Data.ConnectionState.Open)
                {
                    conn.Open();
                }

                try {
                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName);
                }
                catch (SqlException sqlEx) {
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                    {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    }
                    else
                    {
                        throw (sqlEx);
                    }
                }
            }
            catch (System.Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscEx);
            }

            return(dr);
        }
예제 #7
0
        public static string ReportPackager(string paymentCropYear, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string METHOD_NAME = "ReportPackager";
            DirectoryInfo pdfDir = null;
            string filePath = "";

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "") {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(Convert.ToInt32(paymentCropYear), filePath);

                return filePath;
            }
            catch (System.Exception ex) {

                string errMsg = "";

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + ": " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #8
0
        public static List <ListIMSFactoryItem> GetWSCFactoryList()
        {
            const string METHOD_NAME = "GetWSCFactoryList";
            const string cacheKey    = "WSCFactoryList";

            List <ListIMSFactoryItem> factoryList = (List <ListIMSFactoryItem>)HttpRuntime.Cache[cacheKey];

            try {
                if (factoryList == null)
                {
                    factoryList = new List <ListIMSFactoryItem>();
                    factoryList.Add(new ListIMSFactoryItem(20, "Billings"));
                    factoryList.Add(new ListIMSFactoryItem(30, "Ft Morgan"));
                    factoryList.Add(new ListIMSFactoryItem(50, "Lovell"));
                    factoryList.Add(new ListIMSFactoryItem(60, "Scottsbluff"));
                    factoryList.Add(new ListIMSFactoryItem(70, "Torrington"));

                    HttpRuntime.Cache.Insert(cacheKey, factoryList);
                }

                return(factoryList);
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #9
0
        private static void ReportBuilder(int paymentCropYear, string filePath)
        {
            const string METHOD_NAME = "ReportBuilder";
            const string QUOTE       = "\"";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    List <List1099ExportItem> stateList = WSCPayment.GetBeet1099Export(paymentCropYear);

                    using (StreamWriter sw = new StreamWriter(filePath, false)) {
                        foreach (List1099ExportItem state in stateList)
                        {
                            //SHID, TaxID, Business Name, Address 1, Address 2, City, State, Zip, Dollars
                            sw.Write(QUOTE + state.SHID + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxID + QUOTE + ",");
                            sw.Write(QUOTE + state.BusName + QUOTE + ",");
                            sw.Write(QUOTE + state.Address1 + QUOTE + ",");
                            sw.Write(QUOTE + state.Address2 + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxCity + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxState + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxZip + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxDollars + QUOTE + Environment.NewLine);
                        }

                        sw.Close();
                    }
                }
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscex);
            }
        }
예제 #10
0
        public static string ReportPackager(string paymentCropYear, bool isPatronage, string paymentType, string paymentDate, ref string warnings, 
            string fileName, string logoUrl, string pdfTempfolder)
        {
            DirectoryInfo pdfDir = null;
            string filePath = "";

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "") {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(Convert.ToInt32(paymentCropYear), isPatronage, paymentType, paymentDate, filePath, ref warnings);

                return filePath;
            }
            catch (System.Exception ex) {

                string errMsg = "Payment Crop Year: " + paymentCropYear + "; " +
                    "Is Patronage: " + isPatronage.ToString() + "; " +
                    "Payment Type: " + paymentType + "; " +
                    "Payment Date: " + paymentDate + "; " +
                    "fileName: " + fileName + "; " +
                    "pdfDir is null: " + (pdfDir == null).ToString() + "; " +
                    "filesPath: " + filePath;

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException("MReports.rptEquityPayment: " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #11
0
        public static SqlDataReader PassthroughAllGetByYear(SqlConnection conn, int cropYear)
        {
            const string  METHOD_NAME = "PassthroughAllGetByYear";
            SqlDataReader dr          = null;

            try {
                string procName = "bawpPassthroughAllGetByYear";

                if (conn.State != System.Data.ConnectionState.Open)
                {
                    conn.Open();
                }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = cropYear;

                dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return(dr);
        }
예제 #12
0
        public static string ReportPackager(string paymentCropYear, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string  METHOD_NAME = "ReportPackager";
            DirectoryInfo pdfDir      = null;
            string        filePath    = "";

            try {
                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "")
                {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(Convert.ToInt32(paymentCropYear), filePath);

                return(filePath);
            }
            catch (System.Exception ex) {
                string errMsg = "";

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + ": " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #13
0
        public static string ReportPackager(string cropYear, string startContractNumber, string stopContractNumber, string fileName, string logoUrl, string pdfTempfolder)
        {
            DirectoryInfo pdfDir   = null;
            string        filePath = "";

            try {
                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "")
                {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(Convert.ToInt32(cropYear), Convert.ToInt32(startContractNumber),
                              Convert.ToInt32(stopContractNumber), filePath);

                return(filePath);
            }
            catch (System.Exception ex) {
                string errMsg = "cropYear: " + cropYear + "; " +
                                "start contract number: " + startContractNumber + "; " +
                                "stop contract number: " + stopContractNumber + "; " +
                                "fileName: " + fileName + "; " +
                                "pdfDir is null: " + (pdfDir == null).ToString() + "; " +
                                "filesPath: " + filePath;

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException("MReports.rptContractCards.ReportPackager: " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #14
0
        public static string ReportPackager(string cropYear, string startContractNumber, string stopContractNumber, string fileName, string logoUrl, string pdfTempfolder)
        {
            DirectoryInfo pdfDir = null;
            string filePath = "";

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "") {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(Convert.ToInt32(cropYear), Convert.ToInt32(startContractNumber),
                    Convert.ToInt32(stopContractNumber), filePath);

                return filePath;
            }
            catch (System.Exception ex) {

                string errMsg = "cropYear: " + cropYear + "; " +
                    "start contract number: " + startContractNumber + "; " +
                    "stop contract number: " + stopContractNumber + "; " +
                    "fileName: " + fileName + "; " +
                    "pdfDir is null: " + (pdfDir == null).ToString() + "; " +
                    "filesPath: " + filePath;

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException("MReports.rptContractCards.ReportPackager: " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #15
0
        public static string ReportPackager(string paymentCropYear, bool isPatronage, string paymentType, string paymentDate, ref string warnings,
                                            string fileName, string logoUrl, string pdfTempfolder)
        {
            DirectoryInfo pdfDir   = null;
            string        filePath = "";

            try {
                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                if (Path.GetExtension(fileName) == "")
                {
                    fileName += ".csv";
                }
                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(Convert.ToInt32(paymentCropYear), isPatronage, paymentType, paymentDate, filePath, ref warnings);

                return(filePath);
            }
            catch (System.Exception ex) {
                string errMsg = "Payment Crop Year: " + paymentCropYear + "; " +
                                "Is Patronage: " + isPatronage.ToString() + "; " +
                                "Payment Type: " + paymentType + "; " +
                                "Payment Date: " + paymentDate + "; " +
                                "fileName: " + fileName + "; " +
                                "pdfDir is null: " + (pdfDir == null).ToString() + "; " +
                                "filesPath: " + filePath;

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException("MReports.rptEquityPayment: " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #16
0
        public static void DeleteContractDirtTable(int cropYear)
        {
            try {

                using (OLEDB.OleDbConnection msConn =
                          new OLEDB.OleDbConnection(Globals.BeetExportConnectionString())) {

                    string qry = "ContractDirtDelete";

                    if (msConn.State != System.Data.ConnectionState.Open) { msConn.Open(); }
                    using (OLEDB.OleDbCommand cmd = new OLEDB.OleDbCommand(qry, msConn)) {

                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.Add("pCropYear", OLEDB.OleDbType.Integer, 0).Value = cropYear;
                        cmd.ExecuteNonQuery();
                    }

                }
            }
            catch (Exception ex) {
                string errMsg = MOD_NAME + "DeleteContractDirtTable";
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }
예제 #17
0
        private static void AddDetailTable(PdfPTable detailTable, List <ListDirectDeliveryStatementItem> stateList, int index,
                                           decimal subTotalFirstNetTons, decimal subTotalNinetySixPct, decimal subTotalPayAmt)
        {
            const string METHOD_NAME = "AddDetailTable";

            int    maxIndex = stateList.Count;
            string payee    = stateList[index].Payee;

            try {
                // Create the Header
                PdfReports.AddText2Table(detailTable, "Cont", _labelFont, "center");
                PdfReports.AddText2Table(detailTable, "SHID", _labelFont, "center");
                //PdfReports.AddText2Table(detailTable, "Payee", _labelFont, "center");

                PdfReports.AddText2Table(detailTable, "Pay Amt", _labelFont, "center");
                PdfReports.AddText2Table(detailTable, "1st Net Tons", _labelFont, "center");
                PdfReports.AddText2Table(detailTable, "D Station", _labelFont, "center");

                PdfReports.AddText2Table(detailTable, "C Station", _labelFont, "center");
                PdfReports.AddText2Table(detailTable, "96%", _labelFont, "center");
                PdfReports.AddText2Table(detailTable, "Rate", _labelFont, "center");

                // Add the Details
                while (index < maxIndex && stateList[index].Payee == payee)
                {
                    ListDirectDeliveryStatementItem state = stateList[index];

                    PdfReports.AddText2Table(detailTable, state.ContractNumber, _normalFont, "center");
                    PdfReports.AddText2Table(detailTable, state.Shid, _normalFont, "center");
                    //PdfReports.AddText2Table(detailTable, state.Payee, _normalFont, "left");

                    PdfReports.AddText2Table(detailTable, Math.Round(state.PaymentAmount, 2).ToString("0.00"), _normalFont, "right");
                    PdfReports.AddText2Table(detailTable, state.FirstNetTons.ToString("0.0000"), _normalFont, "right");
                    PdfReports.AddText2Table(detailTable, state.DeliveryStationName, _normalFont, "center");

                    PdfReports.AddText2Table(detailTable, state.ContractStationName, _normalFont, "center");
                    PdfReports.AddText2Table(detailTable, state.NinetySixPct.ToString("0.0000"), _normalFont, "right");
                    PdfReports.AddText2Table(detailTable, state.RatePerTon.ToString("0.0000"), _normalFont, "right");

                    index += 1;
                }

                // Add Sub Totals
                PdfReports.AddText2Table(detailTable, " ", _normalFont, "center");
                //PdfReports.AddText2Table(detailTable, " ", _normalFont, "center");
                PdfReports.AddText2Table(detailTable, "Total", _labelFont, "center");

                PdfReports.AddText2Table(detailTable, Math.Round(subTotalPayAmt, 2).ToString("0.00"), _labelFont, "right");
                PdfReports.AddText2Table(detailTable, subTotalFirstNetTons.ToString("0.0000"), _labelFont, "right");
                PdfReports.AddText2Table(detailTable, " ", _normalFont, "center");

                PdfReports.AddText2Table(detailTable, " ", _normalFont, "center");
                PdfReports.AddText2Table(detailTable, subTotalNinetySixPct.ToString("0.0000"), _labelFont, "right");
                PdfReports.AddText2Table(detailTable, " ", _normalFont, "right");
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #18
0
        public static Contract GetContract(int contractNo, int cropYear)
        {
            const string METHOD_NAME = "GetContract";

            Contract contract = null;

            try {

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

                    string procName = "s70cnt_GetContract";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = contractNo;
                    spParams[1].Value = cropYear;

                    try {

                        using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {

                            int iContarctID = dr.GetOrdinal("cnt_contract_id");
                            int iCropYear = dr.GetOrdinal("cnt_crop_year");
                            int iContractNo = dr.GetOrdinal("cnt_contract_no");
                            int iFactoryId = dr.GetOrdinal("cnt_factory_id");
                            int iPACDues = dr.GetOrdinal("cnt_pack_dues");

                            while (dr.Read()) {
                                int contractId = dr.GetInt32(iContarctID);
                                int crop_year = Convert.ToInt32(dr.GetDateTime(iCropYear).Year);
                                int contract_no = Convert.ToInt32(dr.GetString(iContractNo));
                                int factory_id = dr.GetInt32(iFactoryId);
                                double pac_dues = Convert.ToDouble(dr.GetDecimal(iPACDues));
                                contract = new Contract(contractId, crop_year, contract_no, factory_id, pac_dues);
                            }
                        }
                    }
                    catch (SqlException sqlEx) {
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            string errMsg = MOD_NAME + METHOD_NAME;
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                            throw (wscEx);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return contract;
        }
예제 #19
0
        private void ShowPayeeInformation(PdfPTable table, int contractNumber, int cropYear, bool splitRetain, bool splitChemical)
        {
            const string METHOD_NAME = "rptContractPayeeSummary.ShowPayeeInformation";

            try {
                Paragraph p = new Paragraph("", _normalFont);

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCPayment.RptContractPayeeSummary2(conn, contractNumber, cropYear)) {
                        while (dr.Read())
                        {
                            if (dr.GetInt16(dr.GetOrdinal("PayeeNumber")) == 1)
                            {
                                Phrase phrase = new Phrase("1st Payee: ", _labelFont);
                                p.Add(phrase);
                                phrase = new Phrase(dr.GetString(dr.GetOrdinal("PayeeName")) + "\n", _normalFont);
                                p.Add(phrase);
                                phrase = new Phrase(dr.GetFloat(dr.GetOrdinal("SplitPercent")).ToString("##.0000") + "%" + "\n", _normalFont);
                                p.Add(phrase);
                                phrase = new Phrase("Mailed To: ", _labelFont);
                                p.Add(phrase);
                                phrase = new Phrase(dr.GetString(dr.GetOrdinal("AddressNumber")) + "  " + dr.GetString(dr.GetOrdinal("BusinessName")), _normalFont);
                                p.Add(phrase);

                                phrase = new Phrase("     Split Retains: ", _labelFont);
                                p.Add(phrase);
                                phrase = new Phrase((splitRetain ? "Y" : "N"), _normalFont);
                                p.Add(phrase);

                                phrase = new Phrase("     Split Chemicals: ", _labelFont);
                                p.Add(phrase);
                                phrase = new Phrase((splitChemical ? "Y" : "N") + "\n", _normalFont);
                                p.Add(phrase);
                            }
                            else
                            {
                                Phrase phrase = new Phrase("2nd Payee: ", _labelFont);
                                p.Add(phrase);
                                phrase = new Phrase(dr.GetString(dr.GetOrdinal("PayeeName")) + "\n", _normalFont);
                                p.Add(phrase);
                                phrase = new Phrase(dr.GetFloat(dr.GetOrdinal("SplitPercent")).ToString("##.0000") + "%" + "\n", _normalFont);
                                p.Add(phrase);
                                phrase = new Phrase("Mailed To: ", _labelFont);
                                p.Add(phrase);
                                phrase = new Phrase(dr.GetString(dr.GetOrdinal("AddressNumber")) + "  " + dr.GetString(dr.GetOrdinal("BusinessName")) + "\n", _normalFont);
                                p.Add(phrase);
                            }
                        }

                        PdfReports.AddText2Table(table, p, _primaryTableLayout.Length);
                    }
                }
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(METHOD_NAME, ex);
                throw (wscex);
            }
        }
예제 #20
0
        public static SqlDataReader GetEmailByShid(SqlConnection conn, string shidList, int cropYear, bool SubYesActYes, bool SubYesActNo,
                                                   bool SubNoActYes, bool isInternalOnly, bool isExternalOnly)
        {
            SqlDataReader dr = null;

            try {
                string procName = "bawpAddressEmailGetByShid";

                if (conn.State != System.Data.ConnectionState.Open)
                {
                    conn.Open();
                }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = shidList;
                spParams[1].Value = cropYear;
                spParams[2].Value = SubYesActYes;
                spParams[3].Value = SubYesActNo;
                spParams[4].Value = SubNoActYes;
                spParams[5].Value = isInternalOnly;
                spParams[6].Value = isExternalOnly;
                SetTimeout();

                try {
                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                }
                catch (SqlException sqlEx) {
                    if (dr != null && !dr.IsClosed)
                    {
                        dr.Close();
                    }
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                    {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    }
                    else
                    {
                        string errMsg = MOD_NAME + "UserFindLogon";
                        WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                        throw (wscEx);
                    }
                }
            }
            catch (System.Exception e) {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                string errMsg = MOD_NAME + "UserFindLogon";
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return(dr);
        }
예제 #21
0
        public static int SavePACAgreement(PACAgreement pacAgreement)
        {
            const string METHOD_NAME = "SavePACAgreement";
            int          pacId       = 0;

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "pacAgreement_Save";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[1].Value = pacAgreement.SHID;
                    spParams[2].Value = pacAgreement.Contribution;
                    spParams[3].Value = pacAgreement.PACDate;
                    spParams[4].Value = pacAgreement.PACCropYear;
                    spParams[5].Value = pacAgreement.IndividualsString;

                    using (SqlTransaction tran = conn.BeginTransaction()) {
                        try {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();

                            pacId = Convert.ToInt16(spParams[0].Value);
                        } catch (SqlException sqlEx) {
                            if (tran != null)
                            {
                                tran.Rollback();
                            }

                            if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                            {
                                WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                                throw (wscWarn);
                            }
                            else
                            {
                                string errMsg = MOD_NAME;
                                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                                throw (wscEx);
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return(pacId);
        }
예제 #22
0
        public static bool IsMemberAgriculturist(int userID, int shid, int cropYear)
        {
            const string METHOD_NAME = "IsMemberAgriculturist";
            string errMsg = "";

            try {

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

                    string procName = "bawpEmpIsMemAgriculturist";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = userID;
                    spParams[1].Value = shid;
                    spParams[2].Value = cropYear;
                    SetTimeout();

                    SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procName, spParams);

                    if (spParams[3].Value == System.DBNull.Value) {
                        return false;
                    } else {
                        return Convert.ToBoolean(spParams[3].Value);
                    }
                }
            }
            catch (SqlException sqlEx) {

                if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                    WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                    throw (wscWarn);
                } else {
                    errMsg = MOD_NAME + METHOD_NAME + LF +
                        "UserID: " + userID.ToString() +
                        "SHID: " + shid.ToString() +
                        "CropYear: " + cropYear.ToString();
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                    throw (wscEx);
                }
            }
            catch (System.Exception e) {

                if (errMsg.Length == 0)  {

                    errMsg = MOD_NAME + METHOD_NAME + LF +
                        "UserID: " + userID.ToString() +
                        "SHID: " + shid.ToString() +
                        "CropYear: " + cropYear.ToString();
                } else {errMsg = "";}

                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #23
0
        public static void GetMemberInfo(string shid, int cropYear, ref int memberID, ref int addressID, ref string busName, ref string phone, ref string email, ref string fax,
                                         ref int factoryID, ref int factoryNumber, ref string factoryName)
        {
            const string METHOD_NAME = "GetMemberInfo";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "bawpMemberGetBeetInfo";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    // Manually synch these fields with database.
                    int imemberID = 0, iaddressID = 1, ibusname = 2, ipone = 3, iemail = 4, ifax = 5, ifactoryID = 6, ifactoryNumber = 7, ifactoryName = 8;
                    spParams[0].Value = shid;
                    spParams[1].Value = cropYear;

                    using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {
                        if (dr.Read())
                        {
                            memberID      = dr.GetInt32(imemberID);
                            addressID     = dr.GetInt32(iaddressID);
                            busName       = dr.GetString(ibusname);
                            phone         = dr.GetString(ipone);
                            email         = dr.GetString(iemail);
                            fax           = dr.GetString(ifax);
                            factoryID     = dr.GetInt32(ifactoryID);
                            factoryNumber = dr.GetInt32(ifactoryNumber);
                            factoryName   = dr.GetString(ifactoryName);
                        }
                    }
                }
            }
            catch (SqlException sqlEx) {
                if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                {
                    WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                    throw (wscWarn);
                }
                else
                {
                    string errMsg = MOD_NAME + METHOD_NAME + LF + "SHID: " + shid;
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                    throw (wscEx);
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME + LF + "SHID: " + shid;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #24
0
        public static List <ListOverPlantFactoryItem> OverPlantFactoryByYear(int cropYear)
        {
            const string METHOD_NAME = "OverPlantFactoryByYear";

            List <ListOverPlantFactoryItem> state = new List <ListOverPlantFactoryItem>();

            try {
                string procName = "bawpOverPlantFactoryByYear";

                try {
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                        if (conn.State != System.Data.ConnectionState.Open)
                        {
                            conn.Open();
                        }
                        System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                        spParams[0].Value = cropYear;

                        using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {
                            int iftyNum           = dr.GetOrdinal("fty_factory_no");
                            int iftyName          = dr.GetOrdinal("fty_name");
                            int iisOverPlantAllow = dr.GetOrdinal("IsOverPlantAllowed");
                            int ipct            = dr.GetOrdinal("PctOverPlant");
                            int iisPoolAllowed  = dr.GetOrdinal("IsPoolAllowed");
                            int ipoolShid       = dr.GetOrdinal("PoolingSHID");
                            int ipoolCutoffDate = dr.GetOrdinal("PoolCutoffDate");
                            int iisPosted       = dr.GetOrdinal("IsPosted");

                            while (dr.Read())
                            {
                                state.Add(new ListOverPlantFactoryItem(dr.GetString(iftyNum), dr.GetString(iftyName), dr.GetBoolean(iisOverPlantAllow),
                                                                       dr.GetDecimal(ipct), dr.GetBoolean(iisPoolAllowed), dr.GetString(ipoolShid), dr.GetString(ipoolCutoffDate), dr.GetBoolean(iisPosted)));
                            }
                        }
                    }
                }
                catch (SqlException sqlEx) {
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                    {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    }
                    else
                    {
                        throw (sqlEx);
                    }
                }
            }
            catch (System.Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscEx);
            }

            return(state);
        }
예제 #25
0
        public static void UserSave(ref int userID,
                                    string userName, string displayName, string phoneNumber, string UserName)
        {
            const string METHOD_NAME = "UserSave";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "bawpUserSave";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[1].Value = userID;
                    spParams[2].Value = userName;
                    spParams[3].Value = displayName;
                    spParams[4].Value = phoneNumber;
                    spParams[5].Value = UserName;
                    SetTimeout();

                    using (SqlTransaction tran = conn.BeginTransaction()) {
                        try {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();

                            userID = Convert.ToInt32(spParams[0].Value);
                        }
                        catch (SqlException sqlEx) {
                            if (tran != null)
                            {
                                tran.Rollback();
                            }
                            if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                            {
                                WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                                throw (wscWarn);
                            }
                            else
                            {
                                string errMsg = MOD_NAME + METHOD_NAME;
                                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                                throw (wscEx);
                            }
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #26
0
        public static void AddTruckDetail(ref Document document, SqlDataReader drTrucks, DailyGrowerTareDetailEvent pgEvent)
        {
            const string METHOD_NAME = "AddTruckDetail";
            string       yardCard    = null;

            try {
                pgEvent.HeaderNameList = _truckDetailHdrNames;
                //PdfPTable table = PdfReports.CreateTable(_primaryTableLayout, 1);

                int iYardCard     = drTrucks.GetOrdinal("Yard_Card_Sequence_Number");
                int iDeliveryDate = drTrucks.GetOrdinal("Delivery_Date");
                int iTruckNumber  = drTrucks.GetOrdinal("Truck_Number");
                int iWeightIn     = drTrucks.GetOrdinal("Weight_In");
                int iWeightOut    = drTrucks.GetOrdinal("Weight_Out");
                int iDirtWt       = drTrucks.GetOrdinal("Dirt_Weight");
                int iDirtTaken    = drTrucks.GetOrdinal("Dirt_Taken");
                int iNetWt        = drTrucks.GetOrdinal("Net_Weight");

                while (drTrucks.Read())
                {
                    PdfPTable table = PdfReports.CreateTable(_primaryTableLayout, 1);

                    // On first pass, add the header labels here.
                    if (yardCard == null)
                    {
                        PdfReports.FillHeaderLabels(ref table, _truckDetailHdrNames, _labelFont);
                    }
                    else
                    {
                        // Now let the PDF Page event handler take care of adding column labels on page breaks.
                        pgEvent.HeaderTableLayout = _primaryTableLayout;
                    }

                    yardCard = drTrucks.GetString(iYardCard);
                    PdfReports.AddText2Table(table, yardCard, _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetString(iDeliveryDate), _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetString(iTruckNumber), _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iWeightIn).ToString("#,##0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iWeightOut).ToString("#,##0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iDirtWt).ToString("#,##0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drTrucks.GetString(iDirtTaken), _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iNetWt).ToString("#,##0"), _normalFont, "right");

                    PdfReports.AddTableNoSplit(document, pgEvent, table);
                }

                //PdfReports.AddTableNoSplit(document, pgEvent, table);

                pgEvent.HeaderNameList    = null;
                pgEvent.HeaderTableLayout = null;
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
예제 #27
0
        public static List <Individual> GetPACIndividuals(int id, string name)
        {
            const string METHOD_NAME = "GetPACIndividuals";

            List <Individual> individuals = new List <Individual>();

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "pacIndividual_Get";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = id;
                    spParams[1].Value = (name != null ? name.ToLower() : null);

                    try {
                        using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {
                            while (dr.Read())
                            {
                                individuals.Add(new Individual {
                                    IndividualID = Convert.ToInt32(dr["individual_id"] ?? 0),
                                    FullName     = dr["full_name"].ToString(),
                                    Email        = (dr["email"] == null) ? "" : dr["email"].ToString(),
                                    SHID         = (dr["shid"].ToString() == "") ? 0 : Convert.ToInt32(dr["shid"].ToString())
                                });
                            }
                        }
                    }
                    catch (SqlException sqlEx) {
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                        {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        }
                        else
                        {
                            string errMsg = MOD_NAME + METHOD_NAME;
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                            throw (wscEx);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return(individuals);
        }
예제 #28
0
        public static void GetMemberInfo(string shid, int cropYear, ref int memberID, ref int addressID, ref string busName, ref string phone, ref string email, ref string fax,
                ref int factoryID, ref int factoryNumber, ref string factoryName)
        {
            const string METHOD_NAME = "GetMemberInfo";

            try {

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

                    string procName = "bawpMemberGetBeetInfo";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    // Manually synch these fields with database.
                    int imemberID = 0, iaddressID = 1, ibusname = 2, ipone = 3, iemail = 4, ifax = 5, ifactoryID = 6, ifactoryNumber = 7, ifactoryName = 8;
                    spParams[0].Value = shid;
                    spParams[1].Value = cropYear;

                    using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {
                        if (dr.Read()) {

                            memberID = dr.GetInt32(imemberID);
                            addressID = dr.GetInt32(iaddressID);
                            busName = dr.GetString(ibusname);
                            phone = dr.GetString(ipone);
                            email = dr.GetString(iemail);
                            fax = dr.GetString(ifax);
                            factoryID = dr.GetInt32(ifactoryID);
                            factoryNumber = dr.GetInt32(ifactoryNumber);
                            factoryName = dr.GetString(ifactoryName);

                        }
                    }
                }
            }
            catch (SqlException sqlEx) {

                if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                    WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                    throw (wscWarn);
                } else {
                    string errMsg = MOD_NAME + METHOD_NAME + LF + "SHID: " + shid;
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                    throw (wscEx);
                }
            }
            catch (System.Exception e) {

                string errMsg = MOD_NAME + METHOD_NAME + LF + "SHID: " + shid;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #29
0
        public static void OverPlantFactorySave(int cropYear, int factoryNumber, bool isOverPlantAllowed, decimal overPlantPct, bool isPoolingAllowed, int poolMemberSHID,
                                                string poolCutoffDate, string userName)
        {
            const string METHOD_NAME = "OverPlantFactorySave";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "bawpOverPlantFactorySave";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = cropYear;
                    spParams[1].Value = factoryNumber;
                    spParams[2].Value = isOverPlantAllowed;
                    spParams[3].Value = overPlantPct;
                    spParams[4].Value = isPoolingAllowed;
                    spParams[5].Value = poolMemberSHID;
                    if (poolCutoffDate.Length > 0)
                    {
                        spParams[6].Value = poolCutoffDate;
                    }
                    else
                    {
                        spParams[6].Value = DBNull.Value;
                    }
                    spParams[7].Value = userName;

                    try {
                        SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procName, spParams);
                    }
                    catch (SqlException sqlEx) {
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                        {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        }
                        else
                        {
                            throw (sqlEx);
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }
예제 #30
0
        public static void LookupSave(
            string lookupType, bool lookupIsActive, string lookupOldDescription,
            string lookupDescription, bool fixOldValues)
        {
            const string METHOD_NAME = "LookupSave";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "bawpLookupSave";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = lookupType;
                    spParams[1].Value = lookupIsActive;
                    spParams[2].Value = lookupOldDescription;
                    spParams[3].Value = lookupDescription;
                    spParams[4].Value = fixOldValues;

                    SetTimeout();

                    using (SqlTransaction tran = conn.BeginTransaction()) {
                        try {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();
                        }
                        catch (SqlException sqlEx) {
                            if (tran != null)
                            {
                                tran.Rollback();
                            }
                            if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                            {
                                WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                                throw (wscWarn);
                            }
                            else
                            {
                                throw (sqlEx);
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }
예제 #31
0
        public static void PlantPopulationSave(int plantPopulationID, int cropYear, string rowWidth,
                                               string bpaFactor, string standFactor, string userName)
        {
            const string METHOD_NAME = "PlantPopulationSave";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "bawpPlantPopulationSave";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[1].Value = plantPopulationID;
                    spParams[2].Value = cropYear;
                    spParams[3].Value = Convert.ToInt32((rowWidth.Length == 0 ? "0" : rowWidth));
                    spParams[4].Value = Convert.ToDecimal((bpaFactor.Length == 0 ? "0" : bpaFactor));
                    spParams[5].Value = Convert.ToDecimal((standFactor.Length == 0 ? "0" : standFactor));
                    spParams[6].Value = userName.Substring(0, (userName.Length > 20 ? 20 : userName.Length));

                    SetTimeout();

                    using (SqlTransaction tran = conn.BeginTransaction()) {
                        try {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();
                        }
                        catch (SqlException sqlEx) {
                            if (tran != null)
                            {
                                tran.Rollback();
                            }
                            if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                            {
                                WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                                throw (wscWarn);
                            }
                            else
                            {
                                throw (sqlEx);
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }
예제 #32
0
        public static void SplitShidList(string shid, out string shidList, out string shidLo, out string shidHi)
        {
            const string METHOD_NAME = "SplitShidList";

            // Now we have one or more shids.
            shidList = "";
            shidLo   = "";
            shidHi   = "";

            // First squeeze out any blanks
            string shidTest = shid.Replace(" ", "");

            try {
                // CSV check -- string has a "," character
                if (shidTest.IndexOf(",") != -1)
                {
                    // Cannot ALSO have an embedded dash "-"
                    if (shidTest.IndexOf("-") != -1)
                    {
                        WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("You can enter a list or a range of SHIDs but not both.");
                        throw (warn);
                    }
                    else
                    {
                        shidList = shidTest;
                    }
                }
                else
                {
                    // Range check -- string has a dash separating the low/high values.
                    if (shidTest.IndexOf("-") != -1)
                    {
                        string[] shidParts = shidTest.Split(new char[] { '-' });
                        if (shidParts.Length != 2)
                        {
                            WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("Range not entered correctly.  You indicate a range by placing a dash between a low value of SHID and a higher value of SHID.");
                            throw (warn);
                        }

                        shidLo = shidParts[0];
                        shidHi = shidParts[1];
                    }
                    else
                    {
                        // No comma and no dash, must be a sigle shid specified.
                        shidList = shidTest;
                    }
                }
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
예제 #33
0
        public static void AppErrorInfoCreate(int appErrorInfoID, string appName, DateTime errorDate,
                                              string serverName, string clientName, string loginName, string errorCode, string userName, string errorText)
        {
            const string METHOD_NAME = "AppErrorInfoCreate";

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "srspAppErrorInfoSave";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = appErrorInfoID;
                    spParams[1].Value = appName;
                    spParams[2].Value = errorDate;
                    spParams[3].Value = "O";
                    spParams[4].Value = serverName;
                    spParams[5].Value = clientName;
                    spParams[6].Value = loginName;
                    spParams[7].Value = errorCode;
                    spParams[8].Value = userName;
                    spParams[9].Value = errorText;

                    try {
                        using (SqlTransaction tran = conn.BeginTransaction()) {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();
                        }
                    }
                    catch (SqlException sqlEx) {
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                        {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        }
                        else
                        {
                            string errMsg = MOD_NAME + METHOD_NAME;
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                            throw (wscEx);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #34
0
        public static void BankPayeeSaveOtherYear(int bankID,
                                                  int addressID, bool subRecd, int otherCropYear, bool isInsert, string UserName)
        {
            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    string procName = "bawpBankPayeeSaveOtherYear";

                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = bankID;
                    spParams[1].Value = addressID;
                    spParams[2].Value = subRecd;
                    spParams[3].Value = otherCropYear;
                    spParams[4].Value = isInsert;
                    spParams[5].Value = UserName;
                    SetTimeout();

                    using (SqlTransaction tran = conn.BeginTransaction()) {
                        try {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();
                        }
                        catch (SqlException sqlEx) {
                            if (tran != null)
                            {
                                tran.Rollback();
                            }
                            if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                            {
                                WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                                throw (wscWarn);
                            }
                            else
                            {
                                string errMsg = MOD_NAME + "BankPayeeSaveOtherYear";
                                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                                throw (wscEx);
                            }
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + "BankPayeeSaveOtherYear";
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #35
0
        public static List<ListOverPlantFactoryItem> OverPlantFactoryByNumber(int cropYear, int factoryNumber)
        {
            const string METHOD_NAME = "OverPlantFactoryByNumber";

            List<ListOverPlantFactoryItem> state = new List<ListOverPlantFactoryItem>();

            try {

                string procName = "bawpOverPlantFactoryByNumber";

                try {

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

                        if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                        System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                        spParams[0].Value = cropYear;
                        spParams[1].Value = factoryNumber;

                        using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {

                            int iftyNum = dr.GetOrdinal("FactoryNumber");
                            int iftyName = dr.GetOrdinal("FactoryName");
                            int iisOverPlantAllow = dr.GetOrdinal("IsOverPlantAllowed");
                            int ipct = dr.GetOrdinal("OverPlantPct");
                            int iisPoolAllowed = dr.GetOrdinal("IsPoolAllowed");
                            int ipoolCutoffDate = dr.GetOrdinal("PoolCutoffDate");

                            if (dr.Read()) {

                                state.Add(new ListOverPlantFactoryItem(dr.GetInt32(iftyNum).ToString(), dr.GetString(iftyName), dr.GetBoolean(iisOverPlantAllow),
                                    dr.GetDecimal(ipct), dr.GetBoolean(iisPoolAllowed), "", dr.GetString(ipoolCutoffDate), false));
                            }
                        }
                    }
                }
                catch (SqlException sqlEx) {
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    } else {
                        throw (sqlEx);
                    }
                }
            }
            catch (System.Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscEx);
            }

            return state;
        }
예제 #36
0
        public static string ReportPackager(
            int cropYear, ArrayList shidList, string busName, string growerPerformanceID, string regionCode, string areaCode,
            string regionName, string areaName, string userName, string fileName, string logoUrl, string pdfTempfolder)
        {
            DirectoryInfo pdfDir = null;

            FileInfo[] pdfFiles = null;
            string     filePath = "";

            try {
                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                pdfFiles  = pdfDir.GetFiles(fileName + "*.pdf");
                fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf";

                filePath = pdfDir.FullName + @"\" + fileName;

                ArrayList growerPerformanceList = new ArrayList();
                ArrayList regionCodeList        = new ArrayList();
                ArrayList areaCodeList          = new ArrayList();
                ArrayList regionNameList        = new ArrayList();
                ArrayList areaNameList          = new ArrayList();

                if (growerPerformanceID.Length > 0)
                {
                    growerPerformanceList.Add(growerPerformanceID);
                    regionCodeList.Add(regionCode);
                    areaCodeList.Add(areaCode);
                    regionNameList.Add(regionName);
                    areaNameList.Add(areaName);
                }

                using (System.IO.FileStream fs = new FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read)) {
                    ReportBuilder(cropYear, shidList, busName, growerPerformanceList, regionCodeList, areaCodeList, regionNameList, areaNameList, logoUrl, filePath, fs);
                }



                return(filePath);
            }
            catch (System.Exception ex) {
                string errMsg = "cropYear: " + cropYear + "; " +
                                "fileName: " + fileName + "; " +
                                "pdfDir is null: " + (pdfDir == null).ToString() + "; " +
                                "pdfFiles is null: " + (pdfFiles == null).ToString() + "; " +
                                "filesPath: " + filePath;

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException("HReports.rptShareholderSummary.ReportPackager: " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #37
0
        public static string ReportPackager(
            int cropYear, int paymentNumber, string paymentDescription,
            string fromDate, string toDate, string statementDate,
            string factoryList, string stationList, string contractList,
            bool isCumulative, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string METHOD_NAME = "rptTransmittal.ReportPackager: ";
            DirectoryInfo pdfDir = null;
            FileInfo[] pdfFiles = null;
            string filePath = "";

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                pdfFiles = pdfDir.GetFiles(fileName + "*.pdf");
                fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf";

                filePath = pdfDir.FullName + @"\" + fileName;

                try {

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

                        using (SqlDataReader dr = WSCPayment.GetTransmittalPayment(conn,
                            cropYear, paymentNumber, factoryList, stationList, contractList, isCumulative)) {

                            using (System.IO.FileStream fs = new FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read)) {
                                ReportBuilder(dr, cropYear, paymentNumber, paymentDescription, fromDate, toDate, statementDate, isCumulative, logoUrl, fs);
                            }
                        }
                    }
                }
                catch (System.Exception ex) {
                    string errMsg = "cropYear: " + cropYear.ToString();

                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex);
                    throw (wscEx);
                }

                return filePath;
            }
            catch (System.Exception ex) {
                string errMsg = "cropYear: " + cropYear.ToString() + "; " +
                    "Payment Number: " + paymentNumber.ToString();

                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex);
                throw (wscEx);
            }
        }
예제 #38
0
        public static SqlDataReader ContractDeductionQualify(SqlConnection conn, int cropYear, string xmlDataMap)
        {
            SqlDataReader dr          = null;
            const string  METHOD_NAME = "ContractDeductionQualify";

            try {
                string procName = "bawpContractDeductionQualify";

                if (conn.State != System.Data.ConnectionState.Open)
                {
                    conn.Open();
                }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = cropYear;
                spParams[1].Value = xmlDataMap;
                SetTimeout();

                try {
                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                }
                catch (SqlException sqlEx) {
                    if (dr != null && !dr.IsClosed)
                    {
                        dr.Close();
                    }
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                    {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    }
                    else
                    {
                        string errMsg = MOD_NAME + METHOD_NAME;
                        WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                        throw (wscEx);
                    }
                }
            }
            catch (System.Exception e) {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return(dr);
        }
예제 #39
0
        public static List <ListBeetFactoryIDItem> BeetFactoryIDGetList(int cropYear)
        {
            const string METHOD_NAME           = "BeetFactoryIDGetList";
            List <ListBeetFactoryIDItem> state = new List <ListBeetFactoryIDItem>();

            try {
                string procName = "bawpFactoryGetAll";

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    if (conn.State != System.Data.ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = cropYear;

                    using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {
                        int iFtyID     = dr.GetOrdinal("fty_factory_id");
                        int iFtyNumber = dr.GetOrdinal("fty_factory_no");
                        int iFtyName   = dr.GetOrdinal("fty_name");

                        while (dr.Read())
                        {
                            state.Add(new ListBeetFactoryIDItem(dr.GetInt32(iFtyID), Convert.ToInt32(dr.GetInt16(iFtyNumber)), dr.GetString(iFtyName)));
                        }
                    }
                }

                return(state);
            }
            catch (SqlException sqlEx) {
                if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning))
                {
                    WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                    throw (wscWarn);
                }
                else
                {
                    string errMsg = MOD_NAME + METHOD_NAME;
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                    throw (wscEx);
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);

                throw (wscEx);
            }
        }
예제 #40
0
        public static SqlDataReader AddressFindName(SqlConnection conn, string addressName)
        {
            const string METHOD_NAME = "AddressFindName";
            SqlDataReader dr = null;

            try {

                string procName = "bawpAddressFindByName";

                if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = addressName;
                SetTimeout();

                try {
                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                }
                catch (SqlException sqlEx) {
                    if (dr != null && !dr.IsClosed) {
                        dr.Close();
                    }
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    } else {
                        string errMsg = MOD_NAME + METHOD_NAME;
                        WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                        throw (wscEx);
                    }
                }
            }
            catch (System.Exception e) {
                if (dr != null && !dr.IsClosed) {
                    dr.Close();
                }
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }

            return dr;
        }
예제 #41
0
파일: LimsEx.cs 프로젝트: jwebb-vtg/WSCIEMP
        public static RehaulFactoryStationData GetRehaulFactoryStationData(int factoryID, DateTime rehaulDate)
        {
            const string METHOD_NAME = "GetRehaulFactoryStationData";
            string cacheKey = "RehaulFactoryStationData";
            string filePath = "";

            RehaulFactoryStationData rehaulData = null;
            try {

                rehaulData = (RehaulFactoryStationData)HttpRuntime.Cache.Get(cacheKey);
                if (rehaulData == null) {

                    rehaulData = new RehaulFactoryStationData();
                    filePath = WSCIEMP.Common.AppHelper.AppPath() + @"ZHost/XML/RehaulFactoryStation.xml";
                    rehaulData.Load(filePath);
                    HttpRuntime.Cache.Insert(cacheKey, rehaulData, new CacheDependency(filePath));
                }

                // Always check database for data.
                SqlDataReader dr = null;

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

                    string procName = "stapRehaulDailyGetEntry";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = factoryID;
                    spParams[1].Value = rehaulDate;

                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                    rehaulData.FillFactoryDetail((factoryID * 10).ToString(), dr);
                }

                return rehaulData;
            }
            catch (Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME + "; factoryID: " + factoryID.ToString() + "; rehaulDate: " + rehaulDate.ToString();
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }
예제 #42
0
        public static void BankDelete(int bankID, string UserName)
        {
            try {

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

                    string procName = "bawpBankDelete";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = bankID;
                    spParams[1].Value = UserName;
                    SetTimeout();

                    using (SqlTransaction tran = conn.BeginTransaction()) {
                        try {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();
                        }
                        catch (SqlException sqlEx) {

                            if (tran != null) {
                                tran.Rollback();
                            }
                            if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                                WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                                throw (wscWarn);
                            } else {
                                string errMsg = MOD_NAME + "BankDelete";
                                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                                throw (wscEx);
                            }
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + "BankDelete";
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #43
0
        public static void GetAddress(int memberID,
            ref string email, ref string fax, ref string busName)
        {
            try {

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

                    string procName = "bawpUserGetAddress";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = memberID;
                    SetTimeout();

                    SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procName, spParams);

                    email = spParams[1].Value.ToString();
                    fax = spParams[2].Value.ToString();
                    busName = spParams[3].Value.ToString();
                }
            }
            catch (SqlException sqlEx) {

                if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                    WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                    throw (wscWarn);
                } else {
                    string errMsg = MOD_NAME + "GetAddress";
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                    throw (wscEx);
                }
            }
            catch (System.Exception e) {

                string errMsg = MOD_NAME + "GetAddress";
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #44
0
        public static void AppErrorFileDelete(int appErrorInfoID)
        {
            const string METHOD_NAME = "AppErrorFileDelete";

            try {

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

                    string procName = "srspAppErrorInfoDelete";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = appErrorInfoID;

                    try {
                        using (SqlTransaction tran = conn.BeginTransaction()) {
                            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, procName, spParams);
                            tran.Commit();
                        }
                    }
                    catch (SqlException sqlEx) {
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            string errMsg = MOD_NAME + METHOD_NAME;
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                            throw (wscEx);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #45
0
        public static void DirectDeliveryContractDelete(int directDeliveryID, int cropYear, int contractID, string rowVersion)
        {
            const string METHOD_NAME = "DirectDeliveryContractDelete";

            try {

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

                    string procName = "bawpDirectDeliveryContractDelete";
                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = directDeliveryID;
                    spParams[1].Value = cropYear;
                    spParams[2].Value = contractID;
                    spParams[3].Value = rowVersion;

                    try {
                        SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procName, spParams);
                    }
                    catch (SqlException sqlEx) {

                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            throw (sqlEx);
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }
예제 #46
0
        public static string ReportPackager(int cropYear, string shid, string fromShid, 
			string toShid, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string METHOD_NAME = "ReportPackager: ";
            DirectoryInfo pdfDir = null;
            FileInfo[] pdfFiles = null;
            string filePath = "";

            try {

                try {

                    pdfDir = new DirectoryInfo(pdfTempfolder);

                    // Build the output file name by getting a list of all PDF files
                    // that begin with this session ID: use this as a name incrementer.
                    pdfFiles = pdfDir.GetFiles(fileName + "*.pdf");
                    fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf";

                    filePath = pdfDir.FullName + @"\" + fileName;

                    ReportBuilder(cropYear, shid, fromShid, toShid, filePath, logoUrl);
                }
                catch (System.Exception ex) {

                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                    throw (wscEx);
                }

                return filePath;
            }
            catch (System.Exception ex) {

                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
예제 #47
0
        public static string ReportPackager(
            int cropYear, int shid, string contractNumbers, bool isCSV, string fileName, string logoUrl, string pdfTempfolder)
        {
            DirectoryInfo pdfDir = null;
            FileInfo[] pdfFiles = null;
            string filePath = "";
            string fileExtension = (isCSV ? ".csv" : ".pdf");
            //string fileName = shid.ToString() + "_TonTrkCnt_" + DateTime.Now.ToString("yyMMddHHmmss") + (isCSV ? ".csv" : ".pdf");

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                pdfFiles = pdfDir.GetFiles(fileName + "*" + fileExtension);
                fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + fileExtension;

                filePath = pdfDir.FullName + @"\" + fileName;
                ReportBuilder(cropYear, shid, contractNumbers, isCSV, filePath);

                return filePath;
            }
            catch (System.Exception ex) {

                string errMsg = "cropYear: " + cropYear + "; " +
                    "Contract numbers: " + contractNumbers + "; " +
                    "fileName: " + fileName + "; " +
                    "pdfDir is null: " + (pdfDir == null).ToString() + "; " +
                    "pdfFiles is null: " + (pdfFiles == null).ToString() + "; " +
                    "filesPath: " + filePath;

                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException("HReports.rptTonsByTruckByContract.ReportPackager: " + errMsg, ex);
                throw (wscex);
            }
        }
예제 #48
0
        public static void ReportBuilder(SqlDataReader dr, int cropYear, DateTime letterDate, DateTime deadlineDate, string logoUrl, System.IO.FileStream fs)
        {
            const string METHOD_NAME = "ReportBuilder";
            const float primaryLeading = 13.5F;
            const float primaryLeftIndent = 20F;
            string strLetterDate = letterDate.ToString("MMMM dd, yyyy");
            string strDeadlineDate = deadlineDate.ToString("MMMM dd, yyyy");
            string LdoBusinessName = "";
            string tmpStr = "";
            string tmpStr2 = "";

            Document document = null;
            PdfWriter writer = null;
            LandownerLetterEvent pgEvent = null;
            ColumnText ct = null;
            iTextSharp.text.Image imgLogo = null;

            try {

                while (dr.Read()) {

                    LdoBusinessName = dr["LdoBusinessName"].ToString();
                    string LdoAddressLine1 = dr["LdoAddressLine1"].ToString();
                    string LdoAddressLine2 = dr["LdoAddressLine2"].ToString();
                    string LdoCityStateZip = dr["LdoCityStateZip"].ToString();

                    if (document == null) {

                        // IF YOU CHANGE MARGINS, CHANGE YOUR TABLE LAYOUTS !!!
                        //  ***  US LETTER: 612 X 792  ***
                        document = new Document(PortraitPageSize.PgPageSize, PortraitPageSize.PgLeftMargin,
                            PortraitPageSize.PgRightMargin, PortraitPageSize.PgTopMargin, PortraitPageSize.PgBottomMargin);

                        imgLogo = PdfReports.GetImage(logoUrl, 127, 50, iTextSharp.text.Element.ALIGN_CENTER);

                        // we create a writer that listens to the document
                        // and directs a PDF-stream to a file
                        writer = PdfWriter.GetInstance(document, fs);

                        // Attach my override event handler(s)
                        pgEvent = new LandownerLetterEvent();
                        pgEvent.FillEvent(imgLogo, strLetterDate, LdoBusinessName, LdoAddressLine1, LdoAddressLine2, LdoCityStateZip);
                        writer.PageEvent = pgEvent;

                        // Open the document
                        document.Open();

                    } else {
                        pgEvent.FillEvent(imgLogo, strLetterDate, LdoBusinessName, LdoAddressLine1, LdoAddressLine2, LdoCityStateZip);
                        document.NewPage();
                    }

                    ct = pgEvent.GetColumnObject();

                    Paragraph p = new Paragraph(primaryLeading, "Your tenant, " + dr["GroBusinessName"].ToString() +
                    ", has indicated that the proceeds for sugar beets grown on your land in\n" +
                    cropYear.ToString() + " are to be split and you will be receiving " + dr.GetDecimal(dr.GetOrdinal("LdoSplitPercent")).ToString("##.0##") +
                    "% of the proceeds. Since Western Sugar Cooperative no\n" +
                    "longer requires signatures for the second payees, this letter has been sent for your verification.\n\n", _normalFont);

                    ct.AddElement(p);

                    p = new Paragraph(new Phrase(primaryLeading, "Your check will be made payable as follows:", _normalFont));
                    ct.AddElement(p);
                    p = new Paragraph(primaryLeading, dr["ldoPayeeDescription"].ToString(), _normalFont);
                    p.IndentationLeft = primaryLeftIndent;
                    ct.AddElement(p);

                    p = new Paragraph(primaryLeading, "If you have a lien on the beets, the lien holder’s name should be included above.\n\n" +
                    "In addition, the following options were selected by your tenant.", _normalFont);
                    ct.AddElement(p);

                    decimal ldoChemPct = dr.GetDecimal(dr.GetOrdinal("LdoChemicalSplitPct"));
                    if (dr.GetBoolean(dr.GetOrdinal("IsSplitChemical")) && ldoChemPct != 0) {
                        tmpStr = ldoChemPct.ToString("##.0##") + "%";
                    } else {
                        tmpStr = "No";
                    }

                    decimal ldoRetainPct = dr.GetDecimal(dr.GetOrdinal("LdoSplitPercent"));
                    if (dr.GetBoolean(dr.GetOrdinal("IsSplitRetain")) && ldoRetainPct != 0) {
                        tmpStr2 = ldoRetainPct.ToString("##.0##") + "% of the";
                    } else {
                        tmpStr2 = "No";
                    }

                    p = new Paragraph(primaryLeading, tmpStr2 + " Unit Retains on this contract will be deducted from your proceeds.\n" +
                    tmpStr + " seed & chemical receivables charged to this contract will be deducted from your proceeds.", _normalFont);
                    p.IndentationLeft = primaryLeftIndent;
                    ct.AddElement(p);

                    p = new Paragraph(primaryLeading, "If the above information is correct, no response is needed.\n\n", _normalFont);
                    ct.AddElement(p);

                    p = new Paragraph(primaryLeading, "If any of the above information is not correct, please contact your tenant’s agriculturist, " +
                    dr["AgriculturistName"].ToString() +
                    " at\n" + WSCIEMP.Common.CodeLib.FormatPhoneNumber2Display(dr["AgriculturistPhone"].ToString()) +
                    " by " + strDeadlineDate + ", or mail the corrections to:\n\n", _normalFont);
                    ct.AddElement(p);

                    p = new Paragraph(12F, "Western Sugar Cooperative\n" +
                    "Attn: Marty Smith\n" +
                    "1221 8th Avenue Unit E\n" +
                    "Greeley, CO  80631\n\n", _normalFont);
                    p.IndentationLeft = primaryLeftIndent;
                    ct.AddElement(p);

                    p = new Paragraph(primaryLeading, "Sincerely,\n\n" +
                    "Marty Smith\n" +
                    "Beet Accounting Manager\n\n" +
                    "Ref: " + dr["ContractNo"].ToString(), _normalFont);
                    ct.AddElement(p);

                    ct.Go(false);

                }
                // ======================================================
                // Close document
                // ======================================================
                if (document != null) {

                    pgEvent.IsDocumentClosing = true;
                    document.Close();
                    document = null;
                }
                if (writer == null || String.IsNullOrEmpty(LdoBusinessName)) {
                    // Warn that we have no data.
                    WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("No records matched your report criteria.");
                    throw (warn);
                }
            }
            catch (Exception ex) {
                string errMsg = "document is null: " + (document == null).ToString() + "; " +
                    "writer is null: " + (writer == null).ToString();
                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + errMsg, ex);
                throw (wscex);
            }
            finally {

                if (document != null) {
                    pgEvent.IsDocumentClosing = true;
                    document.Close();
                }
                if (writer != null) {
                    writer.Close();
                }
            }
        }
예제 #49
0
        public static string ReportPackager(int cropYear, DateTime letterDate, DateTime deadlineDate,
            string factoryList, string stationList, string contractList, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string METHOD_NAME = "ReportPackager";
            DirectoryInfo pdfDir = null;
            FileInfo[] pdfFiles = null;
            string filePath = "";

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                pdfFiles = pdfDir.GetFiles(fileName + "*.pdf");
                fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf";

                filePath = pdfDir.FullName + @"\" + fileName;

                try {

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

                        using (SqlDataReader dr = WSCPayment.GetLandownerLetter(conn, cropYear, factoryList, stationList, contractList)) {

                            //rptLandownerLetterHelper ldoHelper = new rptLandownerLetterHelper();
                            using (System.IO.FileStream fs = new FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read)) {
                                //ldoHelper.ReportBuilder(page, dr, cropYear, letterDate, deadlineDate, fs);
                                ReportBuilder(dr, cropYear, letterDate, deadlineDate, logoUrl, fs);
                            }
                        }
                    }
                }
                catch (System.Exception ex) {
                    string errMsg = "cropYear: " + cropYear.ToString();

                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + errMsg, ex);
                    throw (wscEx);
                }

                return filePath;
            }
            catch (System.Exception ex) {
                string errMsg = "cropYear: " + cropYear.ToString();

                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + errMsg, ex);
                throw (wscEx);
            }
        }
예제 #50
0
        private static void ReportBuilder(int paymentCropYear, string filePath)
        {
            const string METHOD_NAME = "ReportBuilder";
            const string QUOTE = "\"";

            try {

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

                    List<List1099ExportItem> stateList = WSCPayment.GetBeet1099Export(paymentCropYear);

                    using (StreamWriter sw = new StreamWriter(filePath, false)) {

                        foreach (List1099ExportItem state in stateList) {

                            //SHID, TaxID, Business Name, Address 1, Address 2, City, State, Zip, Dollars
                            sw.Write(QUOTE + state.SHID + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxID + QUOTE + ",");
                            sw.Write(QUOTE + state.BusName + QUOTE + ",");
                            sw.Write(QUOTE + state.Address1 + QUOTE + ",");
                            sw.Write(QUOTE + state.Address2 + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxCity + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxState + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxZip + QUOTE + ",");
                            sw.Write(QUOTE + state.TaxDollars + QUOTE + Environment.NewLine);
                        }

                        sw.Close();
                    }
                }
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscex);
            }
        }
예제 #51
0
        private static void ReportBuilder(List<SHPaySumListItem> stateList, int cropYear, string statementDate, string shid,
            string fromShid, string toShid, int paymentDescID, bool isCumulative, string rptFooter, string logoUrl, FileStream fs)
        {
            const string METHOD_NAME = "rptPaymentSummary.ReportBuilder: ";
            Document document = null;
            PdfWriter writer = null;
            PdfPTable table = null;
            PaymentSummaryEvent pgEvent = null;
            iTextSharp.text.Image imgLogo = null;

            decimal totalTons = 0;
            decimal totalEHPrem = 0;
            decimal totalGross = 0;
            decimal totalDeductions = 0;
            decimal totalNet = 0;
            decimal totalGrowerNet = 0;
            decimal totalLandownerNet = 0;
            decimal checkAmount = 0;
            int resetFlag = 0;
            int checkSequence = 0;
            int payeeNumber = 0;

            string rptTitle = "Western Sugar Cooperative Payment Summary";

            Font headerFont = FontFactory.GetFont("HELVETICA", 8F, Font.NORMAL);
            Font normalFont = FontFactory.GetFont("HELVETICA", 8F, Font.NORMAL);
            Font labelFont = FontFactory.GetFont("HELVETICA", 8F, Font.BOLD);

            try {

                int firstContractNumber = stateList.Min(c => c.i_ContractNumber);
                int lastContractNumber = stateList.Max(c => c.i_ContractNumber);

                List<TransDeductionListItem> deductionList = WSCPayment.GetTransmittalDeduction2(ConfigurationManager.ConnectionStrings["BeetConn"].ToString(),
                    cropYear, paymentDescID, 0, firstContractNumber, lastContractNumber, isCumulative);

                foreach (SHPaySumListItem item in stateList) {

                    if (document == null) {

                        // IF YOU CHANGE MARGINS, CHANGE YOUR TABLE LAYOUTS !!!
                        //  ***  US LETTER: 612 X 792  ***
                        //document = new Document(iTextSharp.text.PageSize.LETTER, 36, 36, 54, 72);
                        document = new Document(PortraitPageSize.PgPageSize, PortraitPageSize.PgLeftMargin,
                            PortraitPageSize.PgRightMargin, PortraitPageSize.PgTopMargin, PortraitPageSize.PgBottomMargin);

                        // we create a writer that listens to the document
                        // and directs a PDF-stream to a file
                        writer = PdfWriter.GetInstance(document, fs);

                        imgLogo = PdfReports.GetImage(logoUrl, 127, 50, iTextSharp.text.Element.ALIGN_CENTER);

                        // Attach my override event handler(s)
                        checkSequence = item.i_CheckSequence;
                        pgEvent = new PaymentSummaryEvent();
                        pgEvent.FillEvent(item, cropYear, statementDate, resetFlag, rptTitle, imgLogo);

                        writer.PageEvent = pgEvent;
                        pgEvent.HeaderNameList = _detailSectionHdrNames;
                        pgEvent.HeaderTableLayout = _primaryTableLayout;

                        // Open the document
                        document.Open();
                        pgEvent.HeaderTableLayout = null;

                        table = PdfReports.CreateTable(_primaryTableLayout, 1);
                        checkAmount = item.d_checkAmount;
                        payeeNumber = item.i_Payee_Number;

                    } else {

                        if (checkSequence != item.i_CheckSequence) {

                            AddTotals(ref writer, ref document, ref table, labelFont, normalFont, totalTons,
                                totalEHPrem, totalGross, totalDeductions, totalNet, checkAmount,
                                payeeNumber, totalGrowerNet, totalLandownerNet, pgEvent);
                            AddFooter(ref writer, ref document, normalFont, rptFooter, pgEvent);

                            // Clear totals values
                            totalTons = 0;
                            totalEHPrem = 0;
                            totalGross = 0;
                            totalDeductions = 0;
                            totalNet = 0;
                            totalGrowerNet = 0;
                            totalLandownerNet = 0;

                            checkSequence = item.i_CheckSequence;

                            // NEW CHECK
                            pgEvent.FillEvent(item, cropYear, statementDate, resetFlag, rptTitle, imgLogo);
                            pgEvent.HeaderTableLayout = _primaryTableLayout;

                            document.NewPage();
                            pgEvent.HeaderTableLayout = null;

                            table = PdfReports.CreateTable(_primaryTableLayout, 1);
                            checkAmount = item.d_checkAmount;
                            payeeNumber = item.i_Payee_Number;

                            //AddDetailSectionHdr(ref table, labelFont, normalFont);
                        }
                    }

                    // =======================================================
                    // Contract Number Line
                    // =======================================================
                    PdfReports.AddText2Table(table, "Contract", labelFont, "left");
                    PdfReports.AddText2Table(table, item.i_ContractNumber.ToString(), labelFont, "center");
                    PdfReports.AddText2Table(table, " ", normalFont);
                    PdfReports.AddText2Table(table, item.d_Avg_SLM.ToString("N4"), normalFont, "right");

                    PdfReports.AddText2Table(table, " ", normalFont, 3);
                    PdfReports.AddText2Table(table, item.d_EH_Bonus.ToString("N2"), normalFont, "right", 2);
                    totalEHPrem += item.d_EH_Bonus;
                    PdfReports.AddText2Table(table, " ", normalFont, 4);

                    // =======================================================
                    // Station Name Line
                    // =======================================================
                    PdfReports.AddText2Table(table, "Station", normalFont);
                    PdfReports.AddText2Table(table, item.s_Station_Name, normalFont, "center");
                    PdfReports.AddText2Table(table, "EH", normalFont, "center");
                    PdfReports.AddText2Table(table, item.d_EH_SLM.ToString("N4"), normalFont, "right");
                    PdfReports.AddText2Table(table, item.d_EH_Sugar.ToString("N2"), normalFont, "right");
                    PdfReports.AddText2Table(table, item.d_EH_Paid.ToString("N3"), normalFont, "right");
                    PdfReports.AddText2Table(table, item.d_EH_Price.ToString("N3"), normalFont, "right");

                    PdfReports.AddText2Table(table, (item.d_EH_Tons - item.d_EH_tons_moved).ToString("N4"), normalFont, "right");
                    totalTons += item.d_EH_Tons;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    PdfReports.AddText2Table(table, (item.d_EH_Gross_Pay - item.d_EH_amt_moved).ToString("N2"), normalFont, "right");
                    totalGross += item.d_EH_Gross_Pay;

                    PdfReports.AddText2Table(table, " ", normalFont, 3);

                    // =======================================================
                    // Landowner Name Line
                    // =======================================================
                    PdfReports.AddText2Table(table, "LO", normalFont);
                    PdfReports.AddText2Table(table, item.s_LOName, normalFont, "center");
                    PdfReports.AddText2Table(table, "RH", normalFont, "center");

                    PdfReports.AddText2Table(table, item.d_RH_SLM.ToString("N4"), normalFont, "right");
                    PdfReports.AddText2Table(table, item.d_RH_Sugar.ToString("N2"), normalFont, "right");
                    PdfReports.AddText2Table(table, item.d_RH_Paid.ToString("N3"), normalFont, "right");
                    PdfReports.AddText2Table(table, item.d_RH_Price.ToString("N3"), normalFont, "right");

                    PdfReports.AddText2Table(table, (item.d_RH_Tons - item.d_RH_tons_moved).ToString("N4"), normalFont, "right");
                    totalTons += item.d_RH_Tons;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    PdfReports.AddText2Table(table, (item.d_RH_Gross_Pay - item.d_RH_amt_moved).ToString("N2"), normalFont, "right");
                    totalGross += item.d_RH_Gross_Pay;

                    PdfReports.AddText2Table(table, item.d_Deduct_Total.ToString("N2"), normalFont, "right");
                    totalDeductions += item.d_Deduct_Total;

                    PdfReports.AddText2Table(table, (item.d_Total_Net - item.d_EH_amt_moved - item.d_RH_amt_moved).ToString("N2"), normalFont, "right");
                    totalNet += item.d_Total_Net;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    // =======================================================
                    // Reduced for Excess Beets
                    // =======================================================
                    // Reduced Early Harvest
                    PdfReports.AddText2Table(table, "Reduced Early Harvest Excess Beets", normalFont, 3);
                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont, "right");

                    PdfReports.AddText2Table(table, item.d_EH_tons_moved.ToString("#,#.0000;(#,#.0000)"), normalFont, "right");
                    //totalTons += item.d_RH_Tons;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    PdfReports.AddText2Table(table, item.d_EH_amt_moved.ToString("#,#.00;(#,#.00)"), normalFont, "right");
                    //totalGross += item.d_RH_Gross_Pay;

                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    //totalDeductions += item.d_Deduct_Total;

                    PdfReports.AddText2Table(table, item.d_EH_amt_moved.ToString("#,#.00;(#,#.00)"), normalFont, "right");
                    //totalNet += item.d_Total_Net;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    // Reduced Regular Harvest
                    PdfReports.AddText2Table(table, "Reduced Regular Harvest  Excess Beets", normalFont, 3);
                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont, "right");

                    PdfReports.AddText2Table(table, item.d_RH_tons_moved.ToString("#,#.0000;(#,#.0000)"), normalFont, "right");
                    //totalTons += item.d_RH_Tons;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    PdfReports.AddText2Table(table, item.d_RH_amt_moved.ToString("#,#.00;(#,#.00)"), normalFont, "right");
                    //totalGross += item.d_RH_Gross_Pay;

                    PdfReports.AddText2Table(table, " ", normalFont, "right");
                    //totalDeductions += item.d_Deduct_Total;

                    PdfReports.AddText2Table(table, item.d_RH_amt_moved.ToString("#,#.00;(#,#.00)"), normalFont, "right");
                    //totalNet += item.d_Total_Net;

                    PdfReports.AddText2Table(table, " ", normalFont);

                    // =======================================================
                    // Grower / Landowner NET Split
                    // =======================================================
                    PdfReports.AddText2Table(table, " ", normalFont, 9);
                    PdfReports.AddText2Table(table, "Grower Net", labelFont, 2);
                    totalGrowerNet += item.d_groAmount;
                    PdfReports.AddText2Table(table, item.d_groAmount.ToString("N2"), normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont);

                    PdfReports.AddText2Table(table, " ", normalFont, 9);
                    PdfReports.AddText2Table(table, "Landowner Net", labelFont, 2);
                    totalLandownerNet += item.d_ldoAmount;
                    PdfReports.AddText2Table(table, item.d_ldoAmount.ToString("N2"), normalFont, "right");
                    PdfReports.AddText2Table(table, " ", normalFont);

                    // BLANK LINE
                    PdfReports.AddText2Table(table, " ", normalFont, 13);

                    pgEvent.HeaderTableLayout = _primaryTableLayout;
                    PdfReports.AddTableNoSplit(document, pgEvent, table);
                    pgEvent.HeaderTableLayout = null;

                    //================================================================
                    // Add Deduction information
                    //================================================================

                    table = PdfReports.CreateTable(_primaryTableLayout, 1);

                    PdfReports.AddText2Table(table, " ", labelFont, 4);
                    PdfReports.AddText2Table(table, "Deduction", labelFont, "left", 4);
                    PdfReports.AddText2Table(table, "Payment", labelFont, "left", 2);
                    PdfReports.AddText2Table(table, "Amount", labelFont, "center");
                    PdfReports.AddText2Table(table, " ", labelFont, 2);

                    var contractDeductions = from deduction in deductionList
                                            where deduction.Contract_Number == item.i_ContractNumber
                                            && deduction.Payment_Number <= item.i_PaymentNumber
                                            orderby deduction.Payment_Number, deduction.Deduction_Number
                                            select deduction;

                    foreach(TransDeductionListItem dedItem in contractDeductions) {

                        if (dedItem.Amount != 0) {
                            PdfReports.AddText2Table(table, " ", labelFont, 4);
                            PdfReports.AddText2Table(table, dedItem.Deduction_Desc, normalFont, "left", 4);
                            PdfReports.AddText2Table(table, dedItem.Payment_Description, normalFont, "left", 2);
                            PdfReports.AddText2Table(table, dedItem.Amount.ToString("$#,##0.00"), normalFont, "right");
                            PdfReports.AddText2Table(table, " ", labelFont, 2);
                        }
                    }

                    PdfReports.AddText2Table(table, " ", normalFont, 13);
                }

                // BLANK LINE
                PdfReports.AddText2Table(table, " ", normalFont, 13);
                PdfReports.AddTableNoSplit(document, pgEvent, table);

                table = PdfReports.CreateTable(_primaryTableLayout, 1);

                // ======================================================
                // Close document
                // ======================================================
                if (document != null) {

                    table = PdfReports.CreateTable(_primaryTableLayout, 1);

                    AddTotals(ref writer, ref document, ref table, labelFont, normalFont, totalTons,
                        totalEHPrem, totalGross, totalDeductions, totalNet, checkAmount,
                        payeeNumber, totalGrowerNet, totalLandownerNet, pgEvent);

                    AddFooter(ref writer, ref document, normalFont, rptFooter, pgEvent);

                    pgEvent.IsDocumentClosing = true;
                    document.Close();
                    document = null;
                }
                if (writer == null) {
                    // Warn that we have no data.
                    WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("No records matched your report criteria.");
                    throw (warn);
                }
            }
            catch (Exception ex) {
                string errMsg = "document is null: " + (document == null).ToString() + "; " +
                    "writer is null: " + (writer == null).ToString();
                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex);
                throw (wscex);
            }
            finally {

                if (document != null) {
                    pgEvent.IsDocumentClosing = true;
                    document.Close();
                }
                if (writer != null) {
                    writer.Close();
                }
            }
        }
예제 #52
0
        public static string ReportPackager(
            int cropYear, string statementDate, string shid, string fromShid, string toShid, int paymentDescID,
            bool isCumulative, string footerText, string fileName, string logoUrl, string pdfTempfolder)
        {
            const string METHOD_NAME = "rptPaymentSummary.ReportPackager: ";
            DirectoryInfo pdfDir = null;
            FileInfo[] pdfFiles = null;
            string filePath = "";

            try {

                pdfDir = new DirectoryInfo(pdfTempfolder);

                // Build the output file name by getting a list of all PDF files
                // that begin with this session ID: use this as a name incrementer.
                pdfFiles = pdfDir.GetFiles(fileName + "*.pdf");
                fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf";

                filePath = pdfDir.FullName + @"\" + fileName;

                try {

                    // Because this report is built by data in one data set driving the selection of
                    // data in a dependent dataset, all the data retrival has to be driven down to the
                    // ReportBuilder.  This is not the typical situation.
                    if (shid.Length == 0 && fromShid.Length == 0 && toShid.Length == 0) {
                        WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter SHID information before requesting a report.");
                        throw (warn);
                    } else {

                        if (shid.Length > 0 && (fromShid.Length > 0 || toShid.Length > 0)) {
                            WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a single SHID or a SHID range, but not both.");
                            throw (warn);
                        }

                        List<SHPaySumListItem> stateList = WSCPayment.GetPaymentSummary(ConfigurationManager.ConnectionStrings["BeetConn"].ToString(),
                            cropYear, shid, fromShid, toShid, paymentDescID, isCumulative);

                        if (stateList.Count != 0) {
                            using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write)) {
                                ReportBuilder(stateList, cropYear, statementDate, shid, fromShid, toShid, paymentDescID, isCumulative, footerText, logoUrl, fs);
                            }
                        } else {
                            WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("SHID does not have the required transmittal records or rollup records to create a Payment Summary report.");
                            throw (warn);
                        }
                    }
                }
                catch (System.Exception ex) {
                    string errMsg = "cropYear: " + cropYear.ToString() + "; " +
                        "SHID: " + shid + "; " +
                        "From SHID: " + fromShid + "; " +
                        "To SHID: " + toShid + "; " +
                        "filePath: " + filePath + "; " +
                        "Payment Desc ID: " + paymentDescID.ToString();

                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex);
                    throw (wscEx);
                }

                return filePath;
            }
            catch (System.Exception ex) {
                string errMsg = "cropYear: " + cropYear.ToString() + "; " +
                    "SHID: " + shid + "; " +
                    "From SHID: " + fromShid + "; " +
                    "To SHID: " + toShid + "; " +
                    "Payment Desc ID: " + paymentDescID.ToString();

                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex);
                throw (wscEx);
            }
        }
예제 #53
0
        public static List<BeetPaymentListItem> RptBeetPayBreakdown(string connStr, int shid,
			int cropYear, int calYear)
        {
            const string METHOD_NAME = "RptBeetPayBreakdown: ";

            try {

                string procName = "bawpRptBeetPayBreakdown";

                List<BeetPaymentListItem> stateList = new List<BeetPaymentListItem>();

                using (SqlConnection conn = new SqlConnection(connStr)) {

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = shid;
                    spParams[1].Value = cropYear;
                    spParams[2].Value = calYear;

                    try {

                        using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {

                            int iSHID = dr.GetOrdinal("SHID"),
                            iPayeeName = dr.GetOrdinal("PayeeName"),
                            iCropYear = dr.GetOrdinal("CropYear"),
                            iCalendarYear = dr.GetOrdinal("CalendarYear"),
                            iPaymentNumber = dr.GetOrdinal("PaymentNumber"),
                            iPaymentDescription = dr.GetOrdinal("PaymentDescription"),
                            iTransmittalDate = dr.GetOrdinal("TransmittalDate"),
                            iGrossDollars = dr.GetOrdinal("GrossDollars"),
                            iPaymentAmount = dr.GetOrdinal("PaymentAmount");

                            while (dr.Read()) {

                                stateList.Add(new BeetPaymentListItem(
                                    dr.GetInt32(iSHID),
                                    dr.GetString(iPayeeName),
                                    dr.GetInt32(iCropYear),
                                    dr.GetInt32(iCalendarYear),
                                    dr.GetInt32(iPaymentNumber),
                                    dr.GetString(iPaymentDescription),
                                    dr.GetDateTime(iTransmittalDate),
                                    dr.GetDecimal(iGrossDollars),
                                    dr.GetDecimal(iPaymentAmount)

                                ));
                            }
                        }

                        return stateList;
                    }
                    catch (SqlException sqlEx) {
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, sqlEx);
                            throw (wscEx);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, e);
                throw (wscEx);
            }
        }
예제 #54
0
        public static List<ListOverPlantMemberItem> OverPlantMemberGetInfo(int memberID, int cropYear, string userNname)
        {
            const string METHOD_NAME = "OverPlantMemberGetInfo";

            List<ListOverPlantMemberItem> state = new List<ListOverPlantMemberItem>();

            try {

                string procName = "bawpOverPlantMemberGetInfo";

                try {

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

                        if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                        System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                        spParams[0].Value = memberID;
                        spParams[1].Value = cropYear;
                        spParams[2].Value = userNname;

                        using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {

                            int iOverPlantID = dr.GetOrdinal("OverPlantID");
                            int iMemberID = dr.GetOrdinal("MemberID");
                            int iShid = dr.GetOrdinal("SHID");
                            int iOverPlantAccept = dr.GetOrdinal("OverPlantAccept");
                            int iOverPlantUsed = dr.GetOrdinal("OverPlantUsed");
                            int iIsFormReceived = dr.GetOrdinal("IsFormReceived");
                            int iPatronSharesOwned = dr.GetOrdinal("PatronSharesOwned");
                            int iOverPlantPct = dr.GetOrdinal("OverPlantPct");
                            int iOverPlantPossible = dr.GetOrdinal("OverPlantPossible");
                            int iHomeFactoryNumber = dr.GetOrdinal("HomeFactoryNumber");
                            int iHomeFactoryName = dr.GetOrdinal("HomeFactoryName");
                            int iOverPlantFactoryNumber = dr.GetOrdinal("OverPlantFactoryNumber");
                            int iOverPlantFactoryName = dr.GetOrdinal("OverPlantFactoryName");
                            int iIsOverridePct = dr.GetOrdinal("IsOverridePct");
                            int iIsOverPlantAllowed = dr.GetOrdinal("IsOverPlantAllowed");

                            while (dr.Read()) {

                                state.Add(new ListOverPlantMemberItem(dr.GetInt32(iOverPlantID), dr.GetInt32(iMemberID),
                                    dr.GetString(iShid), dr.GetString(iOverPlantAccept), dr.GetInt32(iOverPlantUsed),
                                    dr.GetBoolean(iIsFormReceived), dr.GetInt32(iPatronSharesOwned), dr.GetDecimal(iOverPlantPct), dr.GetInt32(iOverPlantPossible),
                                    dr.GetString(iHomeFactoryNumber), dr.GetString(iHomeFactoryName), dr.GetString(iOverPlantFactoryNumber), dr.GetString(iOverPlantFactoryName),
                                    dr.GetBoolean(iIsOverridePct), dr.GetBoolean(iIsOverPlantAllowed)));
                            }
                        }
                    }
                }
                catch (SqlException sqlEx) {
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    } else {
                        throw (sqlEx);
                    }
                }
            }
            catch (System.Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wscEx);
            }

            return state;
        }
예제 #55
0
        public static SqlDataReader GetEquityPaymentExport(SqlConnection conn, int paymentCropYear, bool isPatronage, string paymentType, string paymentDate,
            ref System.Data.SqlClient.SqlParameter outParam)
        {
            const string METHOD_NAME = "GetEquityPaymentExport";
            SqlDataReader dr = null;

            try {

                if (isPatronage) {

                    string procName = "bawpPatronagePaymentExport";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = paymentCropYear;
                    spParams[1].Value = paymentType;
                    spParams[2].Value = paymentDate;
                    outParam = spParams[3];
                    SetTimeout();

                    try {
                        dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                    }
                    catch (SqlException sqlEx) {
                        if (dr != null && !dr.IsClosed) {
                            dr.Close();
                        }
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, sqlEx);
                            throw (wscEx);
                        }
                    }

                } else {

                    string procName = "bawpRetainPaymentExport";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = paymentCropYear;
                    spParams[1].Value = paymentDate;
                    outParam = spParams[2];
                    SetTimeout();

                    try {
                        dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                    }
                    catch (SqlException sqlEx) {
                        if (dr != null && !dr.IsClosed) {
                            dr.Close();
                        }
                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, sqlEx);
                            throw (wscEx);
                        }
                    }

                }
            }
            catch (System.Exception e) {

                if (dr != null && !dr.IsClosed) {
                    dr.Close();
                }
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, e);
                throw (wscEx);
            }

            return dr;
        }
예제 #56
0
        public static List<List1099ExportItem> GetBeet1099Export(int calendarYear)
        {
            const string METHOD_NAME = "GetBeet1099Export";
            List<List1099ExportItem> state = new List<List1099ExportItem>();

            try {

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

                    string procName = "bawpPayment1099Export";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = calendarYear;

                    int iSHID = 0, iTaxID = 0, iBusinessName = 0, iAddress1 = 0, iAddress2 = 0, iCity = 0, iState = 0, iZip = 0, iDollars = 0;
                    using (SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams)) {

                        while (dr.Read()) {

                            if (iSHID == 0) {

                                iSHID = dr.GetOrdinal("cShid");
                                iTaxID = dr.GetOrdinal("cTaxID");
                                iBusinessName = dr.GetOrdinal("cBusName");
                                iAddress1 = dr.GetOrdinal("cAddress1");
                                iAddress2 = dr.GetOrdinal("cAddress2");
                                iCity = dr.GetOrdinal("cCity");
                                iState = dr.GetOrdinal("cState");
                                iZip = dr.GetOrdinal("cZip");
                                iDollars = dr.GetOrdinal("cDollars");
                            }
                            state.Add(new List1099ExportItem(dr.GetString(iSHID), dr.GetString(iTaxID), dr.GetString(iBusinessName),
                                dr.GetString(iAddress1), dr.GetString(iAddress2), dr.GetString(iCity), dr.GetString(iState), dr.GetString(iZip), dr.GetString(iDollars)));
                        }
                    }
                }

                return state;
            }
            catch (SqlException sqlEx) {

                if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                    WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                    throw (wscWarn);
                } else {
                    string errMsg = MOD_NAME + METHOD_NAME;
                    WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, sqlEx);
                    throw (wscEx);
                }
            }
            catch (System.Exception e) {

                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, e);
                throw (wscEx);
            }
        }
예제 #57
0
        public static void CalculatePayment(SqlConnection conn,
            Decimal trialSugarContent, Decimal trialSLMPct, Decimal trialNetReturn, int cropYear,
            ref Decimal qcBeetPaymentPerTon, ref Decimal oldNorthBeetPaymentPerTon,
            ref Decimal oldSouthBeetPaymentPerTon)
        {
            const string METHOD_NAME = "CalculatePayment: ";

            try {

                string procName = "bawpPaymentCalculator";

                if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = trialSugarContent;
                spParams[1].Value = trialSLMPct;
                spParams[2].Value = trialNetReturn;
                spParams[3].Value = cropYear;
                SetTimeout();

                try {

                    SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procName, spParams);

                    qcBeetPaymentPerTon = Convert.ToDecimal(spParams[4].Value);
                    oldNorthBeetPaymentPerTon = Convert.ToDecimal(spParams[5].Value);
                    oldSouthBeetPaymentPerTon = Convert.ToDecimal(spParams[6].Value);
                }
                catch (SqlException sqlEx) {
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    } else {
                        WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, sqlEx);
                        throw (wscEx);
                    }
                }
            }
            catch (System.Exception e) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, e);
                throw (wscEx);
            }
        }
예제 #58
0
        public static SqlDataReader RptContractPayeeSummary1(SqlConnection conn, int cropYear, string shid)
        {
            const string METHOD_NAME = "RptContractPayeeSummary1: ";
            SqlDataReader dr = null;
            string shidList = null;
            string shidLo = null;
            string shidHi = null;

            // Configure the appropriate shid passed parameters based on the incoming
            // shid string.
            if (shid == null || shid.Length == 0) {
                WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("You must enter a SHID or a list or range of SHIDs.");
                throw (warn);
            }

            try {

                BeetDataDomain.SplitShidList(shid, out shidList, out shidLo, out shidHi);

                string procName = "bawpRptContractPayeeSummary1";

                if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = cropYear;
                spParams[1].Value = shidList;
                spParams[2].Value = shidLo;
                spParams[3].Value = shidHi;
                SetTimeout();

                try {
                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                }
                catch (SqlException sqlEx) {
                    if (dr != null && !dr.IsClosed) {
                        dr.Close();
                    }
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    } else {
                        WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, sqlEx);
                        throw (wscEx);
                    }
                }
            }
            catch (System.Exception e) {

                if (dr != null && !dr.IsClosed) {
                    dr.Close();
                }
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, e);
                throw (wscEx);
            }

            return dr;
        }
예제 #59
0
        public static SqlDataReader RptContractPayeeSummary2(SqlConnection conn, int contractNumber, int cropYear)
        {
            const string METHOD_NAME = "RptContractPayeeSummary2: ";
            SqlDataReader dr = null;

            try {

                string procName = "bawpRptContractPayeeSummary2";

                if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                System.Data.SqlClient.SqlParameter[] spParams =
                    SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                spParams[0].Value = contractNumber;
                spParams[1].Value = cropYear;
                SetTimeout();

                try {
                    dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams);
                }
                catch (SqlException sqlEx) {
                    if (dr != null && !dr.IsClosed) {
                        dr.Close();
                    }
                    if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                        WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                        throw (wscWarn);
                    } else {
                        WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, sqlEx);
                        throw (wscEx);
                    }
                }
            }
            catch (System.Exception e) {

                if (dr != null && !dr.IsClosed) {
                    dr.Close();
                }
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME, e);
                throw (wscEx);
            }

            return dr;
        }
예제 #60
0
        public static void OverPlantSave(int overPlantID, int memberID, int cropYear, int overPlantUsed, string overPlantAccept, bool isFormReceived, 
            bool isOverridePct, decimal opMemberPct, int opFactoryNumber, string userName)
        {
            const string METHOD_NAME = "OverPlantSave";

            try {

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

                    string procName = "bawpOverPlantSave";

                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    System.Data.SqlClient.SqlParameter[] spParams =
                        SqlHelperParameterCache.GetSpParameterSet(conn, procName, false);

                    spParams[0].Value = overPlantID;
                    spParams[1].Value = memberID;
                    spParams[2].Value = cropYear;
                    spParams[3].Value = overPlantUsed;
                    spParams[4].Value = overPlantAccept;
                    spParams[5].Value = isFormReceived;
                    spParams[6].Value = isOverridePct;
                    spParams[7].Value = opMemberPct;
                    spParams[8].Value = opFactoryNumber;
                    spParams[9].Value = userName;

                    try {
                        SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procName, spParams);
                    }
                    catch (SqlException sqlEx) {

                        if (sqlEx.Number == Convert.ToInt32(WSCIEMP.Common.CException.KnownError.DataWarning)) {
                            WSCIEMP.Common.CWarning wscWarn = new WSCIEMP.Common.CWarning(sqlEx.Message, sqlEx);
                            throw (wscWarn);
                        } else {
                            throw (sqlEx);
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
        }