/// <summary>
        /// Get Notification List in Layout
        /// </summary>
        /// <returns></returns>
        public JsonResult NotificationsList()
        {
            string ActionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            Int32? UserID         = HttpContext.Session.GetInt32("UserID");
            string ErrorMessage   = string.Empty;

            try
            {
                IEnumerable <NotificationModel> lstNotification = null;
                var Res        = _CommonRepository.AuditTrailLog("Notification", "Vendor Notification  List", UserID, 0);
                int pageSize   = 5;
                var UserId     = HttpContext.Session.GetInt32("CompanyID");
                var role       = HttpContext.Session.GetString("Role");
                var roleAccess = HttpContext.Session.GetString("RoleAccess");
                int isRead     = 0;

                int i = 0;

                if (roleAccess == "Vendor")
                {
                    lstNotification = _Userepository.getUserNotificationList("", pageSize, UserId, 0, "", isRead);
                    if (lstNotification != null && lstNotification.Count() != 0)
                    {
                        i = lstNotification.Count();
                    }
                    //var result = new { data = lstUserNotification, data2 = i };
                    //return Json(result);
                }

                else if (roleAccess == "Anchor Company")
                {
                    lstNotification = _AnchorCompanyRepository.getAnchorNotificationList("", pageSize, UserId, 0, "", isRead);
                    if (lstNotification != null && lstNotification.Count() != 0)
                    {
                        i = lstNotification.Count();
                    }
                }

                else if (roleAccess == "Bank")
                {
                    lstNotification = _AnchorCompanyRepository.getBankNotificationList("", pageSize, UserId, 0, "", isRead);
                    if (lstNotification != null && lstNotification.Count() != 0)
                    {
                        i = lstNotification.Count();
                    }
                }

                var result = new { data = lstNotification, data2 = i };
                return(Json(result));
            }
            catch (Exception ex)
            {
                var st        = new StackTrace(ex, true);
                var frame     = st.GetFrame(0);
                int ErrorLine = frame.GetFileLineNumber();
                var Result    = _CommonRepository.LogManagement(ControllerName, ActionName, ex.Message, ErrorLine, UserID);
                throw ex;
            }
        }
        public JsonResult GetAnchorLostOpportunities(int companyID, string fromDate, string toDate)
        {
            string ActionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            Int32? UserID         = HttpContext.Session.GetInt32("UserID");
            string ErrorMessage   = string.Empty;

            try
            {
                var   Res      = _CommonRepository.AuditTrailLog("Lost Opportunities", "Anchore Lost opportinities  List", UserID, 0);
                Int32?VendorId = HttpContext.Session.GetInt32("CompanyID");
                var   draw     = Request.Form["draw"].FirstOrDefault();
                var   start    = Request.Form["start"].FirstOrDefault();
                var   length   = Request.Form["length"].FirstOrDefault();
                //Get Sort columns value
                var sortBy = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault() + " " + Request.Form["order[0][dir]"].FirstOrDefault();

                int pageSize = length != null?Convert.ToInt32(length) : 0;

                int skip = start != null?Convert.ToInt32(start) : 0;

                var FromDate = fromDate;
                var ToDate   = toDate;

                IEnumerable <AnchorAnalyticLostOppModel> lstAnalyticsLostOpp = _AnchorCompanyRepository.GetLostOpportunity(VendorId, sortBy, pageSize, skip, companyID, FromDate, ToDate);
                int?recordsFiltered = 0;
                int?recordsTotal    = 0;
                if (lstAnalyticsLostOpp != null && lstAnalyticsLostOpp.Count() != 0)
                {
                    recordsFiltered = lstAnalyticsLostOpp.ElementAt(0).FilteredRecord;
                    recordsTotal    = lstAnalyticsLostOpp.ElementAt(0).TotalRecord;
                }

                return(Json(new { draw = draw, recordsFiltered = recordsFiltered, recordsTotal = recordsTotal, data = lstAnalyticsLostOpp }));
            }
            catch (Exception ex)
            {
                var st        = new StackTrace(ex, true);
                var frame     = st.GetFrame(0);
                int ErrorLine = frame.GetFileLineNumber();
                var Result    = _CommonRepository.LogManagement(ControllerName, ActionName, ex.Message, ErrorLine, UserID);
                throw ex;
            }
        }
