示例#1
0
        public static int UpdateProductInventory(Product objProduct, int LotId)
        {
            int ProductId = 0;
            List<SqlParameter> prams = new List<SqlParameter>();
            try
            {
                using (DbManager db = DbManager.GetDbManager())
                {
                    prams.Add(db.MakeInParam("@DateCreated", SqlDbType.DateTime, 8, objProduct.DateCreated));

                    prams.Add(db.MakeInParam("@ProductShape", SqlDbType.Int, 4, objProduct.ProductShape));
                    prams.Add(db.MakeInParam("@ProductSize", SqlDbType.Int, 4, objProduct.ProductSize));
                    prams.Add(db.MakeInParam("@ProductMaterial ", SqlDbType.Int, 4, objProduct.ProductMaterial));
                    if (string.IsNullOrEmpty(objProduct.ProductField1))
                        prams.Add(db.MakeInParam("@ProductField1", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(db.MakeInParam("@ProductField1", SqlDbType.NVarChar, 10, objProduct.ProductField1));
                    if (string.IsNullOrEmpty(objProduct.ProductField2))
                        prams.Add(db.MakeInParam("@ProductField2", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(db.MakeInParam("@ProductField2", SqlDbType.NVarChar, 10, objProduct.ProductField2));
                    if (string.IsNullOrEmpty(objProduct.ProductField3))
                        prams.Add(db.MakeInParam("@ProductField3", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(db.MakeInParam("@ProductField3", SqlDbType.NVarChar, 10, objProduct.ProductField3));
                    prams.Add(db.MakeInParam("@LangaugeId", SqlDbType.Int, 4, objProduct.LangaugeId));
                    prams.Add(db.MakeInParam("@ProductId", SqlDbType.Int, 4, objProduct.ProductId));
                    prams.Add(db.MakeInParam("@BrandId", SqlDbType.Int, 4, objProduct.BrandId));
                    prams.Add(db.MakeInParam("@LotId", SqlDbType.Int, 4, LotId));

                    ProductId = db.RunProc("up_Product_Update", prams.ToArray());
                }
            }
            catch (Exception ex)
            {
                new SqlLog().InsertSqlLog(0, "Product.cs UpdateProductInventory", ex);
            }

            return ProductId;
        }
示例#2
0
        public static int UpdateProductInventoryForRecieveTypeLoad(Product objProduct)
        {
            int ProductId = 0;
            List<SqlParameter> prams = new List<SqlParameter>();
            try
            {
                using (DbManager db = DbManager.GetDbManager())
                {
                    prams.Add(db.MakeInParam("@SizeNumber", SqlDbType.NVarChar, 10, objProduct.SizeNumber));
                    prams.Add(db.MakeInParam("@ProductShape", SqlDbType.Int, 4, objProduct.ProductShape));
                    prams.Add(db.MakeInParam("@ProductSize", SqlDbType.Int, 4, objProduct.ProductSize));
                    prams.Add(db.MakeInParam("@ProductMaterial ", SqlDbType.Int, 4, objProduct.ProductMaterial));
                    if (string.IsNullOrEmpty(objProduct.ProductField1))
                        prams.Add(db.MakeInParam("@ProductField1", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(db.MakeInParam("@ProductField1", SqlDbType.NVarChar, 10, objProduct.ProductField1));
                    if (string.IsNullOrEmpty(objProduct.ProductField2))
                        prams.Add(db.MakeInParam("@ProductField2", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(db.MakeInParam("@ProductField2", SqlDbType.NVarChar, 10, objProduct.ProductField2));
                    if (string.IsNullOrEmpty(objProduct.ProductField3))
                        prams.Add(db.MakeInParam("@ProductField3", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(db.MakeInParam("", SqlDbType.NVarChar, 10, objProduct.ProductField3));
                    prams.Add(db.MakeInParam("@MonthCode", SqlDbType.NVarChar, 2, objProduct.WeekCode));
                    prams.Add(db.MakeInParam("@YearCode", SqlDbType.NVarChar, 4, objProduct.YearCode));
                    prams.Add(db.MakeInParam("@LangaugeId", SqlDbType.Int, 4, objProduct.LangaugeId));
                    prams.Add(db.MakeInParam("@ProductId", SqlDbType.Int, 4, objProduct.ProductId));
                    prams.Add(db.MakeInParam("@BrandId", SqlDbType.Int, 4, objProduct.BrandId));

                    ProductId = db.RunProc("up_Product_UpdateForLoadReceiving", prams.ToArray());
                }
            }
            catch (Exception ex)
            {
                new SqlLog().InsertSqlLog(0, "Product.cs UpdateProductInventory", ex);
            }

            return ProductId;
        }
示例#3
0
        public static int InsertProdut(Product objProduct)
        {
            List<SqlParameter> prams = new List<SqlParameter>();
            int ProductId = 0;

            try
            {
                using (DbManager DB = DbManager.GetDbManager())
                {
                    //prams.Add(DB.MakeInParam("@BarCodeId ",SqlDbType.Int,4,objProduct.BarCodeId));
                    prams.Add(DB.MakeInParam("@DateCreated", SqlDbType.DateTime, 8, objProduct.DateCreated));
                    prams.Add(DB.MakeInParam("@TX_BarCodeId", SqlDbType.Int, 4, objProduct.Tx_BarCode));
                    prams.Add(DB.MakeInParam("@CreatedById", SqlDbType.Int, 4, objProduct.CreatedByID));
                    prams.Add(DB.MakeInParam("@ProductShape", SqlDbType.Int, 4, objProduct.ProductShape));
                    prams.Add(DB.MakeInParam("@ProductSize", SqlDbType.Int, 4, objProduct.ProductSize));
                    prams.Add(DB.MakeInParam("@ProductMaterial", SqlDbType.Int, 4, objProduct.ProductMaterial));
                    prams.Add(DB.MakeInParam("@BrandId", SqlDbType.Int, 4, objProduct.BrandId));
                    if (string.IsNullOrEmpty(objProduct.ProductField1))
                        prams.Add(DB.MakeInParam("@ProductField1", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(DB.MakeInParam("@ProductField1", SqlDbType.NVarChar, 10, objProduct.ProductField1));
                    if (string.IsNullOrEmpty(objProduct.ProductField2))
                        prams.Add(DB.MakeInParam("@ProductField2", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(DB.MakeInParam("@ProductField2", SqlDbType.NVarChar, 10, objProduct.ProductField2));
                    if (string.IsNullOrEmpty(objProduct.ProductField3))
                        prams.Add(DB.MakeInParam("@ProductField3", SqlDbType.NVarChar, 10, DBNull.Value));
                    else
                        prams.Add(DB.MakeInParam("@ProductField3", SqlDbType.NVarChar, 10, objProduct.ProductField3));

                    prams.Add(DB.MakeInParam("@LangaugeId", SqlDbType.Int, 4, objProduct.LangaugeId));
                    prams.Add(DB.MakeInParam("@image", SqlDbType.Image, -1, objProduct.Image));
                    prams.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, objProduct.OrganizationId));
                    prams.Add(DB.MakeInParam("@SerialNumber", SqlDbType.NVarChar, 200, objProduct.SerialNumber));
                    prams.Add(DB.MakeInParam("@ProductCatId", SqlDbType.Int, 4, objProduct.ProductCategoryId));
                    prams.Add(DB.MakeInParam("@ProductsubCatId", SqlDbType.Int, 4, objProduct.ProductSubCategory));
                    ProductId = DB.RunProc("up_Product_Insert", prams.ToArray());
                }
            }
            catch (Exception ex)
            {
                new SqlLog().InsertSqlLog(0, "Product.InsertProduct", ex);
            }

            return ProductId;
        }