コード例 #1
0
        public ActionResult ProofReadingNew(ProofReading pr, FormCollection form, string Command, string PageIndex)
        {
            if (Command == "Submit")
            {
                if (HttpContext.Session["upfID"] != null)
                {
                    pr.upfID = Convert.ToInt32(HttpContext.Session["upfID"]);

                }
                else
                {
                    pr.upfID = 0;

                }
                pr.ListLang = LoadLanguageDropDown();
                pr.ListStatus = LoadStatusDropDown();

                //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                //string UserId = MemberUser.ProviderUserKey.ToString();
                string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));

                var uploadedFile = Request.Files[0];
                    string strFileExtension = Path.GetExtension(uploadedFile.FileName);

                    if (strFileExtension == ".docx" || strFileExtension == ".doc")
                    {
                        if (uploadedFile.ContentLength > 0)
                        {
                            string FilePathToUpload = "";
                            FilePathToUpload = User.Identity.Name + "_" + Constants.strRequest + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + (Path.GetFileName(uploadedFile.FileName));

                            if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest))
                            {
                                Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest);
                            }
                            uploadedFile.SaveAs(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);

                            if (strFileExtension == ".docx" || strFileExtension == ".doc")
                            {
                                wordtext = ReadAllTextFromDocx(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);

                                MatchCollection collection = Regex.Matches(wordtext, @"[\S]+");
                                WordCount = collection.Count;

                            }

                            pr.OrderID = VishwaPress.BusinessLayer.Utilities.Common.GetUniqueKey(User.Identity.Name, pr.serviceChar);
                            pr.RequestFilePath = FilePathToUpload;
                            pr.UserID = UserId;
                            pr.Language = form["ddlLang"];
                            pr.WordsCount = WordCount.ToString();
                            //pr.EstimatedAmt = BLObj.CalculateEstimateAmt(WordCount);

                            //harshad Changes Start

                            DataTable GetPrice = BLObj.GetPricesInformation();

                            DataTable Get_Service_tax = BLObj.GetServiceTax();

                            string price = Convert.ToString((System.Math.Round(Convert.ToDouble(WordCount * Convert.ToDouble(GetPrice.Rows[0][0])))));
                            string priceafterservicetax = (Convert.ToDouble(price) * (Convert.ToDouble(Get_Service_tax.Rows[0][0]) / 100)).ToString();
                            pr.EstimatedAmt = Convert.ToInt32((Convert.ToDouble(price) + Convert.ToDouble(priceafterservicetax))).ToString();

                            //harshad Chnages End

                            pr.RequestDate = DateTime.Now.ToShortDateString();
                            pr.Status = "1";
                            BLObj.InsertProofReadingRequest(pr);
                            if (pr.upfID != 0)
                            {
                                BL_Account bl = new BL_Account();
                                bl.UpdateCountAndisDone(pr.upfID);
                                HttpContext.Session["upfID"] = "";
                            }
                            //ViewBag.StatusMessage = "Request submited successfuly";
                            //ViewBag.StatusMessageClass = "text-success bg-success";
                            dt = BLObj.GetUserMailID(UserId);
                            htmlFilePath = Server.MapPath(Constants.PREmailHTMLTemplate);
                            SendMail(User.Identity.Name, dt.Rows[0][0].ToString(), int.Parse(pr.WordsCount), int.Parse(pr.EstimatedAmt), pr.OrderID, htmlFilePath);

                        }
                        else
                        {
                            TempData["StatusMessage"] = "File is empty, please select another file";
                            TempData["StatusMessageClass"] = "text-danger bg-danger";
                            return RedirectToAction("ProofReadingNew");
                        }
                }
                else
                {
                    //ViewBag.StatusMessage = "Only document and PDF file allowed!";
                    //ViewBag.StatusMessageClass = "text-danger bg-danger";
                    TempData["StatusMessage"] = "Only .doc and .docx file allowed!";
                    TempData["StatusMessageClass"] = "text-danger bg-danger";
                    return RedirectToAction("ProofReadingNew");
                }
            }
            else if (Command == "Save")
            {
                ////////////////Edit button Functionality code Admin
                var uploadedFile = Request.Files[0];
                var fileName1 = Path.GetFileName(uploadedFile.FileName);

                pr.Status = form["ddlStatus"];
                pr.Trn_ID = form["lblTrnID"];
                string UserName = BLObj.GetUserName(pr);
                //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                //string UserId = MemberUser.ProviderUserKey.ToString();
                string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));
                if (fileName1 != String.Empty)
                {
                    fileName1 = UserName + "_" + Constants.strResponse + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + fileName1;
                    if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse))
                    {
                        Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse);
                    }
                    var fileSavePath = Server.MapPath(Constants.strUploadFileIntialPath + "//" + UserName + "//" + Constants.strResponse + "//" + fileName1);
                    uploadedFile.SaveAs(fileSavePath);
                    pr.ResponseFilePath = fileName1;
                }
                pr.ResponseDate = DateTime.Now.ToShortDateString();
                BLObj.UpdateProofReadingData(pr);
                //ViewBag.StatusMessage = "Saved successfuly";
                //ViewBag.StatusMessageClass = "text-success bg-success";
                TempData["StatusMessage"] = "Saved successfuly";
                TempData["StatusMessageClass"] = "text-success bg-success";
                dt.Clear();
                dt = BLObj.getUserIDFromTrnID(form["lblTrnID"]);
                uid = Convert.ToString(dt.Rows[0]["UserId"]);
                OId = Convert.ToString(dt.Rows[0]["OrderID"]);
                dt.Clear();
                dt = BLObj.GetUserMailID(uid);
                statusHtmlFilePath = Server.MapPath(Constants.StatusChangeHTMLTemplate);
                SendMailOnStatusChange(UserName, dt.Rows[0][0].ToString(), form["ddlStatus"], OId, statusHtmlFilePath);
                return RedirectToAction("ProofReadingNew");
            }
            else if (Command == "Search User")
            {
                //TempData["searchUser"] = pr.txtFilterUserName;
                return RedirectToAction("ProofReadingNew", new { UserName = pr.txtFilterUserName });
            }
            else if (Command == "Search")
            {
                return RedirectToAction("ProofReadingNew", new { StartDate = pr.StartDate, EndDate = pr.EndDate, UserName = pr.txtFilterUserName });
            }

            //getDisplayData(ref CtrlProofReading);
            //return View(CtrlProofReading);
            return RedirectToAction("RequestSuccess");
        }
