public int GHC_SiteConfiguration_Update(GHC_SiteConfigurationData objGHC_SiteConfiguration)
 {
     int rowsAffected = 0;
       SqlConnection connection = null;
       try
       {
       connection = (SqlConnection)new DBConnect().ConnectionObject;
       SqlCommand Command = new SqlCommand("GHC_GHC_SiteConfiguration_Update", connection);
       Command.CommandType = CommandType.StoredProcedure;
       Command.Parameters.AddWithValue("@nSiteConfigurationID",objGHC_SiteConfiguration.nSiteConfigurationID);
       Command.Parameters.AddWithValue("@sSMTPServer",objGHC_SiteConfiguration.sSMTPServer);
       Command.Parameters.AddWithValue("@nPort",objGHC_SiteConfiguration.nPort);
       Command.Parameters.AddWithValue("@sSMTPUsername",objGHC_SiteConfiguration.sSMTPUsername);
       Command.Parameters.AddWithValue("@sSMTPPassword",objGHC_SiteConfiguration.sSMTPPassword);
       Command.Parameters.AddWithValue("@sAdminEmailID",objGHC_SiteConfiguration.sAdminEmailID);
       Command.Parameters.AddWithValue("@sInfoEmailID",objGHC_SiteConfiguration.sInfoEmailID);
       Command.Parameters.AddWithValue("@sContactEmailID",objGHC_SiteConfiguration.sContactEmailID);
       Command.Parameters.AddWithValue("@sReplyToEmailID",objGHC_SiteConfiguration.sReplyToEmailID);
       Command.Parameters.AddWithValue("@sContactNo",objGHC_SiteConfiguration.sContactNo);
       Command.Parameters.AddWithValue("@sFax",objGHC_SiteConfiguration.sFax);
       Command.Parameters.AddWithValue("@sErrorEmailID",objGHC_SiteConfiguration.sErrorEmailID);
       Command.Parameters.AddWithValue("@bIsSendErrorEmail",objGHC_SiteConfiguration.bIsSendErrorEmail);
       SqlParameter returnValueParam = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
       returnValueParam.Direction = ParameterDirection.ReturnValue;
       Command.Parameters.Add(returnValueParam);
       connection.Open();
       Command.ExecuteNonQuery();
       rowsAffected = Convert.ToInt32(returnValueParam.Value);
       }
       catch
       {
       rowsAffected = 0;
       }
       finally
       {
       if (connection != null)
        connection.Close();
       connection.Dispose();
       }
       return rowsAffected;
 }
Esempio n. 2
0
 /// <summary>
 /// Action use to add new record in site configuration
 /// </summary>
 /// <param name="objModel"></param>
 /// <returns></returns>
 public ActionResult AddRecord(GHC_SiteConfigurationData objModel)
 {
     try
     {
         GHC_SiteConfigurationData objnewRecord = new GHC_SiteConfigurationData();
         objnewRecord.bIsSendErrorEmail = Methods.doBoolean(objModel.bIsSendErrorEmail);
         objnewRecord.nPort = Methods.doInt(objModel.nPort);
         objnewRecord.sAdminEmailID = Methods.doInsertable(objModel.sAdminEmailID);
         objnewRecord.sContactEmailID = Methods.doInsertable(objModel.sContactEmailID);
         objnewRecord.sContactNo = Methods.doInsertable(objModel.sContactNo);
         objnewRecord.sErrorEmailID = Methods.doInsertable(objModel.sErrorEmailID);
         objnewRecord.sFax = Methods.doInsertable(objModel.sFax);
         objnewRecord.sInfoEmailID = Methods.doInsertable(objModel.sInfoEmailID);
         objnewRecord.sReplyToEmailID = Methods.doInsertable(objModel.sReplyToEmailID);
         objnewRecord.sSMTPPassword = (Methods.CorrectDBNull(objModel.sSMTPPassword) != "") ? Methods.Encryption(Methods.CorrectDBNull(objModel.sSMTPPassword)) : "";
         objnewRecord.sSMTPServer = Methods.doInsertable(objModel.sSMTPServer);
         objnewRecord.sSMTPUsername = Methods.doInsertable(objModel.sSMTPUsername);
         int nReturn = objDBGHC_SiteConfiguration.GHC_SiteConfiguration_Insert(objnewRecord);
         if (nReturn > 0)
         {
             Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Insert]", "Site Setting");
             Session[Helpers.CommonConstants.MessageType] = "1";
         }
         else
         {
             Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Error]", "Site Setting");
             Session[Helpers.CommonConstants.MessageType] = "2";
         }
     }
     catch(Exception ex)
     {
         CommonRepository.LogError("SiteSettingController", "AddRecord", ex.ToString());
         Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Error]");
         Session[Helpers.CommonConstants.MessageType] = "2";
         return RedirectToAction("index", "dashboard");
     }
     return RedirectToAction("Index","dashboard");
 }