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

            product.Id = LastIdSvc.GetNextTableId("AgriculturalProducts");
            product.ProductCode = CalculateProductCode(product.InserBy.Company.Id);

            db.AgriculturalProducts.Insert(product);

            return product.Id;
        }
 public AgriculturalProductEditModel(AgriculturalProduct product)
 {
     this.Id = product.Id;
     this.ProductName = product.ProductName;
     this.InsertUserRealName = product.InserBy.RealName;
     this.InsertByUserName = product.InserBy.UserName;
     this.ProductCode = product.ProductCode;
     this.ProductStatus = product.ProductStatus;
     this.BirthDate = product.BirthDate;
     this.Batch = product.Batch;
     this.BreedType = product.BreedType;
     this.GrowthCycle = product.GrowthCycle;
     this.MedicalHistory = product.MedicalHistory;
     this.Weight = product.Weight;
     this.VaccineSituation = product.VaccineSituation;
     this.DeliverDate = product.DeliverDate;
     this.InsertDate = product.InsertDate;
     this.Remarks = product.Remarks;
     this.SecurityStatus = product.SecurityStatus;
 }
        public static void Update(AgriculturalProduct product)
        {
            var db = DataBaseHelper.Open();

            db.AgriculturalProducts.Update(product);
        }