コード例 #1
0
        public DataTable GetAll(DateTime?dateFrom, DateTime?dateTo, int?categoryId, int?branchId = null, long?productId = null)
        {
            DataTable dt = new DataTable();

            SqlParameter[] sqlParameters = new SqlParameter[]
            {
                new SqlParameter()
                {
                    ParameterName = "DateFrom", Value = dateFrom, SqlDbType = SqlDbType.DateTime
                },
                new SqlParameter()
                {
                    ParameterName = "DateTo", Value = dateTo, SqlDbType = SqlDbType.DateTime
                },
                new SqlParameter()
                {
                    ParameterName = "BranchID", Value = branchId, SqlDbType = SqlDbType.Int
                },
                new SqlParameter()
                {
                    ParameterName = "CategoryID", Value = categoryId, SqlDbType = SqlDbType.Int
                },
                new SqlParameter()
                {
                    ParameterName = "ProductID", Value = productId, SqlDbType = SqlDbType.BigInt
                }
            };
            dt = _reportCombination.ExecuteSPReturnTable("uspStockReport", true, sqlParameters);
            return(dt);
        }
コード例 #2
0
        public string SaveBatchUpload(ProductDto dto)
        {
            DataTable dt = new DataTable();

            if (!dto.IsNull())
            {
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter()
                    {
                        ParameterName = "CategoryCode", Value = dto.CategoryCode, SqlDbType = SqlDbType.DateTime
                    },
                    new SqlParameter()
                    {
                        ParameterName = "ProductCode", Value = dto.ProductCode, SqlDbType = SqlDbType.DateTime
                    },
                    new SqlParameter()
                    {
                        ParameterName = "ProductName", Value = dto.ProductName, SqlDbType = SqlDbType.Int
                    },
                    new SqlParameter()
                    {
                        ParameterName = "Extension", Value = dto.ProductExtension, SqlDbType = SqlDbType.Int
                    },
                    new SqlParameter()
                    {
                        ParameterName = "Quantity", Value = dto.Quantity, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "OriginalPrice", Value = dto.OriginalPrice, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "Price", Value = dto.Price, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "Size", Value = dto.Size, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "SupplierCode", Value = dto.SupplierCode, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "BranchName", Value = dto.BranchName, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "Description", Value = dto.ProductDesc, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "Remarks", Value = dto.Remarks, SqlDbType = SqlDbType.BigInt
                    },
                    new SqlParameter()
                    {
                        ParameterName = "CreatedBy", Value = dto.CreatedBy, SqlDbType = SqlDbType.BigInt
                    }
                };
                dt = _reportCombination.ExecuteSPReturnTable("uspSalesReport", true, sqlParameters);

                if (dt.Rows.Count > 0)
                {
                    return(dt.Rows[0].ToString());
                }
                else
                {
                    return(string.Empty);
                }
            }
            else
            {
                return(Messages.ErrorOccuredDuringProcessing);
            }
        }
コード例 #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);
        }