예제 #1
0
 public bool UpdateCity(CityDTO obj)
 {
     using (DeveloperEntities DB = new DeveloperEntities())
     {
         using (var dbContextTransaction = DB.Database.BeginTransaction())
         {
             try
             {
                 DB.Configuration.ProxyCreationEnabled = false;
                 DB.Configuration.LazyLoadingEnabled   = false;
                 if (obj == null)
                 {
                     throw new ArgumentNullException("item");
                 }
                 DB.InsertCity(obj.CID, obj.CountryID, obj.CityName);
                 DB.SaveChanges();
                 dbContextTransaction.Commit();
                 return(true);
             }
             catch (Exception)
             {
                 dbContextTransaction.Rollback();
                 throw;
             }
         }
     }
 }
예제 #2
0
 public DocDTO AddDoc(DocDTO obj)
 {
     using (DeveloperEntities DB = new DeveloperEntities())
     {
         using (var dbContextTransaction = DB.Database.BeginTransaction())
         {
             try
             {
                 DB.Configuration.ProxyCreationEnabled = false;
                 DB.Configuration.LazyLoadingEnabled   = false;
                 if (obj == null)
                 {
                     throw new ArgumentNullException("item");
                 }
                 // DB.Sp_InsertUpdateDoc(0,obj.EmpNo,obj.DocName);
                 //obj.ResultID = Convert.ToString(OutputParamValue.Value);
                 DB.SaveChanges();
                 dbContextTransaction.Commit();
                 return(obj);
             }
             catch (Exception)
             {
                 dbContextTransaction.Rollback();
                 throw;
             }
         }
     }
 }
예제 #3
0
 public EmpDTO SaveEmployee(EmpDTO obj)
 {
     using (DeveloperEntities DB = new DeveloperEntities())
     {
         using (var dbContextTransaction = DB.Database.BeginTransaction())
         {
             try
             {
                 DB.Configuration.ProxyCreationEnabled = false;
                 DB.Configuration.LazyLoadingEnabled   = false;
                 if (obj == null)
                 {
                     throw new ArgumentNullException("item");
                 }
                 DB.InsertEmployee(0, obj.EmpName, obj.Salary, obj.DeptName, obj.Designation, obj.EmpFile, obj.UserName, obj.Password, OutputParamValue);
                 obj.ResultID = Convert.ToString(OutputParamValue.Value);
                 DB.SaveChanges();
                 dbContextTransaction.Commit();
                 return(obj);
             }
             catch (Exception)
             {
                 dbContextTransaction.Rollback();
                 throw;
             }
         }
     }
 }
예제 #4
0
 public Product_DTO Add(Product_DTO product)
 {
     using (DeveloperEntities DB = new DeveloperEntities())
     {
         DB.Configuration.ProxyCreationEnabled = false;
         DB.Configuration.LazyLoadingEnabled   = false;
         if (product == null)
         {
             throw new ArgumentNullException("item");
         }
         DB.Sp_InsertUpdateProduct("", product.ProName, product.ProExpDate, 1);
         DB.SaveChanges();
         // product.ProID = Convert.ToInt32(OutputParamValue.Value);
         return(product);
     }
 }