Ejemplo n.º 1
0
        public JsonResult VendorInvoiceList(DataTableObject Obj)
        {
            try
            {
                Obj.BranchID = BRANCH_ID;
                var vendorInvoiceList = new InvoiceHeaderBO()
                                        .GetVendorInvoiceDataTableList(Obj, UTILITY.CONFIG_INVOICETYPE_VENDOR)
                                        .Select(x => new
                {
                    DocumentNo         = x.DocumentNo,
                    InvoiceNo          = x.InvoiceNo,
                    CusInvoiceNo       = x.CusInvoiceNo,
                    CustomerCode       = x.CustomerCode,
                    CustomerName       = x.CustomerName,
                    ProductCode        = x.ProductCode,
                    ProductName        = x.ProductName,
                    InvoiceDate        = x.InvoiceDate.ToShortDateString(),
                    WarrantyExpiryDate = x.WarrantyExpiryDate.ToShortDateString(),
                    Quantity           = x.Quantity,
                    UnitPrice          = x.UnitPrice,
                    EncryptStr         = UrlEncryptionHelper.Encrypt(string.Format("invoiceNo={0}?documentNo={1}", x.InvoiceNo, x.DocumentNo))
                }).ToList();

                var totalRecords = new InvoiceHeaderBO().GetList(BRANCH_ID).Where(x => x.InvoiceType == UTILITY.CONFIG_INVOICETYPE_VENDOR && x.Status == true).Count();
                return(Json(new
                {
                    vendorInvoiceList = vendorInvoiceList,
                    totalRecords = totalRecords
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            LoginViewModel model = new LoginViewModel();

            //var compist = new CompanyBO().GetList();
            //for(var i = 0;i < compist.Count;i++)
            //{
            //    compist[i].CompanyCode = UrlEncryptionHelper.Encrypt(compist[i].CompanyCode);
            //}
            //model.CompaniesList = new SelectList(compist, "CompanyCode", "CompanyName");
            var companyCode = "EZY";
            var branchList  = new BranchBO().GetList().Where(x => x.CompanyCode == companyCode).ToList();

            model.BranchList = new SelectList(branchList, "BranchID", "BranchName").ToList();

            var compist = new CompanyBO().GetList();

            for (var i = 0; i < compist.Count; i++)
            {
                compist[i].CompanyCode = UrlEncryptionHelper.Encrypt(compist[i].CompanyCode);
            }
            model.CompanyCode   = "EZY";
            model.CompaniesList = new SelectList(compist, "CompanyCode", "CompanyName");
            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult SaveBranchProfile(Branch branch)
        {
            branch.CreatedBy  = USER_ID;
            branch.ModifiedBy = USER_ID;
            branch.IsActive   = true;

            if (branch.BranchAddress.AddressId == 0)
            {
                branch.BranchAddress.AddressType   = "Branch";
                branch.BranchAddress.SeqNo         = 1;
                branch.BranchAddress.IsActive      = true;
                branch.BranchAddress.AddressLinkID = branch.BranchCode;
            }
            var result       = new BranchBO().SaveBranch(branch);
            var encryptedStr = UrlEncryptionHelper.Encrypt(string.Format("companyCode={0}?branchCode={1}", branch.CompanyCode, branch.BranchCode));

            return(RedirectToAction("BranchProfile", "Company", new { q = encryptedStr }));
        }
Ejemplo n.º 4
0
        public JsonResult GetCustomers(DataTableObject Obj)
        {
            Obj.BranchID = BRANCH_ID;
            var customers    = new CustomerBO().GetCustomerTableDataList(Obj);
            var totalRecords = new CustomerBO().GetList(BRANCH_ID).Count();

            return(Json(new
            {
                customers = customers.Select(x => new
                {
                    CustomerTypeDescription = x.CustomerTypeDescription,
                    CustomerCode = x.CustomerCode,
                    CustomerName = x.CustomerName,
                    Status = x.Status,
                    EncryptStr = UrlEncryptionHelper.Encrypt(string.Format("customerCode={0}", x.CustomerCode))
                }),
                totalRecords = totalRecords
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public ActionResult SaveCompanyProfile(Company company)
        {
            company.CreatedBy  = USER_ID;
            company.ModifiedBy = USER_ID;
            company.IsActive   = true;

            if (company.CompanyAddress.AddressId == 0)
            {
                company.CompanyAddress.AddressType   = "Company";
                company.CompanyAddress.SeqNo         = 1;
                company.CompanyAddress.AddressLinkID = company.CompanyCode;
            }

            var result       = new CompanyBO().SaveCompany(company);
            var encryptedStr = UrlEncryptionHelper.Encrypt(string.Format("companyCode={0}", company.CompanyCode));

            return(RedirectToAction("CompanyProfile", "Company",
                                    new { q = encryptedStr }));
        }
Ejemplo n.º 6
0
        public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            model.CompanyCode = "EZY";
            var    BranchDetails = new BranchBO().GetList().Where(x => x.BranchID == model.BranchID).ToList();
            string BranchName    = BranchDetails.Select(x => x.BranchName).FirstOrDefault();

            //if (!string.IsNullOrEmpty(Request.QueryString["companyCode"]))
            //{
            //    var companyCode = UrlEncryptionHelper.Decrypt(Request.QueryString["companyCode"]);
            //    var branchList = new BranchBO().GetList().Where(x => x.CompanyCode == companyCode).ToList();
            //    model.BranchList = new SelectList(branchList, "BranchID", "BranchName");

            //    var compist = new CompanyBO().GetList();
            //    for (var i = 0; i < compist.Count; i++)
            //    {
            //        compist[i].CompanyCode = UrlEncryptionHelper.Encrypt(compist[i].CompanyCode);
            //    }
            //    model.CompaniesList = new SelectList(compist, "CompanyCode", "CompanyName");

            //    return View("Index", model);
            //}

            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }

            var lstUsers = new UsersBO().GetList();

            var currentUser = lstUsers.Where(
                ur => ur.UserID.ToLower() == model.UserID.ToLower() &&
                ur.Password.ToLower() == model.Password.ToLower()).FirstOrDefault();

            var userBranch = new UserBranchBO().GetList(model.UserID)
                             .Where(x => x.BranchID == model.BranchID)
                             .FirstOrDefault();

            if (currentUser != null && userBranch != null)
            {
                FormsAuthentication.SetAuthCookie(currentUser.UserID, false);

                var _CompanyId = model.CompanyCode;
                var SsnObj     = new SessionObject {
                    UserID      = currentUser.UserID,
                    UserName    = currentUser.UserName,
                    Email       = currentUser.Email,
                    RoleCode    = currentUser.RoleCode,
                    BranchId    = model.BranchID,
                    BranchName  = BranchName,
                    CompanyId   = _CompanyId,
                    CompanyName = new CompanyBO().GetList().Where(x => x.CompanyCode == _CompanyId).FirstOrDefault().CompanyName
                };

                USER_OBJECT     = SsnObj;
                USER_SECURABLES = new RoleRightsBO().GetSecurableItemsListByRoleCode(SsnObj.RoleCode);

                Session["UserID"]   = currentUser.UserID;
                Session["UserName"] = currentUser.UserName;
                Session["BranchId"] = model.BranchID;

                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                    !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Education", "Home"));
                }
            }
            else
            {
                //ModelState.AddModelError("", "The user name or password provided is incorrect.");

                ViewBag.ErrMsg = "The user name or password provided is incorrect.";
                LoginViewModel modelObj = new LoginViewModel();

                var compist = new CompanyBO().GetList();
                for (var i = 0; i < compist.Count; i++)
                {
                    compist[i].CompanyCode = UrlEncryptionHelper.Encrypt(compist[i].CompanyCode);
                }
                modelObj.CompaniesList = new SelectList(compist, "CompanyCode", "CompanyName");
                var companyCode = "EZY";
                var branchList  = new BranchBO().GetList().Where(x => x.CompanyCode == companyCode).ToList();
                modelObj.BranchList = new SelectList(branchList, "BranchID", "BranchName").ToList();

                return(View("Index", modelObj));
            }
        }