コード例 #2
0
ファイル: ControllerBase.cs プロジェクト: har9421/Vishwapress
 public ControllerBase()
 {
     bl = new BL_Account();
     dt = new DataTable();
 }
コード例 #3
0
        public ActionResult CoverDesign(CoverDesign cr, FormCollection form, string Command, string PageIndex)
        {
            if (Command == "Submit")
            {
                var uploadedFile = Request.Files[0];
                var fileName1 = Path.GetFileName(uploadedFile.FileName);
                string UserName = HttpContext.User.Identity.Name;
                if (fileName1 != String.Empty)
                {
                    string strFileExtension = Path.GetExtension(uploadedFile.FileName);

                    if (strFileExtension == ".jpg" || strFileExtension == ".jpeg" || strFileExtension == ".cdr" || strFileExtension == ".doc" || strFileExtension == ".docx")// || strFileExtension == ".pdf")
                    {
                        fileName1 = UserName + "_" + Constants.strResponse + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + fileName1;
                        if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse))
                        {
                            Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse);
                        }
                        var fileSavePath = Server.MapPath(Constants.strUploadFileIntialPath + "//" + UserName + "//" + Constants.strResponse + "//" + fileName1);
                        uploadedFile.SaveAs(fileSavePath);
                        cr.RequestFilePath = fileName1;
                    }
                    else
                    {

                        TempData["StatusMessage"] = "Only.jpg/.jpeg/.cdr/.doc/.docx file allowed!";
                        TempData["StatusMessageClass"] = "text-danger bg-danger";
                        return RedirectToAction("CoverDesign");
                    }
                }

                if (HttpContext.Session["upfID"] != null)
                {
                    cr.upfID = Convert.ToInt32(HttpContext.Session["upfID"]);

                }
                else
                {
                    cr.upfID = 0;

                }
                cr.ListLang = LoadLanguageDropDown();
                cr.ListStatus = LoadStatusDropDown();

                //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                //string UserId = MemberUser.ProviderUserKey.ToString();
                string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));

                cr.OrderID = Common.GetUniqueKey(User.Identity.Name, cr.serviceChar);
                //cr.RequestFilePath = "";
                cr.UserID = UserId;
                cr.Language = form["ddlLang"];
                cr.BookSize = form["ddlSize"];
                cr.SpineSize = form["txtSpineSize"];
                cr.CoverDesignType = form["rbnCVDesign"];

                DataTable ServiceTax = BLObj.GetServiceTax();
                if (form["rbnCVDesign"].Contains("Graphical") || form["rbnCVDesign"].Contains("graphical"))
                {
                    DataTable coverdesignprice = BLObj.GetPricingForCoverDesing("Graphical");
                    String priceafterServiceTax = (Convert.ToDouble(coverdesignprice.Rows[0][0]) + (Convert.ToDouble(coverdesignprice.Rows[0][0]) * (Convert.ToDouble(ServiceTax.Rows[0][0]) / 100))).ToString();
                    cr.EstimatedAmt = Convert.ToInt32(priceafterServiceTax);
                }
                else //if (form["rbnCVDesign"].Contains("Illustrive"))
                {
                    DataTable coverdesignprice = BLObj.GetPricingForCoverDesing("Illustrive");
                    String priceafterServiceTax = (Convert.ToDouble(coverdesignprice.Rows[0][0]) + (Convert.ToDouble(coverdesignprice.Rows[0][0]) * (Convert.ToDouble(ServiceTax.Rows[0][0]) / 100))).ToString();
                    cr.EstimatedAmt = Convert.ToInt32(priceafterServiceTax);
                }
                //else
                //{ cr.EstimatedAmt = 0; }

                cr.BindingType = form["rbnCVDgn"];
                cr.SpineSize = form["txtSpineSize"];
                cr.CoverDesignSynopsis = form["textArea"];
                cr.RequestDate = DateTime.Now.ToShortDateString();
                cr.Status = "1";
                BLObj.InsertCoverDesignData(cr);
                if (cr.upfID != 0)
                {
                    BL_Account bl = new BL_Account();
                    bl.UpdateCountAndisDone(cr.upfID);
                    HttpContext.Session["upfID"] = "";
                }
                dt = BLObj.GetUserMailID(UserId);
                htmlFilePath = Server.MapPath(Constants.CREmailHTMLTemplate);
                SendMail(User.Identity.Name, dt.Rows[0][0].ToString(), cr.EstimatedAmt, cr.OrderID, htmlFilePath);

            }
            else if (Command == "Save")
            {
                ////////////////Edit button Functionality code Admin
                var uploadedFile = Request.Files[0];
                var fileName1 = Path.GetFileName(uploadedFile.FileName);

                cr.Status = form["ddlStatus"];
                cr.Trn_ID = form["lblTrnID"];
                string UserName = BLObj.GetUserName(cr);
                //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                //string UserId = MemberUser.ProviderUserKey.ToString();
                string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));
                if (fileName1 != String.Empty)
                {
                    string strFileExtension = Path.GetExtension(uploadedFile.FileName);

                    if (strFileExtension == ".jpg" || strFileExtension == ".jpeg" || strFileExtension == ".cdr" || strFileExtension == ".doc" || strFileExtension == ".docx" || strFileExtension == ".pdf")
                    {
                        fileName1 = UserName + "_" + Constants.strResponse + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + fileName1;
                        if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse))
                        {
                            Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse);
                        }
                        var fileSavePath = Server.MapPath(Constants.strUploadFileIntialPath + "//" + UserName + "//" + Constants.strResponse + "//" + fileName1);
                        uploadedFile.SaveAs(fileSavePath);
                        cr.ResponseFilePath = fileName1;
                    }
                    else
                    {

                        TempData["StatusMessage"] = "Only.jpg/.jpeg/.cdr/.doc/.docx/.pdf file allowed!";
                        TempData["StatusMessageClass"] = "text-danger bg-danger";
                        return RedirectToAction("CoverDesign");
                    }
                }
                cr.ResponseDate = DateTime.Now.ToShortDateString();
                BLObj.UpdateCoverDesignData(cr);

                TempData["StatusMessage"] = "Saved successfuly";
                TempData["StatusMessageClass"] = "text-success bg-success";
                dt.Clear();
                dt = BLObj.getUserIDFromTrnID(form["lblTrnID"]);
                uid = Convert.ToString(dt.Rows[0]["UserId"]);
                OId = Convert.ToString(dt.Rows[0]["OrderID"]);
                dt.Clear();
                dt = BLObj.GetUserMailID(uid);
                statusHtmlFilePath = Server.MapPath(Constants.StatusChangeHTMLTemplate);
                SendMailOnStatusChange(UserName, dt.Rows[0][0].ToString(), form["ddlStatus"], OId, statusHtmlFilePath);
                return RedirectToAction("CoverDesign");
            }
            else if (Command == "SearchUser")
            {
                //TempData["searchUser"] = pr.txtFilterUserName;
                return RedirectToAction("CoverDesign", new { UserName = cr.txtFilterUserName });
            }
            else if (Command == "Search")
            {
                return RedirectToAction("CoverDesign", new { StartDate = cr.StartDate, EndDate = cr.EndDate, UserName = cr.txtFilterUserName });
            }

            return RedirectToAction("RequestSuccess");
        }
