Exemple #1
0
        public Object Clone()
        {
            ProductStock obj = new ProductStock();

            obj.PSN = this.PSN;

            obj.WorkOrder        = this.WorkOrder;
            obj.OrderNumber      = this.OrderNumber;
            obj.ProductName      = this.ProductName;
            obj.ProductCode      = this.ProductCode;
            obj.MSN              = this.MSN;
            obj.BatchNumber      = this.BatchNumber;
            obj.MANUFACTURE      = this.MANUFACTURE;
            obj.StockHouse       = this.StockHouse;
            obj.DOCUMENTID       = this.DOCUMENTID;
            obj.QUANTITY         = this.QUANTITY;
            obj.UNIT             = this.UNIT;
            obj.STATUS           = this.STATUS;
            obj.FromBy           = this.FromBy;
            obj.MEMO             = this.MEMO;
            obj.CreatedDate      = this.CreatedDate;
            obj.UpdatedDate      = this.UpdatedDate;
            obj.UpdatedBy        = this.UpdatedBy;
            obj.PartsdrawingCode = this.PartsdrawingCode;
            obj.QualityCode      = this.QualityCode;
            return(obj);
        }
Exemple #2
0
 public void CopyTo(ProductStock obj)
 {
     obj.PSN              = this.PSN;
     obj.WorkOrder        = this.WorkOrder;
     obj.OrderNumber      = this.OrderNumber;
     obj.ProductName      = this.ProductName;
     obj.ProductCode      = this.ProductCode;
     obj.MSN              = this.MSN;
     obj.BatchNumber      = this.BatchNumber;
     obj.MANUFACTURE      = this.MANUFACTURE;
     obj.StockHouse       = this.StockHouse;
     obj.DOCUMENTID       = this.DOCUMENTID;
     obj.QUANTITY         = this.QUANTITY;
     obj.UNIT             = this.UNIT;
     obj.STATUS           = this.STATUS;
     obj.FromBy           = this.FromBy;
     obj.MEMO             = this.MEMO;
     obj.CreatedDate      = this.CreatedDate;
     obj.UpdatedDate      = this.UpdatedDate;
     obj.UpdatedBy        = this.UpdatedBy;
     obj.PartsdrawingCode = this.PartsdrawingCode;
     obj.QualityCode      = this.QualityCode;
 }
 partial void DeleteProductStock(ProductStock instance);
 partial void UpdateProductStock(ProductStock instance);
 partial void InsertProductStock(ProductStock instance);
		private void detach_ProductStocks(ProductStock entity)
		{
			this.SendPropertyChanging();
			entity.BaseAttribute = null;
		}
		private void detach_ProductStocks(ProductStock entity)
		{
			this.SendPropertyChanging();
			entity.Product = null;
		}
		private void attach_ProductStocks(ProductStock entity)
		{
			this.SendPropertyChanging();
			entity.Product = this;
		}
        public int saveProductstockupdte(int ProductId, int WareHouseId, int organisationId, int quantity, string Mode)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var data = new ProductStock()
                    {
                        ProductId = ProductId,
                        WareHouseId = WareHouseId,
                        CurrentStock = quantity,
                        OrganisationId = organisationId,
                        InOutMode = Mode,
                    };

                    if (data.InOutMode == "In")
                    {
                        if (data != null) data.CurrentStock += quantity;
                    }
                    else
                    {
                        if (data != null) data.CurrentStock -= quantity;
                    }
                    _context.Entry(data).State = EntityState.Modified;
                    _context.SaveChanges();
                    return data.ProductStockId;

                }
            }
            catch (Exception)
            {

                throw;
            }
        }
        public bool SaveProductStock(List<ProductStockModel> modellist)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    foreach (var productstock in modellist)
                    {
                        var data = GetInfo(productstock.ProductId, productstock.OrganisationId,
                   productstock.WareHouseId);
                        if (data == null)
                        {
                            var model = new ProductStock()
                            {
                                ProductId = productstock.ProductId,
                                OrganisationId = productstock.OrganisationId,
                                WareHouseId = productstock.WareHouseId,
                                CurrentStock = productstock.CurrentStock,
                                OpeningStock = productstock.OpeningStock,
                                InOutMode = productstock.InOutMode,

                            };
                            _context.Entry(model).State = EntityState.Added;
                            _context.SaveChanges();
                        }
                        else
                        {
                            var data1 =
                                _context.ProductStocks.FirstOrDefault(
                                    a =>
                                        a.ProductId == productstock.ProductId &&
                                        a.OrganisationId == productstock.OrganisationId &&
                                        a.WareHouseId == productstock.WareHouseId);
                            data1.CurrentStock = productstock.CurrentStock;
                            data1.OpeningStock = productstock.OpeningStock;
                            _context.Entry(data1).State = EntityState.Modified;
                            _context.SaveChanges();

                        }

                    }

                    return true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }