示例#1
0
 public static int SaveClientSettings(ClientSettings clientSetting)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             ClientSettings oldSetting = ve.ClientSettings.FirstOrDefault(cl => cl.ClientId == clientSetting.ClientId);
             if (oldSetting != null)
             {
                 //updating the existing settings
                 oldSetting.IsEducationServiceAvailable          = clientSetting.IsEducationServiceAvailable;
                 oldSetting.IsAssetServiceAvailable              = clientSetting.IsAssetServiceAvailable;
                 oldSetting.IsBusServiceAvailable                = clientSetting.IsBusServiceAvailable;
                 oldSetting.IsCerificateServiceAvailable         = clientSetting.IsCerificateServiceAvailable;
                 oldSetting.IsDebtorCreditotsServiceAvailable    = clientSetting.IsDebtorCreditotsServiceAvailable;
                 oldSetting.IsDemoClassServiceAvailable          = clientSetting.IsDemoClassServiceAvailable;
                 oldSetting.IsEnquiryServiceAvailable            = clientSetting.IsEnquiryServiceAvailable;
                 oldSetting.IsHostelServiceAvailable             = clientSetting.IsHostelServiceAvailable;
                 oldSetting.IsJobServiceAvailable                = clientSetting.IsJobServiceAvailable;
                 oldSetting.IsOfficeExpenseServiceAvailable      = clientSetting.IsOfficeExpenseServiceAvailable;
                 oldSetting.IsSMSServiceAvailable                = clientSetting.IsSMSServiceAvailable;
                 oldSetting.IsStudyMaterialServiceAvailable      = clientSetting.IsStudyMaterialServiceAvailable;
                 oldSetting.MaximumNumberOfCourseBrandsPerSchool = clientSetting.MaximumNumberOfCourseBrandsPerSchool;
                 oldSetting.MaximumNumberOfUsersPerSchool        = clientSetting.MaximumNumberOfUsersPerSchool;
                 oldSetting.SMSurl    = clientSetting.SMSurl;
                 oldSetting.SMSUserId = clientSetting.SMSUserId;
                 oldSetting.SMSPwd    = clientSetting.SMSPwd;
                 return(ve.SaveChanges());
             }
             else
             {
                 //create new settings
                 ve.AddToClientSettings(clientSetting);
                 return(ve.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
 }