Beispiel #1
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);
            }
        }
        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);
            }
        }
        public static string ReportPackager(int cropYear, DateTime fromDate, DateTime toDate, string factoryList, string stationList,
			string contractList, bool isPosted, bool isPreview, bool isHardCopy, bool isEmail, bool isFax, 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 {

                        List<ListGrowerTareItem> hdrList = WSCReportsExec.GrowerDetailReportMasterHdr(cropYear, fromDate, toDate, factoryList,
                            stationList, contractList, isPosted, isHardCopy, isEmail, isFax);

                        if (hdrList.Count == 0) {
                            CWarning warn = new CWarning("No results matched your search criteria.");
                            throw (warn);
                        }

                    using (FileStream fsHardCopy = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read)) {

                            ReportBuilder(hdrList, cropYear, isPosted, isPreview, isHardCopy, isEmail, isFax, fsHardCopy, 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);
                }

                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);
            }
        }