Exemple #1
0
 public bool createOrUpdateManufaturer(OInv.Common.Entities.Manufature manufacture)
 {
     try {
         using (var db = new MainDatabaseEntities())
         {
             if (manufacture.ManufactureId == 0)
             {
                 db.Manufatures.Add(new Manufature {
                     Manufacture_Id = manufacture.ManufactureId, Manufacture_Name = manufacture.ManufactureName
                 });
                 db.SaveChanges();
             }
             else
             {
                 Manufature manu = db.Manufatures.Where(x => x.Manufacture_Id == manufacture.ManufactureId).FirstOrDefault();
                 manu.Manufacture_Name = manufacture.ManufactureName;
                 db.SaveChanges();
             }
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemple #2
0
 public bool createOrUpdateMmodel(OInv.Common.Entities.Model model)
 {
     try
     {
         using (var db = new MainDatabaseEntities())
         {
             if (model.ModelId == 0)
             {
                 // db.Models.Add(new Model { Model_Id = model.ModelId, Model_Name = model.ModelName ,Model_SKU=model.ModelName, Model_Type=model.ModelType,Model_SubType=model.ModelSubType});
                 db.SaveChanges();
             }
             else
             {
                 Model manu = db.Models.Where(x => x.Model_Id == model.ModelId).FirstOrDefault();
                 manu.Model_Name    = model.ModelName;
                 manu.Model_SKU     = model.ModelSKU;
                 manu.Model_Type    = model.ModelSubTypeId;
                 manu.Model_SubType = model.ModelSubTypeId;
                 db.SaveChanges();
             }
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemple #3
0
        public bool createOrUpdateLocation(OInv.Common.Entities.Location location)
        {
            try
            {
                using (var db = new MainDatabaseEntities())
                {
                    if (location.LocationId == 0)
                    {
                        db.Locations.Add(new Location {
                            Location_Id = location.LocationId, Location_Description = location.LocationDescription, Location_Code = location.LocationCode
                        });
                        db.SaveChanges();
                    }
                    else
                    {
                        Location manu = db.Locations.Where(x => x.Location_Id == location.LocationId).FirstOrDefault();
                        manu.Location_Description = location.LocationDescription;
                        manu.Location_Code        = location.LocationCode;

                        db.SaveChanges();
                    }
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
        }