Пример #1
0
        public ActionResult BanksGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Bank item)
        {
            var      model    = db.Banks;
            DateTime dateTime = IWSLookUp.GetCurrentDateTime();

            ViewBag.Bank   = item;
            item.CompanyID = (string)Session["CompanyID"];
            item.ModelId   = (int)IWSLookUp.MetaModelId.Banks;
            item.Posted    = dateTime;
            item.Updated   = dateTime;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);
                    db.SubmitChanges();
                    Session["Banks"] = IWSLookUp.GetBanks();
                    return(PartialView("BanksGridViewPartial", Session["Banks"]));
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("BanksGridViewPartial", item));
        }
Пример #2
0
        public ActionResult BanksGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Bank item)
        {
            var model = db.Banks;

            ViewBag.Bank = item;
            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.id == item.id);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        db.SubmitChanges();
                        Session["Banks"] = IWSLookUp.GetBanks();
                        return(PartialView("BanksGridViewPartial", Session["Banks"]));
                    }
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("BanksGridViewPartial", item));
        }
Пример #3
0
        public ActionResult BanksGridViewPartialDelete(string id)
        {
            var model = db.Banks;

            if (id != null)
            {
                try
                {
                    var item = model.FirstOrDefault(it => it.id == id);
                    if (item != null)
                    {
                        model.DeleteOnSubmit(item);
                    }
                    db.SubmitChanges();
                    Session["Banks"] = IWSLookUp.GetBanks();
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            return(PartialView("BanksGridViewPartial", Session["Banks"]));
        }
Пример #4
0
        public async Task <ActionResult> Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                // This doesn't count login failures towards account lockout
                // To enable password failures to trigger account lockout, change to shouldLockout: true
                var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe.Value, shouldLockout : false);

                switch (result)
                {
                case SignInStatus.Success:

                    string user = model.UserName;
                    Session["UserName"] = user;

                    GetTimeZoneInfo();

                    string companyId = IWSLookUp.GetCompany(model.UserName);
                    Session["CompanyID"] = companyId;

                    Session["TimeZoneId"] = IWSLookUp.GetTimeZoneId(companyId);

                    if (Session["Menus"] == null)
                    {
                        Session["Menus"] = IWSLookUp.GetMenu(companyId);
                    }
                    if (Session["ComboAccounts"] == null)
                    {
                        Session["ComboAccounts"] = IWSLookUp.GetAccounts();
                    }
                    if (Session["Articles"] == null)
                    {
                        Session["Articles"] = IWSLookUp.GetArticles();
                    }
                    if (Session["Accounts"] == null)
                    {
                        Session["Accounts"] = IWSLookUp.GetAccount();
                    }
                    if (Session["VAT"] == null)
                    {
                        Session["VAT"] = IWSLookUp.GetVats();
                    }
                    if (Session["ComboVAT"] == null)
                    {
                        Session["ComboVAT"] = IWSLookUp.GetVAT();
                    }
                    if (Session["Banks"] == null)
                    {
                        Session["Banks"] = IWSLookUp.GetBanks();
                    }
                    if (Session["ComboBanks"] == null)
                    {
                        Session["ComboBanks"] = IWSLookUp.GetBIC();
                    }
                    if (Session["CostCenters"] == null)
                    {
                        Session["CostCenters"] = IWSLookUp.GetCostCenter();
                    }
                    if (Session["ComboCostCenters"] == null)
                    {
                        Session["ComboCostCenters"] = IWSLookUp.GetCostCenters();
                    }
                    if (Session["QuantityUnits"] == null)
                    {
                        Session["QuantityUnits"] = IWSLookUp.GetQuantityUnits();
                    }
                    if (Session["Stores"] == null)
                    {
                        Session["Stores"] = IWSLookUp.GetStores();
                    }
                    if (Session["ComboStores"] == null)
                    {
                        Session["ComboStores"] = IWSLookUp.GetStore();
                    }
                    if (Session["Currencies"] == null)
                    {
                        Session["Currencies"] = IWSLookUp.GetCurrencies();
                    }
                    if (Session["ComboCurrency"] == null)
                    {
                        Session["ComboCurrency"] = IWSLookUp.GetCurrency();
                    }
                    if (Session["TypeJournal"] == null)
                    {
                        Session["TypeJournal"] = IWSLookUp.GetTypeJournals();
                    }
                    if (Session["ComboTypeJournal"] == null)
                    {
                        Session["ComboTypeJournal"] = IWSLookUp.GetTypeJournal();
                    }
                    if (Session["AffectatioJournal"] == null)
                    {
                        Session["AffectationJournal"] = IWSLookUp.GetAffectationJournal();
                    }
                    if (Session["Assets"] == null)
                    {
                        Session["Assets"] = IWSLookUp.GetAssets();
                    }
                    if (Session["Journal"] == null)
                    {
                        Session["Journal"] = IWSLookUp.GetTypeJournal();
                    }
                    if (Session["Customers"] == null)
                    {
                        Session["Customers"] = IWSLookUp.GetCustomer();
                    }
                    if (Session["Suppliers"] == null)
                    {
                        Session["Suppliers"] = IWSLookUp.GetSupplier();
                    }
                    if (Session["Company"] == null)
                    {
                        Session["Company"] = IWSLookUp.GetCompany();
                    }
                    return(RedirectToLocal(returnUrl));

                case SignInStatus.LockedOut:
                    return(View("Lockout"));

                case SignInStatus.RequiresVerification:
                    return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

                case SignInStatus.Failure:
                default:
                    ViewBag.ErrorMessage = "The user name or password provided is incorrect";
                    return(View());
                }
            }
            return(View(model));
        }