public ActionResult SaveCategory(string prm = "") { CategoryModel objCategoryModel = new CategoryModel(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int CategoryId; //decrypt parameter and set in CategoryId variable int.TryParse(CommonUtils.Decrypt(prm), out CategoryId); //Get Category detail by Category Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Category + "/GetCategoryById?CategoryId=" + CategoryId.ToString()); objCategoryModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <CategoryModel>().Result : null; } FillQuickLinks(objCategoryModel.QuickLinks, objCategoryModel.CategoryID); } catch (Exception ex) { ErrorLog(ex, "Category", "SaveCategory Get"); } return(View("SaveCategory", objCategoryModel)); }
public ActionResult SaveDocument(string prm = "") { DocumentModel objDocumentModel = new DocumentModel(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int DocumentId; //decrypt parameter and set in DocumentId variable int.TryParse(CommonUtils.Decrypt(prm), out DocumentId); //Get Document detail by Document Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Document + "/GetDocumentById?DocumentId=" + DocumentId.ToString()); objDocumentModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <DocumentModel>().Result : null; } CaegoryDropDown(objDocumentModel.CategoryID); SubCatDropDown(objDocumentModel.SubCategoryID, objDocumentModel.CategoryID, null); StepDropDown(0, objDocumentModel.DocumentID); List <DropdownModel> objSavedStep = new List <DropdownModel>(); if (ViewBag.objStepDDL != null) { List <DropdownModel> objStepList = ViewBag.objStepDDL; if (!string.IsNullOrWhiteSpace(objDocumentModel.SavedStep)) { string[] SavedItem = objDocumentModel.SavedStep.Split(','); foreach (var item in SavedItem) { int id = Convert.ToInt32(item); var tempItem = objStepList.Where(val => val.ID == id).FirstOrDefault(); objSavedStep.Add(tempItem); objStepList = objStepList.Where(val => val.ID != id).ToList(); } } ViewBag.objSavedStep = new SelectList(objSavedStep, "Id", "Value"); ViewBag.objStepDDL = new SelectList(objStepList, "Id", "Value"); } GroupDropDown(objDocumentModel.GroupID); FillPackList(objDocumentModel.PackIds, objDocumentModel.DocumentID); UserDropDown(""); } catch (Exception ex) { ErrorLog(ex, "Document", "SaveDocument Get"); } return(View("SaveDocument", objDocumentModel)); }
public void CaegoryDropDown(int CategoryId) { try { List <DropdownModel> objCategoryDDL = new List <DropdownModel>(); serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Category + "/FillCaegoryDropDown"); objCategoryDDL = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <List <DropdownModel> >().Result : null; ViewBag.CaegoryDropDown = new SelectList(objCategoryDDL, "Id", "Value", CategoryId); } catch (Exception ex) { ErrorLog(ex, "SubCategory", "FillCaegoryDropDown"); throw ex; } }
public ActionResult SaveEmailTemplate(string prm = "") { EmailTemplate objEmailTemplate = new EmailTemplate(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int EmailDetailID; //decrypt parameter and set in SubCategoryId variable int.TryParse(CommonUtils.Decrypt(prm), out EmailDetailID); //Get SubCategory detail by SubCategory Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Email + "/GetEmailTemplateById?EmailDetailID=" + EmailDetailID.ToString()); objEmailTemplate = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <EmailTemplate>().Result : null; } EmailTyepDropDown(objEmailTemplate.EmailID); } catch (Exception ex) { ErrorLog(ex, "SaveEmailTemplate", "SaveEmailTemplate Get"); } return(View("SaveEmailTemplate", objEmailTemplate)); }
public ActionResult ViewOrderDetail(string prm = "") { ViewOdersDetailModel objViewOdersDetailModel = new ViewOdersDetailModel(); try { if (!String.IsNullOrEmpty(prm)) { int OrderId; //decrypt parameter and set in CategoryId variable int.TryParse(CommonUtils.Decrypt(prm), out OrderId); //Get Category detail by Category Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Order + "/GetOrderById?OrderId=" + OrderId.ToString()); objViewOdersDetailModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewOdersDetailModel>().Result : null; return(PartialView("_OrderDetailList", objViewOdersDetailModel)); } } catch (Exception ex) { ErrorLog(ex, "Order", "View POST"); } return(PartialView("_OrderDetailList", objViewOdersDetailModel)); }
public ActionResult SaveLawGuide(string prm = "") { LawGuideModel objLawGuideModel = new LawGuideModel(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int LawGuideId; //decrypt parameter and set in LawGuideId variable int.TryParse(CommonUtils.Decrypt(prm), out LawGuideId); //Get LawGuide detail by LawGuide Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.LawGuide + "/GetLawGuideById?LawGuideId=" + LawGuideId.ToString()); objLawGuideModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <LawGuideModel>().Result : null; } SubCatDropDown(objLawGuideModel.SubCategoryID, null, null); } catch (Exception ex) { ErrorLog(ex, "LawGuide", "SaveLawGuide Get"); } return(View("SaveLawGuide", objLawGuideModel)); }
public ActionResult Index(string prm = "") { HowItWorksModel model = new HowItWorksModel(); if (!string.IsNullOrEmpty(prm)) { int id; int.TryParse(CommonUtils.Decrypt(prm), out id); serviceResponse = objUtilityWeb.GetAsync(WebApiURL.HowItWorks + "/GetById?id=" + id.ToString()); model = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HowItWorksModel>().Result : null; } return(View()); }
public ActionResult Index() { HomeLayOutModel objHomeLayOutModel = (HomeLayOutModel)Session["LayOutData"]; HomeDocumentViewModel homeDocumentViewModel = new HomeDocumentViewModel(); homeDocumentViewModel.objListSubCategory = new List <SubCategoryModel>(); homeDocumentViewModel.objListDocumentService = new List <DocumentModel>(); List <PackedDocumentsParent> lstPackedDocumentsParent = new List <PackedDocumentsParent>(); serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetCategoryList?CategoryId=" + objHomeLayOutModel.objViewCategoryModel.CategoryList[0].CategoryID.ToString()); var objHomeCategoryViewModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HomeCategoryViewModel>().Result : null; foreach (var subcategory in objHomeCategoryViewModel.objListSubCategory) { serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetSubCategoryList?SubCategoryId=" + subcategory.SubCategoryID.ToString()); objHomeCategoryViewModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HomeCategoryViewModel>().Result : null; homeDocumentViewModel.objListSubCategory.Add(subcategory); homeDocumentViewModel.objListDocumentService.AddRange(objHomeCategoryViewModel.objListDocumentModel); foreach (var packedDocument in objHomeCategoryViewModel.objListDocumentModel) { serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetDocumentList?DocumentId=" + packedDocument.DocumentID.ToString()); var objHomeDocumentViewModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HomeDocumentViewModel>().Result : null; if (objHomeDocumentViewModel.objListDocumentService.Count > 1) { lstPackedDocumentsParent.Add(new PackedDocumentsParent { SubCategoryID = packedDocument.SubCategoryID, DocumentTitle = packedDocument.DocumentTitle, DocumentDescription = packedDocument.DocumentDescription }); } } } Session["PackedDocument"] = lstPackedDocumentsParent; //serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetSubCategoryList?SubCategoryId=" + SubCategoryId.ToString()); //objHomeCategoryViewModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync<HomeCategoryViewModel>().Result : null; //objHomeCategoryViewModel.SelectedSubCatId = SubCategoryId; ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; return(View(homeDocumentViewModel)); }
public ActionResult SaveBulletin(string prm = "") { BulletinModel objBulletinModel = new BulletinModel(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int BulletinId; //decrypt parameter and set in BulletinId variable int.TryParse(CommonUtils.Decrypt(prm), out BulletinId); //Get Bulletin detail by Bulletin Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Bulletin + "/GetBulletinById?BulletinId=" + BulletinId.ToString()); objBulletinModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <BulletinModel>().Result : null; } } catch (Exception ex) { ErrorLog(ex, "Bulletin", "SaveBulletin Get"); } return(View("SaveBulletin", objBulletinModel)); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { HomeLayOutModel objHomeLayOutModel = new HomeLayOutModel(); if (filterContext.HttpContext.Session["LayOutData"] != null) { objHomeLayOutModel = (HomeLayOutModel)filterContext.HttpContext.Session["LayOutData"]; } else { serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetLayOutData"); objHomeLayOutModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HomeLayOutModel>().Result : null; filterContext.HttpContext.Session["LayOutData"] = objHomeLayOutModel; } base.OnActionExecuting(filterContext); }
public ActionResult ForgotPassword(ChangePasswordModel objChangePasswordModel) { UtilityWeb objUtilityWeb = new UtilityWeb(); try { UserLogin objUserLogin = new RepidShare.Entities.UserLogin(); EmailTemplate objEmailTemplate = new EmailTemplate(); objUserLogin.Email = objChangePasswordModel.EmailID; serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/ForgotPassword", objUserLogin); objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <UserLogin>().Result : null; System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add(objChangePasswordModel.EmailID); serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Email + "/GetEmailSettingByEmailID?EmailID=" + Convert.ToInt32(RepidShare.Utility.CommonUtils.EmailType.ForgotPassword)); objEmailTemplate = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <EmailTemplate>().Result : null; message.Subject = objEmailTemplate.EmailSubject; //"Forgot Password By Papeleslegales.com"; message.Body = objEmailTemplate.Content + "<br/>Your Password According to our records is: , <h3>" + objUserLogin.Password + "</h3>";; //"<p>Your password has been reset, <h3> " + objUserLogin.UserName + "</h3></p> </br><p> According to our records, you have requested that your password be reset. Your new password is:<h3>" + objUserLogin.Password + "<h3/></p> </br></br><p>If you have any questions or trouble logging on please contact a site administrator.</p><br/><br/><br/>Thank you!"; message.IsBodyHtml = true; if (objUserLogin.ErrorCode == 0) { if (RepidShare.Utility.CommonUtils.Send(message)) { // Session["SuccessMessage"] = "E-Mail Sent Successfully!"; objChangePasswordModel.Message = "<p style='color:green;'>Your Passowrd has been sent to your account. for login click <a href='http://localhost:49339/User/Login'> Login <a></p>"; } } else { // Session["ErrorMessage"] = "Oppps, Your Account is not valid!!!"; objChangePasswordModel.Message = "<p style='color:red;'>Oppps, Your Account is not valid!!!</p>"; } // return RedirectToAction("Login", "User"); return(View("ForgotPassword", objChangePasswordModel)); } catch (Exception ex) { //Session["ExceptionMsg"] = objCommonUtils.ErrorLog(createdBy.ToString(), "User", "ForgotPassword Post", ex); } return(View("ForgotPassword", objChangePasswordModel)); }
public ActionResult Download(string DocID) { HttpResponseMessage serviceResponse; UtilityWeb objUtilityWeb = new UtilityWeb(); BulletinModel objBulletinModel = new BulletinModel(); serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Bulletin + "/GetBulletinById?BulletinId=" + DocID.ToString()); objBulletinModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <BulletinModel>().Result : null; Response.Clear(); MemoryStream ms = new MemoryStream(objBulletinModel.AttachmentContent); Response.ContentType = objBulletinModel.AttachmentType; Response.AddHeader("content-disposition", objBulletinModel.AttachmentType); Response.Buffer = true; ms.WriteTo(Response.OutputStream); Response.End(); return(new FileStreamResult(ms, objBulletinModel.AttachmentType)); }
public ActionResult ActivateDeactivateUser(string prm = "") { UserLogin objUserLogin = new UserLogin(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int UserId; int Status; //decrypt parameter and set in CategoryId variable int.TryParse(CommonUtils.Decrypt(prm.Split('~')[0]), out UserId); int.TryParse(prm.Split('~')[1], out Status); //Get Category detail by Category Id //serviceResponse = objUtilityWeb.GetAsync(WebApiURL.UserLogin + "/GetUserListById?UserId=" + UserId.ToString()); //objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync<UserLogin>().Result : null; //if (objUserLogin != null) //{ serviceResponse = objUtilityWeb.GetAsync(WebApiURL.UserLogin + "/UpdateUserStatusByID?UserId=" + UserId.ToString() + "&status=" + Status); objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <UserLogin>().Result : null; //Admin_UpdateUserStatusByID //} } } catch (Exception ex) { ErrorLog(ex, "User", "ActivateDeactivateUser"); } return(RedirectToAction("List")); }
// [Filters.Authorized] public ActionResult SaveQuestion(ViewQuestionModel objViewQuestionModel) { try { //set Message and Message Type to empty objViewQuestionModel.Message = objViewQuestionModel.MessageType = String.Empty; int ErrorCode = 0; String ErrorMessage = ""; List <DisplayChoiceModel> lstDisplayChoice = new List <DisplayChoiceModel>(); if (!String.IsNullOrEmpty(objViewQuestionModel.ActionType)) { switch (objViewQuestionModel.ActionType) { case "save": // if Action Type is save than set IsActive and Created By property objViewQuestionModel.QuestionDetail.IsActive = true; objViewQuestionModel.QuestionDetail.CreatedBy = LoggedInUserID; //Get All Display Choice for single select and Multi select question type serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Question + "/GetAllDisplayChoice"); lstDisplayChoice = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <List <DisplayChoiceModel> >().Result : null; //lstDisplayChoice = objCommonUtils.GetAllDisplayChoice(); // if question type is single select than set question Option List and get XML of Question Options and set display choice ID(radio) if (objViewQuestionModel.QuestionDetail.QuestionType == CommonUtils.QuestionType.SingleSelect.ToString()) { objViewQuestionModel.QuestionDetail.QuestionOptionsList = objViewQuestionModel.QuestionTypeDetail.SingleSelect.QuestionOptions; objViewQuestionModel.QuestionOptions = CommonUtils.GetBulkXML(objViewQuestionModel.QuestionDetail.QuestionOptionsList); objViewQuestionModel.QuestionDetail.DisplayChoiceID = lstDisplayChoice.Where(o => o.DisplayChoiceName == CommonUtils.DisplayChoice.Radio.ToString()).Select(o => o.DisplayChoiceID).SingleOrDefault(); } else if (objViewQuestionModel.QuestionDetail.QuestionType == CommonUtils.QuestionType.MultiSelect.ToString()) { // if question type is Multi select than set question Option List and get XML of Question Options and set display choice ID(checkbox) objViewQuestionModel.QuestionDetail.QuestionOptionsList = objViewQuestionModel.QuestionTypeDetail.MultiSelect.QuestionOptions; objViewQuestionModel.QuestionOptions = CommonUtils.GetBulkXML(objViewQuestionModel.QuestionDetail.QuestionOptionsList); objViewQuestionModel.QuestionDetail.DisplayChoiceID = lstDisplayChoice.Where(o => o.DisplayChoiceName == CommonUtils.DisplayChoice.CheckBox.ToString()).Select(o => o.DisplayChoiceID).SingleOrDefault(); } //Fill Question Properties based on QuestionTypeDetail Model objViewQuestionModel.QuestionPropertyList = objCommonUtils.FillQuestionProperties(objViewQuestionModel.QuestionTypeDetail); if (objViewQuestionModel.QuestionPropertyList != null && objViewQuestionModel.QuestionPropertyList.Count > 0) { //If QuestionPropertyList count greater than 0 get xml of Question Property List objViewQuestionModel.QuestionProperties = CommonUtils.GetBulkXML(objViewQuestionModel.QuestionPropertyList); } serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Question + "/InsertUpdateQuestion", objViewQuestionModel); objViewQuestionModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewQuestionModel>().Result : null; //Insert or Update Document Question with Question Type ,Question Type Detail and Question Property //objViewQuestionModel = objBLQuestion.InsertUpdateQuestion(objViewQuestionModel); if (objViewQuestionModel.ErrorCode == 0) { //if Error code is 0 than set Save Success Message and Redirect to same page in Add Question Mode TempData["QuestionSucessMessage"] = "Question Saved"; return(RedirectToAction("SaveQuestion", new { prm = CommonUtils.Encrypt(Convert.ToString(objViewQuestionModel.QuestionDetail.DocumentID)) })); } else { //if Error Code is not 0 than set error message objViewQuestionModel.Message = "Question Error"; objViewQuestionModel.MessageType = CommonUtils.MessageType.Error.ToString().ToLower(); } break; case "deletequestion": serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Question + "/DeleteQuestion", objViewQuestionModel); objViewQuestionModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewQuestionModel>().Result : null; //objBLQuestion.DeleteDocumentQuestion(objViewQuestionModel.DeletedQuestionID, LoggedInUserID, out ErrorCode, out ErrorMessage); if (Convert.ToInt32(ErrorCode).Equals(0)) { //if error code 0 means delete successfully than set Delete success message. TempData["QuestionSucessMessage"] = "Question Delete"; return(RedirectToAction("SaveQuestion", new { prm = CommonUtils.Encrypt(Convert.ToString(objViewQuestionModel.QuestionDetail.DocumentID)) })); } else { //if error code is not 0 means delete error than set Delete error message. objViewQuestionModel.Message = "Question Error"; objViewQuestionModel.MessageType = CommonUtils.MessageType.Error.ToString().ToLower();; } ModelState.Clear(); break; default: objViewQuestionModel.QuestionDetail.QuestionID = 0; //In case of paging and sorting clease Model State to Remove validation. ModelState.Clear(); break; } } } catch (Exception ex) { ErrorLog(ex, "Question", "SaveQuestion Post"); } //Fill Question Type drop down and Get QuestionList if error code is not 0 and return view. FillQuestionType(); serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Question + "/GetQuestions", objViewQuestionModel); objViewQuestionModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewQuestionModel>().Result : null; //objViewQuestionModel = objBLQuestion.GetQuestions(objViewQuestionModel); return(View("SaveQuestion", objViewQuestionModel)); }