Exemplo n.º 3
0
        public JsonResult getAwaitedInvoiceList()
        {
            string ActionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            Int32? UserID         = HttpContext.Session.GetInt32("UserID");
            string ErrorMessage   = string.Empty;

            try
            {
                var   Res      = _CommonRepository.AuditTrailLog("Awaited Approval", "Awaited Invoice List", UserID, 0);
                Int32?VendorId = HttpContext.Session.GetInt32("CompanyID");
                var   draw     = Request.Form["draw"].FirstOrDefault();
                var   start    = Request.Form["start"].FirstOrDefault();
                var   length   = Request.Form["length"].FirstOrDefault();
                //Get Sort columns value
                var sortBy = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault() + " " + Request.Form["order[0][dir]"].FirstOrDefault();

                int pageSize = length != null?Convert.ToInt32(length) : 0;

                int skip = start != null?Convert.ToInt32(start) : 0;

                var CompanyName        = Request.Form["columns[1][search][value]"].FirstOrDefault();
                var InvoiveAppTotlAmnt = Request.Form["columns[4][search][value]"].FirstOrDefault();


                IEnumerable <AnchorCompListingModel> lstAnchorCompany = _AnchorCompanyRepository.GetAnchorCompListingByVendorId(VendorId, sortBy, pageSize, skip, "", CompanyName, InvoiveAppTotlAmnt, "DiscInvoicesStatus", 3);
                int?recordsFiltered = 0;
                int?recordsTotal    = 0;
                if (lstAnchorCompany != null && lstAnchorCompany.Count() != 0)
                {
                    recordsFiltered = lstAnchorCompany.ElementAt(0).FilteredRecord;
                    recordsTotal    = lstAnchorCompany.ElementAt(0).TotalRecord;
                }

                return(Json(new { draw = draw, recordsFiltered = recordsFiltered, recordsTotal = recordsTotal, data = lstAnchorCompany }));
            }
            catch (Exception ex)
            {
                var st        = new StackTrace(ex, true);
                var frame     = st.GetFrame(0);
                int ErrorLine = frame.GetFileLineNumber();
                var Result    = _CommonRepository.LogManagement(ControllerName, ActionName, ex.Message, ErrorLine, UserID);
                throw ex;
            }
        }
Exemplo n.º 4
0
        public IActionResult AnalyticsLostOpp()
        {
            string ActionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            Int32? UserID         = HttpContext.Session.GetInt32("UserID");
            string ErrorMessage   = string.Empty;

            try
            {
                var   Res      = _CommonRepository.AuditTrailLog("Lost opportunities", "Analytic Lost opportunities List", UserID, 0);
                Int32?VendorId = HttpContext.Session.GetInt32("CompanyID");
                IEnumerable <AnchorCompDropDownModel> lstCompany = _VendorAnalyticsRepository.getAnchorCompList(VendorId);
                return(View("~/Views/Vendor/AnalyticLostOpp.cshtml", lstCompany));
            }
            catch (Exception ex)
            {
                var st        = new StackTrace(ex, true);
                var frame     = st.GetFrame(0);
                int ErrorLine = frame.GetFileLineNumber();
                var Result    = _CommonRepository.LogManagement(ControllerName, ActionName, ex.Message, ErrorLine, UserID);
                return(RedirectToAction("ErrorPage", "Common"));
            }
        }
Exemplo n.º 5
0
        public IActionResult ValidateUserLogOn(string Email, string Password, string IsRemember)
        {
            if (!ReCaptchaPassed(
                    Request.Form["g-recaptcha-response"], // that's how you get it from the Request object
                    _configuration.GetSection("GoogleReCaptcha:SecretKey").Value
                    ))
            {
                TempData["InvalidCredential"] = "Captcha verification failed.";
                return(RedirectToAction("UserLogin", "Account"));
            }

            string ControllerActionName = this.ControllerContext.RouteData.Values["action"].ToString();
            string ControllerName       = this.ControllerContext.RouteData.Values["controller"].ToString();
            Int32? LoginUserID          = HttpContext.Session.GetInt32("UserID");

            string ErrorMessage = string.Empty;

            try
            {
                string pw = SecurityHelperService.Decrypt("8qLsuVEBHnIzavnjCKcC5g==");
                Password = SecurityHelperService.Encrypt(Password);
                UserLoginModel userModel  = _venderRepository.validateUser(Email, Password);
                string         Controller = "";
                string         ActionName = "";
                HttpContext.Session.SetString("Role", "InternalUser");
                if (userModel == null)
                {
                    string strLockRes = _adminRepository.LockedUser(Email);
                    TempData["InvalidCredential"] = strLockRes;
                    //TempData["InvalidCredential"] = "Enter valid credential";
                    return(RedirectToAction("UserLogin", "Account"));
                }
                else
                {
                    var UserID      = Convert.ToInt32(userModel.UserID);
                    var UserName    = userModel.Name;
                    var CompanyId   = userModel.CompanyID;
                    var RoleAccess  = userModel.RoleAccess;
                    var Companyname = userModel.Companyname;

                    Response.Cookies.Delete("RoleAccess");

                    CookieOptions option = new CookieOptions();
                    option.Expires = DateTime.Now.AddDays(2);
                    Response.Cookies.Append("RoleAccess", RoleAccess, option);

                    HttpContext.Session.SetInt32("UserID", UserID);
                    HttpContext.Session.SetString("LoginName", UserName);
                    HttpContext.Session.SetInt32("CompanyID", CompanyId);
                    HttpContext.Session.SetString("RoleAccess", RoleAccess);
                    HttpContext.Session.SetString("Companyname", Companyname);
                    HttpContext.Session.SetString("JWToken", GenerateJWTToken(UserName));

                    if (IsRemember == "1")
                    {
                        SetCookie(UserID.ToString(), UserName, "InternalUser");
                        Response.Cookies.Append("Email", Email, option);
                    }
                    var Res = _CommonRepository.AuditTrailLog("LoginPage", "LoginPage", UserID, 0);
                    if (userModel.IsTemporaryPassword == false)
                    {
                        if (RoleAccess == "Vendor Company")
                        {
                            Controller = "Vendor";
                            ActionName = "VendorDashboardMain";
                        }
                        if (RoleAccess == "Anchor Company")
                        {
                            var    lstchecklimit  = _companyRepository.CheckSetLimit(CompanyId);
                            string PercentageRate = Convert.ToString(lstchecklimit.ElementAt(0).PercentageRate);
                            string PaymentDays    = Convert.ToString(lstchecklimit.ElementAt(0).PaymentDays);
                            //if (PercentageRate != "" && PaymentDays != "")
                            //{
                            Controller = "AnchorCompany";
                            ActionName = "AnchorDashboard";
                            //}
                            //else
                            //{
                            //    //Controller = "AnchorCompany";
                            //    //ActionName = "AnchorDashboard";
                            //    Controller = "AnchorCompany";
                            //    ActionName = "SetLimit";

                            //}
                        }

                        if (RoleAccess == "Both")
                        {
                            Controller = "AnchorCompany";
                            ActionName = "AnchorDashboard";
                        }
                        if (RoleAccess == "Bank")
                        {
                            Controller = "BankCompany";
                            ActionName = "BankDashboard";
                        }
                        return(RedirectToAction(ActionName, Controller));
                    }
                    else
                    {
                        var data = Encoding.UTF8.GetBytes("InternalUser");
                        var Role = Convert.ToBase64String(data);
                        HttpContext.Session.SetString("Email", userModel.Email);
                        Controller = "Common";
                        ActionName = "ChangePassword";
                        SetCookie(UserID.ToString(), UserName, Role);
                        return(RedirectToAction(ActionName, Controller, new { RoleName = Role }));
                    }
                }
            }
            catch (Exception ex)
            {
                var st        = new StackTrace(ex, true);
                var frame     = st.GetFrame(0);
                int ErrorLine = frame.GetFileLineNumber();
                var Result    = _CommonRepository.LogManagement(ControllerName, ControllerActionName, ex.Message, ErrorLine, LoginUserID);
                return(RedirectToAction("ErrorPage", "Common"));
            }
        }