コード例 #4
0
        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");
        }
コード例 #5
0
        public ActionResult FormattingNew(Formatting pr, FormCollection form, string Command, string PageIndex)
        {
            if (Command == "Submit")
            {
                if (HttpContext.Session["upfID"] != null)
                {
                    CtrlFormatting.upfID = Convert.ToInt32(HttpContext.Session["upfID"]);

                }
                else
                {
                    CtrlFormatting.upfID = 0;

                }
                CtrlFormatting.ListSize = LoadBookSizeDropDown();
                CtrlFormatting.ListStatus = LoadStatusDropDown();

                //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                //string UserId = MemberUser.ProviderUserKey.ToString();
                string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));

                var uploadedFile = Request.Files[0];
                string strFileExtension = Path.GetExtension(uploadedFile.FileName);

                if (strFileExtension == ".docx" || strFileExtension == ".doc") //|| strFileExtension == ".pdf")
                {
                    if (uploadedFile.ContentLength > 0)
                    {
                        string FilePathToUpload = "";
                        FilePathToUpload = User.Identity.Name + "_" + Constants.strRequest + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + (Path.GetFileName(uploadedFile.FileName));

                        if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest))
                        {
                            Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest);
                        }
                        uploadedFile.SaveAs(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);
                        if (strFileExtension == ".docx")
                        {
                            NumberOfPages = CountPagesFromDocx(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);
                        }
                        else
                        {
                            NumberOfPages = CountPagesFromPdf(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);
                        }
                        CtrlFormatting.RequestFileName = FilePathToUpload;
                        CtrlFormatting.UserID = UserId;
                        CtrlFormatting.BookSize = form["ddlSize"];

                        DataTable GetPriceforFormatting = BLObj.GetPriceForFormatting();
                        DataTable GetServiceTax = BLObj.GetServiceTax();

                        string getprice = Convert.ToString(Convert.ToInt32(NumberOfPages) * Convert.ToInt32(GetPriceforFormatting.Rows[0]["FormattingPricing"]));

                        CtrlFormatting.EstimatedAmt = (Convert.ToDouble(getprice) + (Convert.ToDouble(GetServiceTax.Rows[0][0]) / 100)).ToString();

                        CtrlFormatting.RequestDate = DateTime.Now.ToShortDateString();
                        CtrlFormatting.Status = "1";

                        CtrlFormatting.FullPageIMGCount = Session["fullPImg"].ToString();
                        CtrlFormatting.HalfPageIMGCount = Session["halfPImg"].ToString();
                        CtrlFormatting.QuarterPageIMGCount = Session["quaterPImg"].ToString();
                        CtrlFormatting.TemplateID = Session["tempID"].ToString();
                        CtrlFormatting.OrderID = VishwaPress.BusinessLayer.Utilities.Common.GetUniqueKey(User.Identity.Name, CtrlFormatting.serviceChar);

                        BLObj.InsertFormattingRequest(CtrlFormatting);
                        Session["fullPImg"] = null;
                        Session["halfPImg"] = null;
                        Session["quaterPImg"] = null;
                        Session["tempID"] = null;
                        if (CtrlFormatting.upfID != 0)
                        {
                            BL_Account bl = new BL_Account();
                            bl.UpdateCountAndisDone(CtrlFormatting.upfID);
                            HttpContext.Session["upfID"] = "";
                        }
                        //ViewBag.StatusMessage = "Request submited successfuly";
                        //ViewBag.StatusMessageClass = "text-success bg-success";
                        DataTable = BLObj.GetUserMailID(UserId);
                        htmlFilePath = Server.MapPath(Constants.FREmailHTMLTemplate);
                        SendMail(User.Identity.Name, DataTable.Rows[0][0].ToString(), int.Parse(CtrlFormatting.FullPageIMGCount), int.Parse(CtrlFormatting.HalfPageIMGCount), int.Parse(CtrlFormatting.QuarterPageIMGCount), CtrlFormatting.EstimatedAmt, CtrlFormatting.OrderID, htmlFilePath);
                    }
                    else
                    {
                        TempData["StatusMessage"] = "File is empty, please select another file";
                        TempData["StatusMessageClass"] = "text-danger bg-danger";
                        return RedirectToAction("FormattingNew");
                    }
                }
                else
                {
                    //ViewBag.StatusMessage = "Only document and PDF file allowed!";
                    //ViewBag.StatusMessageClass = "text-danger bg-danger";
                    TempData["StatusMessage"] = "Only document allowed!";
                    TempData["StatusMessageClass"] = "text-danger bg-danger";
                    return RedirectToAction("FormattingNew");
                }
                //getDisplayData(ref CtrlFormatting);
                //return View(CtrlFormatting);

            }
            else if (Command == "Save")
            {
                ////////////////Edit button Functionality code Admin
                var uploadedFile = Request.Files[0];
                var fileName1 = Path.GetFileName(uploadedFile.FileName);

                CtrlFormatting.Status = form["ddlStatus"];
                CtrlFormatting.Trn_ID = form["lblTrnID"];
                string UserName = BLObj.GetUserName(CtrlFormatting);
                string UserId = Convert.ToString(Common.GetUserId(HttpContext.User.Identity.Name));
                //MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                //string UserId = MemberUser.ProviderUserKey.ToString();
                if (fileName1 != String.Empty)
                {
                    fileName1 = UserName + "_" + Constants.strResponse + "_" + DateTime.Today.ToString("dd-MM-yyyy") + "_" + fileName1;
                    if (!Directory.Exists(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse))
                    {
                        Directory.CreateDirectory(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + UserName + "//" + Constants.strResponse);
                    }
                    var fileSavePath = Server.MapPath(Constants.strUploadFileIntialPath + "//" + UserName + "//" + Constants.strResponse + "//" + fileName1);
                    uploadedFile.SaveAs(fileSavePath);
                    CtrlFormatting.ReponseFileName = fileName1;
                }
                CtrlFormatting.ResponseDate = DateTime.Now.ToShortDateString();
                BLObj.UpdateFormattingData(CtrlFormatting);
                //ViewBag.StatusMessage = "Saved successfuly";
                //ViewBag.StatusMessageClass = "text-success bg-success";
                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(UserName, DataTable.Rows[0][0].ToString(), form["ddlStatus"], OId, statusHtmlFilePath);
                return RedirectToAction("FormattingNew");
            }
            else if (Command == "SearchUser")
            {
                //TempData["searchUser"] = pr.txtFilterUserName;
                return RedirectToAction("FormattingNew", new { UserName = pr.txtFilterUserName });
            }
            else if (Command == "Search")
            {
                return RedirectToAction("FormattingNew", new { StartDate = pr.StartDate, EndDate = pr.EndDate, UserName = pr.txtFilterUserName });
            }
            //getDisplayData(ref CtrlFormatting);
            //return View(CtrlFormatting);
            return RedirectToAction("RequestSuccess");
        }