Beispiel #1
0
        public string Post([FromBody] GUGRParameter reportParameter)
        {
            DataSet             ds = new DataSet();
            ManageSQLConnection manageSQLConnection             = new ManageSQLConnection();
            List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();

            sqlParameters.Add(new KeyValuePair <string, string>("@FromDate", reportParameter.FromDate));
            sqlParameters.Add(new KeyValuePair <string, string>("@ToDate", reportParameter.ToDate));
            sqlParameters.Add(new KeyValuePair <string, string>("@GodownCode", reportParameter.GCode));
            sqlParameters.Add(new KeyValuePair <string, string>("@RCode", reportParameter.RCode));
            sqlParameters.Add(new KeyValuePair <string, string>("@Type", reportParameter.Type));
            ds = manageSQLConnection.GetDataSetValues("GETGRGU", sqlParameters);
            ManageGUGR   manageGUGR   = new ManageGUGR();
            ManageReport manageReport = new ManageReport();

            //filter condotions
            if (manageReport.CheckDataAvailable(ds))
            {
                CommonEntity entity = new CommonEntity
                {
                    dataSet  = ds,
                    GCode    = reportParameter.GCode,
                    FromDate = reportParameter.FromDate,
                    Todate   = reportParameter.ToDate,
                    UserName = reportParameter.UserName
                };
                // commodityIssueMemo.GenerateCommodityIssueMemoReport(entity);
                Task.Run(() => manageGUGR.GenerateGUGRReport(entity, reportParameter)); //Generate the Report
            }
            return(JsonConvert.SerializeObject(ds.Tables[0]));
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void GenerateGUGRReport(CommonEntity entity, GUGRParameter param)
        {
            string       fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty;
            StreamWriter streamWriter = null;

            try
            {
                HeaderTitle = (param.Type == "GR") ? "      Gunny Release Details of " : "      Gunny Utilisation Details of ";
                fileName    = (param.Type == "GR") ? (entity.GCode + GlobalVariable.GRReportFileName) : (entity.GCode + GlobalVariable.GUReportFileName);
                fPath       = GlobalVariable.ReportPath + "Reports";
                report.CreateFolderIfnotExists(fPath);      // create a new folder if not exists
                subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder();
                report.CreateFolderIfnotExists(subF_Path);
                //delete file if exists
                filePath = subF_Path + "//" + fileName + ".txt";
                report.DeleteFileIfExists(filePath);

                streamWriter = new StreamWriter(filePath, true);
                DateWiseCommodityWiseGUGRReport(streamWriter, entity);

                List <GUList> guList = new List <GUList>();
                guList = report.ConvertDataTableToList <GUList>(entity.dataSet.Tables[0]);
                WriteGUGRAbstract(streamWriter, guList, entity);
                streamWriter.Flush();
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
            }
            finally
            {
                streamWriter.Close();
                fPath        = string.Empty; fileName = string.Empty;
                streamWriter = null;
            }
        }