Esempio n. 1
0
        public string GetUserName(ProofReading pr)
        {
            try
            {
                clsParameterCollection clsParaCollection = new clsParameterCollection();
                clsParaCollection.ProcedureName = Constants.sp_GetUserName;
                clsParaCollection.Add(new clsParameter("@TrnId", pr.PTran_ID));
                dt.Reset();
                dt = DataAccess.ExecuteSpAndGetDataTable(clsParaCollection);
                return dt.Rows[0][0].ToString();

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public ActionResult ProofReadingNew(ProofReading pr, FormCollection form, string Command, string PageIndex)
        {

            if (Command == "Submit")
            {
                CtrlProofReading.ListLang = LoadLanguageDropDown();
                CtrlProofReading.ListStatus = LoadStatusDropDown();

                MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                string UserId = MemberUser.ProviderUserKey.ToString();

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

                if (strFileExtension == ".doc" || strFileExtension == ".docx" || strFileExtension == ".pdf")
                {
                    string FilePathToUpload = "";
                    FilePathToUpload = User.Identity.Name + "_" + Constants.strRequest + "_" + DateTime.Now.Date.ToShortDateString() + "_" + (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);


                    //string FileText = System.IO.File.ReadAllText(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);
                    ////FileText = FileText.Replace(" ", "");
                    //FileText = FileText.Replace("&", "");
                    //FileText = FileText.Replace("\0", "");

                    //StreamReader sr = new StreamReader(Server.MapPath(Constants.strUploadFileIntialPath) + "//" + User.Identity.Name + "//" + Constants.strRequest + "//" + FilePathToUpload);
                    //string str2 = sr.ReadToEnd();
                    //sr.Close();
                    //str2 = str2.Replace(" ", "");
                    ////str2 = str2.Replace("&", "");
                    //str2 = str2.Replace("\0", "");

                    //string[] strLength = str2.Split(' ');


                    CtrlProofReading.RequestFilePath = FilePathToUpload;
                    CtrlProofReading.UserID = UserId;
                    CtrlProofReading.Language = form["ddlLang"];
                    CtrlProofReading.WordsCount = "1000";
                    CtrlProofReading.EstimatedAmt = "1000";

                    CtrlProofReading.RequestDate = DateTime.Now.ToShortDateString();
                    CtrlProofReading.Status = "1";
                    BussinessLayerObject.InsertProofReadingRequest(CtrlProofReading);
                    ViewBag.StatusMessage = "Request submited successfuly";
                    ViewBag.StatusMessageClass = "text-success bg-success";

                    SendMail("mail", int.Parse(CtrlProofReading.WordsCount), int.Parse(CtrlProofReading.EstimatedAmt));
                }
                else
                {
                    ViewBag.StatusMessage = "Only document and PDF file allowed!";
                    ViewBag.StatusMessageClass = "text-danger bg-danger";
                }
            }
            else
            {
                ////////////////Edit button Functionality code Admin
                var uploadedFile = Request.Files[1];
                var fileName1 = Path.GetFileName(uploadedFile.FileName);

                CtrlProofReading.Status = form["ddlStatus"];
                CtrlProofReading.PTran_ID = form["lblTrnID"];
                string UserName = BussinessLayerObject.GetUserName(CtrlProofReading);
                MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
                string UserId = MemberUser.ProviderUserKey.ToString();
                if (fileName1 != String.Empty)
                {
                    fileName1 = UserName + "_" + Constants.strResponse + "_" + DateTime.Now.Date.ToShortDateString() + "_" + 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);
                    CtrlProofReading.ResponseFilePath = fileName1;
                }
                CtrlProofReading.ResponseDate = DateTime.Now.ToShortDateString();
                BussinessLayerObject.UpdateProofReadingData(CtrlProofReading);
                ViewBag.StatusMessage = "Saved successfuly";
                ViewBag.StatusMessageClass = "text-success bg-success";
            }

            getDisplayData(ref CtrlProofReading);
            return View(CtrlProofReading);
        }
Esempio n. 3
0
 public ActionResult ProofReadingNew()
 {
     var model = new ProofReading();
     getDisplayData(ref model);
     return View(model);
 }
Esempio n. 4
0
        /// <summary>
        /// This method is used to load model to display grid data.
        /// </summary>
        /// <param name="model"></param>
        private void getDisplayData(ref ProofReading model)
        {
            model.ListLang = LoadLanguageDropDown();
            model.ListStatus = LoadStatusDropDown();

            MembershipUser MemberUser = Membership.GetUser(User.Identity.Name);
            string UserId = MemberUser.ProviderUserKey.ToString();

            DataTable dtData = new DataTable();
            dtData = BussinessLayerObject.GetProofReadingUserData(UserId);


            List<ProofReading> listData = new List<ProofReading>();
            foreach (DataRow dr in dtData.Rows)
            {
                listData.Add(new ProofReading
                {
                    PTran_ID = dr["Trn_ID"].ToString(),
                    UserName = dr["UserName"].ToString(),
                    Language = dr["Lang_Name"].ToString(),
                    WordsCount = dr["WordsCount"].ToString(),
                    RequestFilePath = dr["RequestFilePath"].ToString(),
                    ResponseFilePath = dr["ResponseFilePath"].ToString(),
                    Status = dr["status_Name"].ToString(),
                    EstimatedAmt = dr["EstimatedAmt"].ToString(),
                    isPaymentRelesed = dr["IsPaymentReleased"].ToString(),
                    RequestDate = dr["RequestDate"].ToString(),
                    ResponseDate = dr["ResponseDate"].ToString()
                });
            }
            model.ModelList = listData;
        }
Esempio n. 5
0
 private System.Data.DataTable retrieve_Data()
 {
     var model = new ProofReading();
     if (User.IsInRole("Admin"))
     {
        // DataTable = BussinessLayerObject.get_ProofReadingData_Admin();
     }
     else
     {
         model.UserID = User.Identity.Name;
         // DataTable = BussinessLayerObject.GetProofReadingUserData(model);
     }
     return DataTable;
 }
Esempio n. 6
0
        public void InsertProofReadingRequest(ProofReading ProofReadingRef)
        {
            try
            {
                clsParameterCollection clsParaCollection = new clsParameterCollection();
                clsParaCollection.ProcedureName = Constants.sp_InsertProofReadingRequest;
                clsParaCollection.Add(new clsParameter("@UserID", ProofReadingRef.UserID));
                clsParaCollection.Add(new clsParameter("@LangID", ProofReadingRef.Language));
                clsParaCollection.Add(new clsParameter("@RequestFilePath", ProofReadingRef.RequestFilePath));
                clsParaCollection.Add(new clsParameter("@StatusID", ProofReadingRef.Status));
                clsParaCollection.Add(new clsParameter("@RequestDate", ProofReadingRef.RequestDate));
                clsParaCollection.Add(new clsParameter("@EstimatedAmt", ProofReadingRef.EstimatedAmt));
                clsParaCollection.Add(new clsParameter("@WordsCount", ProofReadingRef.WordsCount));

                DataAccess.ExecuteNonQuerySp(clsParaCollection);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        public void UpdateProofReadingData(ProofReading pr)
        {
            try
            {
                clsParameterCollection clsParaCollection = new clsParameterCollection();

                clsParaCollection.Add(new clsParameter("@TrnID", pr.PTran_ID));
                clsParaCollection.Add(new clsParameter("@Status", pr.Status));
                clsParaCollection.Add(new clsParameter("@ResponseDate", pr.ResponseDate));

                if (pr.ResponseFilePath != null)
                {
                    clsParaCollection.Add(new clsParameter("@ResponseFilePath", pr.ResponseFilePath));
                    clsParaCollection.ProcedureName = Constants.sp_UpdateProofReadingResponse;
                }
                else
                {
                    clsParaCollection.ProcedureName = Constants.sp_UpdateProofReadingStatus;
                }

                DataAccess.ExecuteNonQuerySp(clsParaCollection);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// This method is used to load model to display Webgrid data.
        /// </summary>
        /// <param name="model"></param>
        private void getDisplayData(ref ProofReading model)
        {
            model.ListLang = LoadLanguageDropDown();
            model.ListStatus = LoadStatusDropDown();

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

            DataTable dtData = new DataTable();
            //if (Request.IsAjaxRequest())
            //{
            //    dtData = BussinessLayerObject.GetFilteredProofReadingData((string)TempData["SearchUser"]);
            //}
            //if (!string.isnullorempty((string)tempdata["searchuser"]))
            //{

            // dtData = BussinessLayerObject.GetFilteredProofReadingData((string)TempData["SearchUser"]);
            //}
            //else
            //{

            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.GetFilteredProofReadingDataByBoth(model.UserName, model.StartIndex, model.EndIndex, model.sort, model.sortdir, model.StartDate, model.EndDate);
            }
            else if (!string.IsNullOrEmpty(model.StartDate))
            {
                dtData = BLObj.GetFilteredProofReadingDataByDates(UserId, model.StartIndex, model.EndIndex, model.sort, model.sortdir, model.StartDate, model.EndDate);
            }
            else if (!string.IsNullOrEmpty(model.UserName))
            {
                dtData = BLObj.GetFilteredProofReadingData(model.UserName, model.StartIndex, model.EndIndex, model.sort, model.sortdir);
            }
            else
            {
                dtData = BLObj.GetProofReadingUserData(UserId, model.StartIndex, model.EndIndex, model.sort, model.sortdir);
            }
            //}

            List<ProofReading> listData = new List<ProofReading>();
            foreach (DataRow dr in dtData.Rows)
            {

                listData.Add(new ProofReading
                {
                    SrNo = Convert.ToInt32(dr["row"]),
                    Trn_ID = dr["Trn_ID"].ToString(),
                    OrderID = dr["OrderID"].ToString(),
                    UserName = dr["UserName"].ToString(),
                    Language = dr["Lang_Name"].ToString(),
                    WordsCount = dr["WordsCount"].ToString(),
                    RequestFilePath = dr["RequestFilePath"].ToString(),
                    ResponseFilePath = dr["ResponseFilePath"].ToString(),
                    Status = dr["status_Name"].ToString(),
                    EstimatedAmt = dr["EstimatedAmt"].ToString(),
                    isPaymentRelesed = dr["IsPaymentReleased"].ToString(),
                    RequestDate = dr["RequestDate"].ToString(),
                    ResponseDate = dr["ResponseDate"].ToString()
                });
            }
            model.ModelList = listData;
        }
        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");
        }
        /// <summary>
        /// This Action executes for loading proofReading view.
        /// </summary>
        /// <returns></returns>
        //[Authorize(Roles = "Admin,Customer,ProofReading")]
        public ActionResult ProofReadingNew(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 ProofReading();
            model.PagingRange = Constants.PagingRange;
            if (!string.IsNullOrEmpty(UserName))
            {
                model.txtFilterUserName = UserName;
            }

            //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;

            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 = "Trn_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 = "Trn_ID";
                    model.sortdir = "Desc";
                }
            }
            model.UserName = UserName;
            getDisplayData(ref model);
            model.LastPageIndex = model.Pages;
            if (string.IsNullOrEmpty(sort))
            {
                if (Request.IsAjaxRequest()) { return PartialView("_WebgridProofReading", model); }
            }
            if (!string.IsNullOrEmpty(sort) && page != null)
            {
                return PartialView("_WebgridProofReading", model);
            }

            return View(model);
        }