public ActionResult ViewAllEmailTemplate() { ViewEmailTemplateModel objViewEmailTemplateModel = new ViewEmailTemplateModel(); try { //initial set of current page, pageSize , Total pages objViewEmailTemplateModel.CurrentPage = 1; objViewEmailTemplateModel.PageSize = CommonUtils.PageSize; objViewEmailTemplateModel.TotalPages = 0; //Get SubCategory List serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Email + "/GetEmailTemplateList", objViewEmailTemplateModel); objViewEmailTemplateModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewEmailTemplateModel>().Result : null; //ObjViewSubCategoryModel = objBLSubCategory.GetSubCategoryList(ObjViewSubCategoryModel); //Set Success Message if comes from save page after click on save button if (!String.IsNullOrEmpty(Convert.ToString(TempData["SucessMessage"]))) { objViewEmailTemplateModel.Message = Convert.ToString(TempData["SucessMessage"]); objViewEmailTemplateModel.MessageType = CommonUtils.MessageType.Success.ToString().ToLower(); TempData["SucessMessage"] = null; } //CaegoryDropDown(objViewEmailTemplateModel.FilterCategoryId); // EmailTyepDropDown(ObjViewSubCategoryModel.FilterCategoryId); //GroupDropDown(ObjViewSubCategoryModel.FilterGroupID); } catch (Exception ex) { ErrorLog(ex, "ViewAllEmailTemplate", "ViewAllEmailTemplate"); } //, ObjViewSubCategoryModel return(View("ViewAllEmailTemplate", objViewEmailTemplateModel)); }
// GetEmailTemplateList public DataTable GetEmailTemplateList(ViewEmailTemplateModel ViewEmailTemplateModelList) { try { SqlParameter[] parmList = { new SqlParameter("@CurrentPage", ViewEmailTemplateModelList.CurrentPage) , new SqlParameter("@PageSize", ViewEmailTemplateModelList.PageSize) , new SqlParameter("@SortBy", ViewEmailTemplateModelList.SortBy) , new SqlParameter("@SortOrder", ViewEmailTemplateModelList.SortOrder) }; DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, DBConstants.Admin_EmailTemplateList, parmList); if (ds != null && ds.Tables.Count > 0) { return(ds.Tables[0]); } return(null); } catch (Exception ex) { throw ex; } }
public ViewEmailTemplateModel DeleteEmailTemplate(ViewEmailTemplateModel objEmailTemplateModel) { try { SqlParameter pErrorCode = new SqlParameter("@ErrorCode", objEmailTemplateModel.ErrorCode); pErrorCode.Direction = ParameterDirection.Output; SqlParameter pErrorMessage = new SqlParameter("@ErrorMessage", objEmailTemplateModel.Message); pErrorMessage.Direction = ParameterDirection.Output; SqlParameter[] parmList = { new SqlParameter("@EmailDetailID", objEmailTemplateModel.DeletedEmailDetailID) , new SqlParameter("@CreatedBy", objEmailTemplateModel.DeletedBy) , pErrorCode , pErrorMessage }; //Call delete stored procedure to delete category SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, DBConstants.Admin_DeleteEmailTemplate, parmList); //set output parameter error code and error message objEmailTemplateModel.ErrorCode = Convert.ToInt32(pErrorCode.Value); objEmailTemplateModel.Message = Convert.ToString(pErrorMessage.Value); return(objEmailTemplateModel); } catch (Exception ex) { throw ex; } }
public ViewEmailTemplateModel GetEmailTemplateList(ViewEmailTemplateModel ViewEmailTemplateModel) { List <EmailTemplate> lstUserLogin = new List <EmailTemplate>(); //if FilterSubCategoryName is NULL than set to empty // ViewEmailTemplateModel.FilterUserName = ViewEmailTemplateModel.FilterUserName ?? String.Empty; //if SortBy is NULL than set to empty ViewEmailTemplateModel.SortBy = ViewEmailTemplateModel.SortBy ?? String.Empty; //call GetSubCategoryList Method which will retrun datatable of SubCategory DataTable dtEmailTemplate = objDLEmail.GetEmailTemplateList(ViewEmailTemplateModel); //fetch each row of datable foreach (DataRow dr in dtEmailTemplate.Rows) { //Convert datarow into Model object and set Model object property EmailTemplate itemEmailTemplate = GetDataRowToEntity <EmailTemplate>(dr); //Add SubCategory in List lstUserLogin.Add(itemEmailTemplate); } //set SubCategory List of Model ViewSubCategoryModel ViewEmailTemplateModel.EmailTemplateList = lstUserLogin; //if SubCategory List count is not null and greater than 0 Than set Total Pages for Paging. if (ViewEmailTemplateModel != null && ViewEmailTemplateModel.EmailTemplateList != null && ViewEmailTemplateModel.EmailTemplateList.Count > 0) { ViewEmailTemplateModel.CurrentPage = ViewEmailTemplateModel.EmailTemplateList[0].CurrentPage; int totalRecord = ViewEmailTemplateModel.EmailTemplateList[0].TotalCount; if (decimal.Remainder(totalRecord, ViewEmailTemplateModel.PageSize) > 0) { ViewEmailTemplateModel.TotalPages = (totalRecord / ViewEmailTemplateModel.PageSize + 1); } else { ViewEmailTemplateModel.TotalPages = totalRecord / ViewEmailTemplateModel.PageSize; } } else { ViewEmailTemplateModel.TotalPages = 0; ViewEmailTemplateModel.CurrentPage = 1; } return(ViewEmailTemplateModel); }
public ActionResult ViewAllEmailTemplate(ViewEmailTemplateModel objViewEmailTemplateModel) { try { int ErrorCode = 0; String ErrorMessage = ""; objViewEmailTemplateModel.Message = objViewEmailTemplateModel.MessageType = String.Empty; if (objViewEmailTemplateModel.ActionType == "delete") { //delete serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Email + "/DeleteEmailTemplate", objViewEmailTemplateModel); objViewEmailTemplateModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewEmailTemplateModel>().Result : null; if (Convert.ToInt32(ErrorCode).Equals(0)) { //if error code 0 means delete successfully than set Delete success message. objViewEmailTemplateModel.Message = "Email Template Deleted Successfully"; objViewEmailTemplateModel.MessageType = CommonUtils.MessageType.Success.ToString().ToLower(); } else { //if error code is not 0 means delete error than set Delete error message. objViewEmailTemplateModel.Message = "Error while deleting record"; objViewEmailTemplateModel.MessageType = CommonUtils.MessageType.Error.ToString().ToLower();; } } //Get Category List based on searching , sorting and paging parameter. serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Email + "/GetEmailTemplateList", objViewEmailTemplateModel); objViewEmailTemplateModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewEmailTemplateModel>().Result : null; } catch (Exception ex) { ErrorLog(ex, "_EmailTemplateList", "View POST"); } return(PartialView("_EmailTemplateList", objViewEmailTemplateModel)); }
public ViewEmailTemplateModel DeleteEmailTemplate(ViewEmailTemplateModel objViewEmailTemplateModel) { return(objBusEmail.DeleteEmailTemplate(objViewEmailTemplateModel)); //return null; }
public ViewEmailTemplateModel GetEmailTemplateList(ViewEmailTemplateModel ViewEmailTemplateModel) { return(objBusEmail.GetEmailTemplateList(ViewEmailTemplateModel)); }
public ViewEmailTemplateModel DeleteEmailTemplate(ViewEmailTemplateModel objEmailTemplate) { //call InsertUpdateSubCategory Method of dataLayer and return SubCategoryModel return(objDLEmail.DeleteEmailTemplate(objEmailTemplate)); }