public void InsertIllustrationData(Illustration ir) { try { clsParameterCollection clsParaCollection = new clsParameterCollection(); clsParaCollection.ProcedureName = Constants.sp_insertIllustration; clsParaCollection.Add(new clsParameter("@UserID ", ir.UserID)); clsParaCollection.Add(new clsParameter("@SizeID", ir.BookSize)); clsParaCollection.Add(new clsParameter("@LangID", ir.Language)); clsParaCollection.Add(new clsParameter("@IllSizeID", ir.IllustrationSize)); clsParaCollection.Add(new clsParameter("@IllNoID", ir.IllustrationNumber)); clsParaCollection.Add(new clsParameter("@ColorID", ir.Color)); clsParaCollection.Add(new clsParameter("@IllDescr", ir.IllustrationDescription)); clsParaCollection.Add(new clsParameter("@TempID", ir.TemplateID)); clsParaCollection.Add(new clsParameter("@StatusID", ir.Status)); clsParaCollection.Add(new clsParameter("@RequestDate", ir.RequestDate)); clsParaCollection.Add(new clsParameter("@EstimatedAmt", ir.EstimatedAmt)); DataAccess.ExecuteNonQuerySp(clsParaCollection); } catch (Exception ex) { throw ex; } }
public string GetUserName(Illustration ir) { try { clsParameterCollection clsParaCollection = new clsParameterCollection(); clsParaCollection.ProcedureName = Constants.sp_getIrUserName; clsParaCollection.Add(new clsParameter("@TrnId", ir.PTran_ID)); dt.Reset(); dt= DataAccess.ExecuteSpAndGetDataTable(clsParaCollection); return dt.Rows[0][0].ToString(); } catch (Exception ex) { throw ex; } }
//[Authorize(Roles = "Admin,Customer,Illustration")] public ActionResult illustration(int? page, string sort, string sortdir, string UserName, string StartDate, string EndDate, int? RecordsPerPage, string upfID) { if (upfID != "") { HttpContext.Session["upfID"] = upfID; } var model = new Illustration(); //Check whether package is taken or not, 0 for not taken and 1 for taken DataTable dt = BLObj.GetPackageInfobyuserid(Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name))); if (dt.Rows.Count > 0) model.IsPackageTaken = 1; else model.IsPackageTaken = 0; model.PagingRange = Constants.PagingRange; if (!string.IsNullOrEmpty(UserName)) { model.txtFilterUserName = UserName; } if (!string.IsNullOrEmpty(StartDate)) { model.StartDate = StartDate; model.EndDate = EndDate; } if (page != null) { model.CurrentPage = Convert.ToInt32(page); if (RecordsPerPage == null) { model.StartIndex = (Convert.ToInt32(page) * 5) - 4; model.EndIndex = Convert.ToInt32(page) * 5; } else { model.RecordsPerPage = Convert.ToInt32(RecordsPerPage); model.StartIndex = (Convert.ToInt32(page) * model.RecordsPerPage) - (model.RecordsPerPage - 1); model.EndIndex = Convert.ToInt32(page) * model.RecordsPerPage; } if (!string.IsNullOrEmpty(sort)) { model.sort = sort; model.sortdir = sortdir; } else { //if (!string.IsNullOrEmpty(Convert.ToString(TempData["sort"]))) //{ // model.sort = TempData["sort"].ToString(); // model.sortdir = TempData["sortdir"].ToString(); // TempData["sort"] = model.sort; // TempData["sortdir"] = model.sortdir; //} //else //{ model.sort = "Tran_ID"; model.sortdir = "Desc"; //} } } else { model.CurrentPage = 1; if (RecordsPerPage == null) { model.StartIndex = 1; model.EndIndex = 5; } else { model.RecordsPerPage = Convert.ToInt32(RecordsPerPage); model.StartIndex = 1; model.EndIndex = model.RecordsPerPage; } if (!string.IsNullOrEmpty(sort)) { model.sort = sort; model.sortdir = sortdir; } else { model.sort = "Tran_ID"; model.sortdir = "Desc"; } } model.UserName = UserName; getDisplayData(ref model); model.LastPageIndex = model.Pages; if (string.IsNullOrEmpty(sort)) { if (Request.IsAjaxRequest()) { return PartialView("_WebgridIllustration", model); } } if (!string.IsNullOrEmpty(sort) && page != null) { return PartialView("_WebgridIllustration", model); } return View(model); }
public void UpdateIllustrationData(Illustration ir) { try { clsParameterCollection clsParaCollection = new clsParameterCollection(); clsParaCollection.Add(new clsParameter("@TrnID", ir.PTran_ID)); clsParaCollection.Add(new clsParameter("@Status", ir.Status)); clsParaCollection.Add(new clsParameter("@ResponseDate", ir.ResponseDate)); if (ir.ResponseFilePath != null) { clsParaCollection.Add(new clsParameter("@ResponseFilePath", ir.ResponseFilePath)); clsParaCollection.ProcedureName = Constants.sp_UpadateirResponse; } else { clsParaCollection.ProcedureName = Constants.sp_Updateirstatus; } DataAccess.ExecuteNonQuerySp(clsParaCollection); } catch (Exception ex) { throw ex; } }
private void getDisplayData(ref Illustration model) { model.ListBookSize = LoadBookSizeDropDown(); model.ListColor = LoadColorDropDown(); model.ListIllustrationNumber = LoadNoOfIllDropDown(); model.ListIllustrationType = LoadIllTypeDropDown(); model.ListLang = LoadLangDropDown(); model.ListStatus = LoadStatusDropDown(); //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name); //string UserId = MemberUser.ProviderUserKey.ToString(); string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name)); DataTable dtData = new DataTable(); dtData = BLObj.getRowsCount(Convert.ToString(model.UserName), UserId, model.StartDate, model.EndDate); model.Pages = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(dtData.Rows[0][0].ToString()) / Convert.ToDouble((model.RecordsPerPage == 0) ? 5.00 : model.RecordsPerPage))); dtData.Clear(); if (!string.IsNullOrEmpty(model.StartDate) && !string.IsNullOrEmpty(model.UserName)) { dtData = BLObj.GetFilteredIllustrationDataByBoth(model.UserName, model.StartIndex, model.EndIndex, model.sort, model.sortdir, model.StartDate, model.EndDate); } else if (!string.IsNullOrEmpty(model.StartDate)) { dtData = BLObj.GetFilteredIllustrationDataByDates(UserId, model.StartIndex, model.EndIndex, model.sort, model.sortdir, model.StartDate, model.EndDate); } else if (!string.IsNullOrEmpty(model.UserName)) { dtData = BLObj.GetFilteredIllustrationData(model.UserName, model.StartIndex, model.EndIndex, model.sort, model.sortdir); } else { dtData = BLObj.GetIllustrationUserData(UserId, model.StartIndex, model.EndIndex, model.sort, model.sortdir); } List<Illustration> listData = new List<Illustration>(); foreach (DataRow dr in dtData.Rows) { listData.Add(new Illustration { SrNo = Convert.ToInt32(dr["row"]), PTran_ID = dr["Tran_ID"].ToString(), UserName = dr["UserName"].ToString(), Language = dr["lang_Name"].ToString(), BookSize = dr["size_Name"].ToString(), OrderID = dr["OrderID"].ToString(), IllustrationType = dr["illTypeName"].ToString(), IllustrationNumber = dr["iNo_Name"].ToString(), Color = dr["color_Name"].ToString(), TemplateID = dr["temp_Name"].ToString(), IllustrationDescription = dr["IllDescrp"].ToString(), ResponseFilePath = dr["ResponseFilePath"].ToString(), Status = dr["status_Name"].ToString(), EstimatedAmt = int.Parse(dr["EstimatedAmt"].ToString()), isPaymentRelesed = dr["IsPaymentReleased"].ToString(), RequestDate = dr["RequestDate"].ToString(), ResponseDate = dr["ResponseDate"].ToString() }); } model.ModelList = listData; DataTable.Clear(); DataTable = BLObj.get_Templates(); foreach (DataRow dr in DataTable.Rows) { model.temp_urls.Add(dr); } model.templates_Count = model.temp_urls.Count.ToString(); }
public ActionResult illustration(Illustration ir, FormCollection form, string Command) { if (Command == "Submit") { if (HttpContext.Session["upfID"] != null) { CtrlIllustration.upfID = Convert.ToInt32(HttpContext.Session["upfID"]); } else { CtrlIllustration.upfID = 0; } CtrlIllustration.ListBookSize = LoadBookSizeDropDown(); CtrlIllustration.ListColor = LoadColorDropDown(); CtrlIllustration.ListIllustrationNumber = LoadNoOfIllDropDown(); CtrlIllustration.ListIllustrationSize = LoadIllSizeDropDown(); CtrlIllustration.ListLang = LoadLangDropDown(); CtrlIllustration.ListStatus = LoadStatusDropDown(); //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name); //string UserId = MemberUser.ProviderUserKey.ToString(); string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name)); CtrlIllustration.OrderID = Common.GetUniqueKey(User.Identity.Name,CtrlIllustration.serviceChar); CtrlIllustration.UserID = UserId; CtrlIllustration.Language = form["ddlLang"]; CtrlIllustration.BookSize = form["ddlBSizes"]; CtrlIllustration.IllustrationType = form["ddlIllType"]; CtrlIllustration.IllustrationNumber = form["ddlIteration"]; CtrlIllustration.Color = form["ddlColor"]; CtrlIllustration.IllustrationDescription = Request["textArea"]; CtrlIllustration.TemplateID = Session["tempID"].ToString(); CtrlIllustration.RequestDate = DateTime.Now.ToShortDateString(); CtrlIllustration.Status = "1"; int IllustrationPrice = GetPricing(form["ddlIllType"], form["ddlColor"]); int ServiceTax = GetServiceTax(); string IllustrationPriceafterTax = (IllustrationPrice + (IllustrationPrice * (ServiceTax / 100))).ToString() ; CtrlIllustration.EstimatedAmt = Convert.ToInt32(IllustrationPriceafterTax); BLObj.InsertIllustrationData(CtrlIllustration); if (CtrlIllustration.upfID != 0) { BL_Account bl = new BL_Account(); bl.UpdateCountAndisDone(CtrlIllustration.upfID); HttpContext.Session["upfID"] = ""; } //ViewBag.StatusMessage = "Request submited successfuly"; //ViewBag.StatusMessageClass = "text-success bg-success"; DataTable = BLObj.GetUserMailID(UserId); Session["tempID"] = null; htmlFilePath = Server.MapPath(Constants.IREmailHTMLTemplate); SendMail(User.Identity.Name,DataTable.Rows[0][0].ToString(), CtrlIllustration.EstimatedAmt, CtrlIllustration.OrderID,htmlFilePath); } else if(Command == "Save") { var uploadedFile = Request.Files[0]; var fileName1 = Path.GetFileName(uploadedFile.FileName); CtrlIllustration.Status = form["ddlStatus"]; CtrlIllustration.PTran_ID = form["lblTrnID"]; string uName = BLObj.GetUserName(CtrlIllustration); if (fileName1 != String.Empty) { string strFileExtension = Path.GetExtension(uploadedFile.FileName); if (strFileExtension == ".jpg" || strFileExtension == ".jpeg") { fileName1 = uName + "_" + Constants.strResponse + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + fileName1; if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + uName + "//" + Constants.strResponse)) { Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + uName + "//" + Constants.strResponse); } var fileSavePath = Server.MapPath(Constants.strUploadFileIntialPath + "//" + uName + "//" + Constants.strResponse + "//" + fileName1); uploadedFile.SaveAs(fileSavePath); CtrlIllustration.ResponseFilePath = fileName1; } else { //ViewBag.StatusMessage = "Only.jpg/.jpeg file allowed!"; //ViewBag.StatusMessageClass = "text-danger bg-danger"; TempData["StatusMessage"] = "Only.jpg/.jpeg file allowed!"; TempData["StatusMessageClass"] = "text-danger bg-danger"; //getDisplayData(ref CtrlIllustration); return RedirectToAction("illustration"); } } CtrlIllustration.ResponseDate = DateTime.Now.ToShortDateString(); BLObj.UpdateIllustrationData(CtrlIllustration); TempData["StatusMessage"] = "Saved successfuly"; TempData["StatusMessageClass"] = "text-success bg-success"; DataTable.Clear(); DataTable = BLObj.getUserIDFromTrnID(form["lblTrnID"]); string uid = DataTable.Rows[0]["UserId"].ToString(); string OId = DataTable.Rows[0]["OrderID"].ToString(); DataTable.Clear(); DataTable = BLObj.GetUserMailID(uid); statusHtmlFilePath = Server.MapPath(Constants.StatusChangeHTMLTemplate); SendMailOnStatusChange(uName, DataTable.Rows[0][0].ToString(), form["ddlStatus"], OId,statusHtmlFilePath); return RedirectToAction("illustration"); } else if (Command == "SearchUser") { //TempData["searchUser"] = pr.txtFilterUserName; return RedirectToAction("illustration", new { UserName = ir.txtFilterUserName }); } else if (Command == "Search") { return RedirectToAction("illustration", new { StartDate = ir.StartDate, EndDate = ir.EndDate, UserName = ir.txtFilterUserName }); } return RedirectToAction("RequestSuccess"); }
public ActionResult illustration(Illustration ir, FormCollection form, string Command) { if (Command == "Submit") { CtrlIllustration.ListBookSize = LoadBookSizeDropDown(); CtrlIllustration.ListColor = LoadColorDropDown(); CtrlIllustration.ListIllustrationNumber = LoadNoOfIllDropDown(); CtrlIllustration.ListIllustrationSize = LoadIllSizeDropDown(); CtrlIllustration.ListLang = LoadLangDropDown(); CtrlIllustration.ListStatus = LoadStatusDropDown(); MembershipUser MemberUser = Membership.GetUser(User.Identity.Name); string UserId = MemberUser.ProviderUserKey.ToString(); CtrlIllustration.UserID = UserId; CtrlIllustration.Language = form["ddlLang"]; CtrlIllustration.BookSize = form["ddlBSizes"]; CtrlIllustration.IllustrationSize = form["ddlIllSize"]; CtrlIllustration.IllustrationNumber = form["ddlNoOfIll"]; CtrlIllustration.Color = form["ddlColor"]; CtrlIllustration.IllustrationDescription = Request["textArea"]; CtrlIllustration.TemplateID = Session["tempID"].ToString(); CtrlIllustration.RequestDate = DateTime.Now.ToShortDateString(); CtrlIllustration.Status = "1"; CtrlIllustration.EstimatedAmt = 100; BussinessLayerObject.InsertIllustrationData(CtrlIllustration); ViewBag.StatusMessage = "Request submited successfuly"; ViewBag.StatusMessageClass = "text-success bg-success"; Session["tempID"] = null; SendMail("mail", CtrlIllustration.EstimatedAmt); } else { var uploadedFile = Request.Files[0]; var fileName1 = Path.GetFileName(uploadedFile.FileName); CtrlIllustration.Status = form["ddlStatus"]; CtrlIllustration.PTran_ID = form["lblTrnID"]; string uName = BussinessLayerObject.GetUserName(CtrlIllustration); if (fileName1 != String.Empty) { string strFileExtension = Path.GetExtension(uploadedFile.FileName); if (strFileExtension == ".jpg" || strFileExtension == ".jpeg") { fileName1 = uName + "_" + Constants.strResponse + "_" + DateTime.Now.Date.ToShortDateString() + "_" + fileName1; if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + uName + "//" + Constants.strResponse)) { Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + uName + "//" + Constants.strResponse); } var fileSavePath = Server.MapPath(Constants.strUploadFileIntialPath + "//" + uName + "//" + Constants.strResponse + "//" + fileName1); uploadedFile.SaveAs(fileSavePath); CtrlIllustration.ResponseFilePath = fileName1; } else { ViewBag.StatusMessage = "Only.jpg/.jpeg file allowed!"; ViewBag.StatusMessageClass = "text-danger bg-danger"; getDisplayData(ref CtrlIllustration); return View(CtrlIllustration); } } CtrlIllustration.ResponseDate = DateTime.Now.ToShortDateString(); BussinessLayerObject.UpdateIllustrationData(CtrlIllustration); ViewBag.StatusMessage = "Saved successfuly"; ViewBag.StatusMessageClass = "text-success bg-success"; } getDisplayData(ref CtrlIllustration); return View(CtrlIllustration); }
public ActionResult illustration() { var model = new Illustration(); getDisplayData(ref model); return View(model); }
private void getDisplayData(ref Illustration model) { model.ListBookSize = LoadBookSizeDropDown(); model.ListColor = LoadColorDropDown(); model.ListIllustrationNumber = LoadNoOfIllDropDown(); model.ListIllustrationSize = LoadIllSizeDropDown(); model.ListLang = LoadLangDropDown(); model.ListStatus = LoadStatusDropDown(); MembershipUser MemberUser = Membership.GetUser(User.Identity.Name); string UserId = MemberUser.ProviderUserKey.ToString(); DataTable dtData = new DataTable(); dtData = BussinessLayerObject.GetIllustrationUserData(UserId); List<Illustration> listData = new List<Illustration>(); foreach (DataRow dr in dtData.Rows) { listData.Add(new Illustration { PTran_ID = dr["Tran_ID"].ToString(), UserName = dr["UserName"].ToString(), Language = dr["lang_Name"].ToString(), BookSize = dr["size_Name"].ToString(), IllustrationSize = dr["illustration_Name"].ToString(), IllustrationNumber = dr["iNo_Name"].ToString(), Color = dr["color_Name"].ToString(), TemplateID = dr["temp_Name"].ToString(), IllustrationDescription = dr["IllDescrp"].ToString(), ResponseFilePath = dr["ResponseFilePath"].ToString(), Status = dr["status_Name"].ToString(), EstimatedAmt = int.Parse(dr["EstimatedAmt"].ToString()), isPaymentRelesed = dr["IsPaymentReleased"].ToString(), RequestDate = dr["RequestDate"].ToString(), ResponseDate = dr["ResponseDate"].ToString() }); } model.ModelList = listData; DataTable.Clear(); DataTable = BussinessLayerObject.get_Templates(); foreach (DataRow dr in DataTable.Rows) { model.temp_urls.Add(dr); } model.templates_Count = model.temp_urls.Count.ToString(); }