상속: System.Web.UI.Page
예제 #1
0
        private string toJson(ProductVendor vendor)
        {
            string result = string.Empty;

            dynamic record = new ExpandoObject();

            record.Code            = vendor.RecId.ToString();
            record.Name            = vendor.RecId.ToString();
            record.U_COD_ITEM      = vendor.cod_item;
            record.U_COD_FORN      = vendor.cod_forn;
            record.U_COD_FORN_ALT  = vendor.cod_forn_alt;
            record.U_COD_ITEM_ALT  = vendor.cod_item_alt;
            record.U_DIG_ITEM      = vendor.dig_item;
            record.U_DIG_FORN      = vendor.dig_forn;
            record.U_REFERENCIA    = vendor.referencia;
            record.U_DESCRICAO     = vendor.descricao;
            record.U_FATUR_UNID    = vendor.fatur_unid;
            record.U_UF_UNID       = vendor.uf_unid;
            record.U_UF_FATOR      = vendor.uf_fator;
            record.U_UF_FATOR_CONV = vendor.uf_fator_conv;
            record.U_EMB_XML       = vendor.emb_xml;
            record.U_LASTUPDATE    = DateTime.Now;



            result = JsonConvert.SerializeObject(record);

            return(result);
        }
예제 #2
0
        public bool AddProductVendor(ProductVendor productVendor)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(11);
                dbm.AddParameters(0, "@ProductID", productVendor.ProductID);
                dbm.AddParameters(1, "@VendorID", productVendor.VendorID);
                dbm.AddParameters(2, "@AverageLeadTime", productVendor.AverageLeadTime);
                dbm.AddParameters(3, "@StandardPrice", productVendor.StandardPrice);
                dbm.AddParameters(4, "@LastReceiptCost", productVendor.LastReceiptCost);
                dbm.AddParameters(5, "@LastReceiptDate", productVendor.LastReceiptDate);
                dbm.AddParameters(6, "@MinOrderQty", productVendor.MinOrderQty);
                dbm.AddParameters(7, "@MaxOrderQty", productVendor.MaxOrderQty);
                dbm.AddParameters(8, "@OnOrderQty", productVendor.OnOrderQty);
                dbm.AddParameters(9, "@UnitMeasureCode", productVendor.UnitMeasureCode);
                dbm.AddParameters(10, "@ModifiedDate", DateTime.Now);

                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertProductVendor");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddProductVendor");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
