internal static void Update(IEntity entity)
{
Template templateEntity = (Template)(entity);
using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
{
SqlCommand sqlCommand = new SqlCommand(SN_TEMPLATE_UPDATE, sqlConnection);
sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter sqlParameter = null;
double days = 0;
double seconds = 0;
CMSCoreHelper.GetDaySecondsNumber(templateEntity.CreationDate, out days, out seconds);
sqlParameter = new SqlParameter(PN_TEMPLATE_CREATION_DAY, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = (int)days;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_CREATION_SEC, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = (int)seconds;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_DESCRIPTION, System.Data.SqlDbType.NVarChar);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.Description;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_DETAILS, System.Data.SqlDbType.NText);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.Details;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_ID, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.ID;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_IMAGE, System.Data.SqlDbType.NVarChar);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.Image;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_IS_DELETED, System.Data.SqlDbType.Bit);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.IsDeleted;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_LANGUAGE_ID, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.LanguageID;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_NAME, System.Data.SqlDbType.NVarChar);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.Name;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_PORTAL_ID, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.PortalID;
sqlCommand.Parameters.Add(sqlParameter);
sqlParameter = new SqlParameter(PN_TEMPLATE_CREATED_BY, System.Data.SqlDbType.Int);
sqlParameter.Direction = System.Data.ParameterDirection.Input;
sqlParameter.Value = templateEntity.CreatedBy;
sqlCommand.Parameters.Add(sqlParameter);
try
{
sqlCommand.Connection.Open();
sqlCommand.ExecuteNonQuery();
sqlCommand.Connection.Close();
}
catch (Exception ex)
{
throw ex;
}
}
}