Esempio n. 1
0
 public Tuple <bool, string, long> Save()
 {
     try
     {
         long id = 0;
         using (Easycase.DataModel.EasyCaseDBEntities DB = new DataModel.EasyCaseDBEntities())
         {
             var client = new DataModel.CompanyDetail
             {
                 FirstName        = this.FirstName,
                 Country          = this.Country,
                 LastName         = this.LastName,
                 CreatedBy        = this.CreatedBy,
                 AddressLine1     = this.AddressLine1,
                 AddressLine2     = this.AddressLine2,
                 City             = this.City,
                 CompanyEmail     = this.CompanyEmail,
                 CompanyName      = this.CompanyName,
                 Fax              = this.Fax,
                 MembershipNumber = this.MembershipNumber,
                 MembershipType   = this.MembershipType,
                 PostalCode       = this.PostalCode,
                 Province         = this.Province,
                 Telephone        = this.Telephone,
                 UpdatedOn        = DateTime.Now
             };
             DB.CompanyDetails.Add(client);
             DB.SaveChanges();
             id = client.ID;
         }
         return(new Tuple <bool, string, long>(true, Messages.SUCCESS, id));
     }
     catch (Exception ex)
     {
         Logs.SaveLog(ex.Message);
         return(new Tuple <bool, string, long>(false, ex.Message, 0));
     }
 }
Esempio n. 2
0
 public Tuple <bool, string> Update()
 {
     try
     {
         using (Easycase.DataModel.EasyCaseDBEntities DB = new DataModel.EasyCaseDBEntities())
         {
             var client = new DataModel.CompanyDetail
             {
                 FirstName        = this.FirstName,
                 Country          = this.Country,
                 LastName         = this.LastName,
                 CreatedBy        = this.CreatedBy,
                 AddressLine1     = this.AddressLine1,
                 AddressLine2     = this.AddressLine2,
                 City             = this.City,
                 CompanyEmail     = this.CompanyEmail,
                 CompanyName      = this.CompanyName,
                 Fax              = this.Fax,
                 MembershipNumber = this.MembershipNumber,
                 MembershipType   = this.MembershipType,
                 PostalCode       = this.PostalCode,
                 Province         = this.Province,
                 Telephone        = this.Telephone,
                 UpdatedOn        = DateTime.Now,
                 ID = this.ID
             };
             DB.Entry(client).State = System.Data.Entity.EntityState.Modified;
             DB.SaveChanges();
         }
         return(new Tuple <bool, string>(true, Messages.SUCCESS));
     }
     catch (Exception ex)
     {
         Logs.SaveLog(ex.Message);
         return(new Tuple <bool, string>(false, ex.Message));
     }
 }