public static int Insert(WholeSaleProduct product)
        {
            var db = DataBaseHelper.Open();

            product.Id = LastIdSvc.GetNextTableId("WholeSaleProducts");
            product.ProductCode = CalculateProductCode(product.InsertBy.Company.Id);

            db.WholeSaleProducts.Insert(product);

            return product.Id;
        }
 public WholeSaleProductEditModel(WholeSaleProduct product)
 {
     this.Id = product.Id;
     this.ProductName = product.ProductName;
     this.ProductCode = product.ProductCode;
     this.ProductStatus = product.ProductStatus;
     this.AgriculturalProductId = product.AgriculturalProductId;
     this.AgriculturalProductName = product.AgriculturalProductName;
     this.ParentId = product.ParentId;
     this.Batch = product.Batch;
     this.SecurityStatus = product.SecurityStatus;
     this.InsertDate = product.InsertDate;
     this.ToCompanyId = product.ToCompany.Id;
     this.FromCompanyName = product.FromCompany.CompanyName;
     this.ToCompanyName = product.ToCompany.CompanyName;
     this.InsertUserName = product.InsertBy.UserName;
     this.InsertUserRealName = product.InsertBy.RealName;
 }
        public static void Update(WholeSaleProduct product)
        {
            var db = DataBaseHelper.Open();

            db.WholeSaleProducts.Update(product);
        }