예제 #3
0
        ///<summary>
        ///  Update the Typed ProductVendor Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, ProductVendor mock)
        {
            ProductVendorTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
        public ActionResult PostProductVendor(ProductVendor PV)
        {
            try
            {
                using (dbConn ef = new dbConn())
                {
                    ProductVendor pv = new ProductVendor();

                    if (PV.OperationType == "Save")
                    {
                        int id = Convert.ToInt32(ef.ProductVendor.Max(field => (int?)field.ProductID) + 1 ?? 1);
                        pv.ProductID        = id;
                        pv.BusinessEntityID = PV.BusinessEntityID;
                        pv.AverageLeadTime  = PV.AverageLeadTime;
                        pv.StandardPrice    = PV.StandardPrice;
                        pv.LastReceiptCost  = PV.LastReceiptCost;
                        pv.LastReceiptDate  = PV.LastReceiptDate;
                        pv.MinOrderQty      = PV.MinOrderQty;
                        pv.MaxOrderQty      = PV.MaxOrderQty;
                        pv.OnOrderQty       = PV.OnOrderQty;
                        pv.UnitMeasureCode  = PV.UnitMeasureCode;
                        pv.ModifiedDate     = DateTime.Now;
                        ef.ProductVendor.Add(pv);
                        ef.SaveChanges();
                    }

                    if (PV.OperationType == "Update")
                    {
                        pv = ef.ProductVendor.First(row => row.ProductID == PV.ProductID);
                        pv.BusinessEntityID = PV.BusinessEntityID;
                        pv.AverageLeadTime  = PV.AverageLeadTime;
                        pv.StandardPrice    = PV.StandardPrice;
                        pv.LastReceiptCost  = PV.LastReceiptCost;
                        pv.LastReceiptDate  = PV.LastReceiptDate;
                        pv.MinOrderQty      = PV.MinOrderQty;
                        pv.MaxOrderQty      = PV.MaxOrderQty;
                        pv.OnOrderQty       = PV.OnOrderQty;
                        pv.UnitMeasureCode  = PV.UnitMeasureCode;
                        pv.ModifiedDate     = DateTime.Now;
                        ef.SaveChanges();
                    }

                    if (PV.OperationType == "Delete")
                    {
                        pv = ef.ProductVendor.FirstOrDefault(row => row.ProductID == PV.ProductID);
                        ef.ProductVendor.Remove(pv);
                        ef.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(500, " :( Something bad happened: " + ex.Message));
            }
            return(Json(new { success = true, Message = "Successful", JsonRequestBehavior.AllowGet }));
        }
예제 #5
0
        ///<summary>
        ///  Returns a Typed ProductVendor Entity with mock values.
        ///</summary>
        static public ProductVendor CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            ProductVendor mock = ProductVendorTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
        // PUT api/awbuildversion/5
        public void Put(ProductVendor value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.ProductVendorDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.ProductVendorUpdate(value);
            }
        }
예제 #7
0
        async public Task <ProductVendor> Find(List <Criteria> criterias)
        {
            string recid = criterias[0].Value;
            string query = Global.BuildQuery($"U_VSITPRODUCT_VENDORS('{recid}')");

            string data = await _serviceLayerConnector.getQueryResult(query);

            ExpandoObject record = Global.parseQueryToObject(data);

            ProductVendor product = toRecord(record);


            return(product);
        }
예제 #8
0
        public void AddVendorProduct(int vendorId, int productId)
        {
            var vendorProduct = EntitySet <ProductVendor> .Where(x => x.ProductId == productId && x.VendorId == vendorId)
                                .SelectSingle();

            if (vendorProduct != null)
            {
                return;
            }
            vendorProduct = new ProductVendor()
            {
                VendorId = vendorId, ProductId = productId
            };
            EntitySet <ProductVendor> .Insert(vendorProduct);
        }
        // PUT api/awbuildversion/5
        public void Put(ProductVendor value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                {
                    adventureWorks_BC.ProductVendorDelete(value);
                }
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                {
                    adventureWorks_BC.ProductVendorUpdate(value);
                }
            }
        }
예제 #10
0
        private IQueryable <ProductVendor> GetProductVendors()
        {
            ProductVendor pv = new ProductVendor {
                ProductID = 1, BusinessEntityID = 1
            };
            ProductVendor pv2 = new ProductVendor {
                ProductID = 2, BusinessEntityID = 2
            };
            ProductVendor pv3 = new ProductVendor {
                ProductID = 3, BusinessEntityID = 4
            };
            ProductVendor pv4 = new ProductVendor {
                ProductID = 4, BusinessEntityID = 3
            };
            ProductVendor pv5 = new ProductVendor {
                ProductID = 5, BusinessEntityID = 2
            };
            ProductVendor pv6 = new ProductVendor {
                ProductID = 6, BusinessEntityID = 1
            };
            ProductVendor pv7 = new ProductVendor {
                ProductID = 7, BusinessEntityID = 3
            };
            ProductVendor pv8 = new ProductVendor {
                ProductID = 8, BusinessEntityID = 2
            };
            ProductVendor pv9 = new ProductVendor {
                ProductID = 9, BusinessEntityID = 4
            };

            List <ProductVendor> pVendors = new List <ProductVendor>()
            {
                pv,
                pv2,
                pv3,
                pv4,
                pv5,
                pv6,
                pv7,
                pv8,
                pv9
            };


            return(pVendors.AsQueryable());
        }
        public virtual ProductVendor MapBOToEF(
            BOProductVendor bo)
        {
            ProductVendor efProductVendor = new ProductVendor();

            efProductVendor.SetProperties(
                bo.AverageLeadTime,
                bo.BusinessEntityID,
                bo.LastReceiptCost,
                bo.LastReceiptDate,
                bo.MaxOrderQty,
                bo.MinOrderQty,
                bo.ModifiedDate,
                bo.OnOrderQty,
                bo.ProductID,
                bo.StandardPrice,
                bo.UnitMeasureCode);
            return(efProductVendor);
        }
        public virtual BOProductVendor MapEFToBO(
            ProductVendor ef)
        {
            var bo = new BOProductVendor();

            bo.SetProperties(
                ef.ProductID,
                ef.AverageLeadTime,
                ef.BusinessEntityID,
                ef.LastReceiptCost,
                ef.LastReceiptDate,
                ef.MaxOrderQty,
                ef.MinOrderQty,
                ef.ModifiedDate,
                ef.OnOrderQty,
                ef.StandardPrice,
                ef.UnitMeasureCode);
            return(bo);
        }
예제 #13
0
        public void MapEFToBO()
        {
            var           mapper = new DALProductVendorMapper();
            ProductVendor entity = new ProductVendor();

            entity.SetProperties(1, 1, 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1m, "A");

            BOProductVendor response = mapper.MapEFToBO(entity);

            response.AverageLeadTime.Should().Be(1);
            response.BusinessEntityID.Should().Be(1);
            response.LastReceiptCost.Should().Be(1m);
            response.LastReceiptDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.MaxOrderQty.Should().Be(1);
            response.MinOrderQty.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OnOrderQty.Should().Be(1);
            response.ProductID.Should().Be(1);
            response.StandardPrice.Should().Be(1m);
            response.UnitMeasureCode.Should().Be("A");
        }
예제 #14
0
        public ProductVendorCollection GetAllProductVendorDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            ProductVendorCollection cols = new ProductVendorCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductVendorsDynamic");
                while (reader.Read())
                {
                    ProductVendor productVendor = new ProductVendor();
                    productVendor.ProductID       = Int32.Parse(reader["ProductID"].ToString());
                    productVendor.VendorID        = Int32.Parse(reader["VendorID"].ToString());
                    productVendor.AverageLeadTime = Int32.Parse(reader["AverageLeadTime"].ToString());
                    productVendor.StandardPrice   = Decimal.Parse(reader["StandardCost"].ToString());
                    productVendor.LastReceiptCost = Decimal.Parse(reader["LastReceiptCost"].ToString());
                    productVendor.LastReceiptDate = DateTime.Parse(reader["LastReceiptDate"].ToString());
                    productVendor.MinOrderQty     = Int32.Parse(reader["MinOrderQty"].ToString());
                    productVendor.MaxOrderQty     = Int32.Parse(reader["MaxOrderQty"].ToString());
                    productVendor.OnOrderQty      = Int32.Parse(reader["OnOrderQty"].ToString());
                    productVendor.UnitMeasureCode = reader["LastReceiptCost"].ToString();
                    productVendor.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productVendor);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductVendorDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
예제 #15
0
        public ProductVendor toRecord(dynamic record)
        {
            ProductVendor productVendor = new ProductVendor();

            productVendor.RecId         = Guid.Parse(record.Code);
            productVendor.cod_item      = record.U_COD_ITEM;
            productVendor.cod_forn      = record.U_COD_FORN;
            productVendor.cod_forn_alt  = record.U_COD_FORN_ALT;
            productVendor.cod_item_alt  = record.U_COD_ITEM_ALT;
            productVendor.dig_item      = record.U_DIG_ITEM;
            productVendor.dig_forn      = record.U_DIG_FORN;
            productVendor.referencia    = record.U_REFERENCIA;
            productVendor.descricao     = record.U_DESCRICAO;
            productVendor.fatur_unid    = record.U_FATUR_UNID;
            productVendor.uf_unid       = record.U_UF_UNID;
            productVendor.uf_fator      = record.U_UF_FATOR;
            productVendor.uf_fator_conv = record.U_UF_FATOR_CONV;
            productVendor.emb_xml       = record.U_EMB_XML;
            productVendor.lastupdate    = parseDate(record.U_LASTUPDATE);

            return(productVendor);
        }
예제 #16
0
        private ProductVendor toJson(dynamic record)
        {
            ProductVendor vendorItem = new ProductVendor();

            vendorItem.RecId         = Guid.Parse(record.Code);
            vendorItem.cod_item      = record.U_COD_ITEM;
            vendorItem.cod_forn      = record.U_COD_FORN;
            vendorItem.cod_forn_alt  = record.U_COD_FORN_ALT;
            vendorItem.cod_item_alt  = record.U_COD_ITEM_ALT;
            vendorItem.dig_item      = record.U_DIG_ITEM;
            vendorItem.dig_forn      = record.U_DIG_FORN;
            vendorItem.referencia    = record.U_REFERENCIA;
            vendorItem.descricao     = record.U_DESCRICAO;
            vendorItem.fatur_unid    = record.U_FATUR_UNID;
            vendorItem.uf_unid       = record.U_UF_UNID;
            vendorItem.uf_fator      = record.U_UF_FATOR;
            vendorItem.uf_fator_conv = record.U_UF_FATOR_CONV;
            vendorItem.emb_xml       = record.U_EMB_XML;
            vendorItem.lastupdate    = DateTime.Now;

            return(vendorItem);
        }
