Пример #1
0
        public static IOBalanceEntity.BatchSummary DtoToEntity(this BatchSummariesDto dto)
        {
            IOBalanceEntity.BatchSummary entity = null;

            if (!dto.IsNull())
            {
                entity = new IOBalanceEntity.BatchSummary
                {
                    BatchNo        = dto.BatchNo == null ? 0 : (long)dto.BatchNo,
                    FileName       = dto.FileName,
                    FilePath       = dto.FilePath,
                    TotalRecords   = dto.TotalRecords,
                    Successful     = dto.Successful,
                    Failed         = dto.Failed,
                    UploadStatus   = dto.UploadStatus,
                    IsDownload     = false,
                    ResultFileName = null,
                    ResultFilePath = null,
                    UploadedBy     = dto.UploadedBy,
                    StartUpload    = dto.StartUpload,
                    EndUpload      = dto.EndUpload
                };
            }

            return(entity);
        }
Пример #2
0
        public InventoryService(IIOBalanceRepository <Product> product,
                                IIOBalanceRepository <BatchSummary> batchSummary,
                                IIOBalanceRepository <BatchProductLog> batchProductLog)
        {
            this._product         = product;
            this._batchSummary    = batchSummary;
            this._batchProductLog = batchProductLog;

            this.product             = new Product();
            this.purchaseOrder       = new PurchaseOrder();
            this.purchaseOrderDetail = new PurchaseOrderDetail();
            this.batchSummary        = new BatchSummary();
            this.batchProductLog     = new BatchProductLog();
        }
Пример #3
0
        //return results:
        //result = 0 -> no error
        //result = 1 -> system error
        //result = 2 -> batch no error
        //result = 3 -> bulk insert batchproductlog error
        //result = 4 -> BATCH UPLOAD data message return <= 0
        //result = 5 -> Successfully inserted ALL records
        //result = 6 -> Successfully inserted but with errors
        //result = 7 -> All records error
        public int SaveBulkProducts(BatchSummariesDto dto, List <BatchProductLogDto> dtoList)
        {
            int result = 0;

            if (!dto.IsNull())
            {
                this.batchSummary = dto.DtoToEntity();
                var batchNoIdentity = _batchSummary.Insert(this.batchSummary).BatchNo;

                if (!batchNoIdentity.IsNull() && batchNoIdentity <= 0)
                {
                    result = 2;
                }
                else
                {
                    if (!SaveProductBulk(dtoList, batchNoIdentity))
                    {
                        result = 3;
                    }
                    else
                    {
                        DataTable      dtResultSet   = new DataTable();
                        SqlParameter[] sqlParameters = new SqlParameter[]
                        {
                            new SqlParameter()
                            {
                                ParameterName = "BatchNo", SqlValue = batchNoIdentity, SqlDbType = SqlDbType.BigInt
                            }
                        };
                        dtResultSet = _product.ExecuteSPReturnTable("uspBatchProductCreation", true, sqlParameters);

                        if (dtResultSet.Rows.Count <= 0)
                        {
                            result = 4;
                        }
                        else
                        {
                            if (dtResultSet.Rows[0][Globals.Result].ToString() == "5")
                            {
                                result = 0;
                            }
                            else if (dtResultSet.Rows[0][Globals.Result].ToString() == "6")
                            {
                                result = 6;
                            }
                            else if (dtResultSet.Rows[0][Globals.Result].ToString() == "7")
                            {
                                result = 7;
                            }
                        }
                    }
                }
            }
            else
            {
                result = 1;
            }


            return(result);
        }