public int ActiveDeactiveCMS(CMSModel objCMS) { int result = -1; try { SqlParameter prmContentId = SqlHelper.CreateParameter("@ContentId", objCMS.ContentId); SqlParameter prmStatus = SqlHelper.CreateParameter("@Status", objCMS.Status); SqlParameter prmModifiedBy = SqlHelper.CreateParameter("@ModifiedBy", objCMS.ModifiedBy); SqlParameter prmModifiedFromIp = SqlHelper.CreateParameter("@ModifiedFromIp", objCMS.ModifiedFromIp); SqlParameter prmFlag = SqlHelper.CreateParameter("@Flag", objCMS.Flag); SqlParameter prmErr = SqlHelper.CreateParameter("@Err", -1, ParameterDirection.Output); SqlParameter[] allParams = { prmContentId, prmStatus, prmModifiedBy, prmModifiedFromIp, prmFlag, prmErr }; SqlHelper.ExecuteNonQuery(_conString, CommandType.StoredProcedure, "Usp_GetCMS", allParams); if (prmErr.Value != null) { result = (int)prmErr.Value; } return(result); } catch { throw; } }
public int UpateCMS(CMSModel objCMS) { int result = -1; try { SqlParameter prmContentId = SqlHelper.CreateParameter("@ContentId", objCMS.ContentId); SqlParameter prmPageName = SqlHelper.CreateParameter("@PageName", objCMS.PageName); //SqlParameter prmPageUrl = SqlHelper.CreateParameter("@PageUrl", objCMS.PageUrl); SqlParameter prmMetaTitle = SqlHelper.CreateParameter("@MetaTitle", objCMS.MetaTitle); SqlParameter prmMetaKey = SqlHelper.CreateParameter("@MetaKeyword", objCMS.MetaKeyword); SqlParameter prmMetaDescription = SqlHelper.CreateParameter("@MetaDescription", objCMS.MetaDescription); SqlParameter prmContent = SqlHelper.CreateParameter("@Content", objCMS.Content); SqlParameter prmStatus = SqlHelper.CreateParameter("@Status", objCMS.Status); SqlParameter prmModifiedBy = SqlHelper.CreateParameter("@ModifiedBy", AdminSessionData.AdminUserId); SqlParameter prmModifiedFromIp = SqlHelper.CreateParameter("@ModifiedFromIp", objCMS.ModifiedFromIp); SqlParameter prmFlag = SqlHelper.CreateParameter("@Flag", 2); SqlParameter prmErr = SqlHelper.CreateParameter("@Err", -1, ParameterDirection.Output); SqlParameter[] allParams = { prmContentId, prmPageName, prmMetaTitle, prmMetaKey, prmMetaDescription, prmContent, prmStatus, prmModifiedBy, prmModifiedFromIp, prmFlag, prmErr }; SqlHelper.ExecuteNonQuery(_conString, CommandType.StoredProcedure, "Usp_GetCMS", allParams); if (prmErr.Value != null) { result = (int)prmErr.Value; } return(result); } catch { throw; } }
public ActionResult Edit(int Id) { CMSHelper cmsHelper = new CMSHelper(); CMSModel model = new CMSModel(); model = cmsHelper.GetByID(Id); ViewBag.StatusList = AppLogic.BindDDStatus(Convert.ToInt32(model.Status)); return(View(model)); }
private ActionResult BindCMSList() { CMSHelper cmsHelper = new CMSHelper(); CMSModel model = new CMSModel(); model.Flag = 1; var CMSList = cmsHelper.GetAll(model.Flag).ToList(); ActiveCMSList = CMSList.Where(x => x.Status == 1).ToList(); InActiveCMSList = CMSList.Where(x => x.Status == 0).ToList(); return(View(Tuple.Create(ActiveCMSList, InActiveCMSList, model))); }
public ActionResult Edit(CMSModel objCMS) { CMSHelper cmsHelper = new CMSHelper(); int count = cmsHelper.UpateCMS(objCMS); if (count == 0) { TempData["CommonMessage"] = AppLogic.setMessage(count, "CMS Updated Successfully."); } else { TempData["CommonMessage"] = AppLogic.setMessage(count, "CMS Update Failed."); } return(RedirectToAction("Index")); }
public ActionResult Activate(int Id) { CMSModel model = new CMSModel(); CMSHelper cmsHelper = new CMSHelper(); model.Flag = 3; model.ModifiedBy = AdminSessionData.AdminUserId; model.ContentId = Id; model.Status = 1; int count = cmsHelper.ActiveDeactiveCMS(model); if (count == 0) { TempData["CommonMessage"] = AppLogic.setMessage(count, "Template Activated Successfully."); } else { TempData["CommonMessage"] = AppLogic.setMessage(count, "Template Activation failed."); } return(RedirectToAction("Index")); }
public CMSModel GetByID(int Id) { try { var sqlCon = new SqlConnection(_conString); sqlCon.Open(); var sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "Usp_GetCMS"; sqlCmd.Parameters.AddWithValue("@ContentId", Id); sqlCmd.Parameters.AddWithValue("@Flag", 1); sqlCmd.Connection = sqlCon; CMSModel p = null; using (SqlDataReader reader = sqlCmd.ExecuteReader()) { while (reader.Read()) { p = new CMSModel(); p.ContentId = Convert.ToInt32(reader["ContentId"]); p.PageName = reader["PageName"].ToString(); //p.PageUrl = reader["PageUrl"].ToString(); p.MetaTitle = reader["MetaTitle"].ToString(); p.MetaKeyword = reader["MetaKeyword"].ToString(); p.MetaDescription = reader["MetaDescription"].ToString(); p.Content = reader["Content"].ToString(); p.ModifiedBy = Convert.ToInt32(reader["ModifiedBy"]); p.ModifiedOn = reader["ModifiedOn"].ToString(); p.Status = Convert.ToInt32(reader["Status"]); } } sqlCon.Close(); return(p); } catch { throw; } }
public IDictionary <string, CMSModel> GetCMSList(DataTable dataTable) { Dictionary <string, CMSModel> cmsModelList = new Dictionary <string, CMSModel>(); CMSModel cmsModel = default(CMSModel); if (dataTable != null && dataTable.Rows != null && dataTable.Rows.Count > 0) { foreach (DataRow dr in dataTable.Rows) { cmsModel = new CMSModel(); cmsModel.Key = Convert.ToString(dr["CMSKey"]); cmsModel.Value = Convert.ToString(dr["CMSValue"]); cmsModel.Type = Convert.ToString(dr["CMSType"]); cmsModel.Src = Convert.ToString(dr["CMSSrc"]); cmsModel.Href = Convert.ToString(dr["CMSHref"]); cmsModelList.Add(Convert.ToString(dr["CMSKey"]), cmsModel); } } return(cmsModelList); }