예제 #17
0
        public ProductVendorCollection GetAllProductVendorCollection()
        {
            IDBManager dbm = new DBManager();
            ProductVendorCollection cols = new ProductVendorCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesAll");
                while (reader.Read())
                {
                    ProductVendor productVendor = new ProductVendor();
                    productVendor.ID              = Int32.Parse(reader["ID"].ToString());
                    productVendor.ProductID       = Int32.Parse(reader["ProductID"].ToString());
                    productVendor.VendorID        = Int32.Parse(reader["VendorID"].ToString());
                    productVendor.AverageLeadTime = Int32.Parse(reader["AverageLeadTime"].ToString());
                    productVendor.StandardPrice   = Decimal.Parse(reader["StandardCost"].ToString());
                    productVendor.LastReceiptCost = Decimal.Parse(reader["LastReceiptCost"].ToString());
                    productVendor.LastReceiptDate = DateTime.Parse(reader["LastReceiptDate"].ToString());
                    productVendor.MinOrderQty     = Int32.Parse(reader["MinOrderQty"].ToString());
                    productVendor.MaxOrderQty     = Int32.Parse(reader["MaxOrderQty"].ToString());
                    productVendor.OnOrderQty      = Int32.Parse(reader["OnOrderQty"].ToString());
                    productVendor.UnitMeasureCode = reader["LastReceiptCost"].ToString();
                    productVendor.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productVendor);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductVendorCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
예제 #18
0
        public ProductVendor GetProductVendor(int productID)
        {
            IDBManager    dbm           = new DBManager();
            ProductVendor productVendor = new ProductVendor();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ProductID", productID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductVendor");
                while (reader.Read())
                {
                    productVendor.ProductID       = Int32.Parse(reader["ProductID"].ToString());
                    productVendor.VendorID        = Int32.Parse(reader["VendorID"].ToString());
                    productVendor.AverageLeadTime = Int32.Parse(reader["AverageLeadTime"].ToString());
                    productVendor.StandardPrice   = Decimal.Parse(reader["StandardCost"].ToString());
                    productVendor.LastReceiptCost = Decimal.Parse(reader["LastReceiptCost"].ToString());
                    productVendor.LastReceiptDate = DateTime.Parse(reader["LastReceiptDate"].ToString());
                    productVendor.MinOrderQty     = Int32.Parse(reader["MinOrderQty"].ToString());
                    productVendor.MaxOrderQty     = Int32.Parse(reader["MaxOrderQty"].ToString());
                    productVendor.OnOrderQty      = Int32.Parse(reader["OnOrderQty"].ToString());
                    productVendor.UnitMeasureCode = reader["LastReceiptCost"].ToString();
                    productVendor.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProductVendor");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(productVendor);
        }
 // POST api/awbuildversion
 public void Post(ProductVendor value)
 {
     adventureWorks_BC.ProductVendorAdd(value);
 }
 /// <summary>
 /// Create a new ProductVendor object.
 /// </summary>
 /// <param name="productID">Initial value of ProductID.</param>
 /// <param name="vendorID">Initial value of VendorID.</param>
 /// <param name="averageLeadTime">Initial value of AverageLeadTime.</param>
 /// <param name="standardPrice">Initial value of StandardPrice.</param>
 /// <param name="minOrderQty">Initial value of MinOrderQty.</param>
 /// <param name="maxOrderQty">Initial value of MaxOrderQty.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static ProductVendor CreateProductVendor(int productID, int vendorID, int averageLeadTime, decimal standardPrice, int minOrderQty, int maxOrderQty, global::System.DateTime modifiedDate)
 {
     ProductVendor productVendor = new ProductVendor();
     productVendor.ProductID = productID;
     productVendor.VendorID = vendorID;
     productVendor.AverageLeadTime = averageLeadTime;
     productVendor.StandardPrice = standardPrice;
     productVendor.MinOrderQty = minOrderQty;
     productVendor.MaxOrderQty = maxOrderQty;
     productVendor.ModifiedDate = modifiedDate;
     return productVendor;
 }
 /// <summary>
 /// There are no comments for ProductVendor in the schema.
 /// </summary>
 public void AddToProductVendor(ProductVendor productVendor)
 {
     base.AddObject("ProductVendor", productVendor);
 }