Exemplo n.º 1
0
        public ActionResult ArticlesGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Article item)
        {
            DateTime dateTime = IWSLookUp.GetCurrentDateTime();
            var      model    = db.Articles;

            item.CompanyID      = (string)Session["CompanyID"];
            item.ModelId        = (int)IWSLookUp.MetaModelId.Article;
            item.Posted         = dateTime;
            item.Updated        = dateTime;
            ViewData["Article"] = item;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);

                    db.SubmitChanges();
                    Session["Articles"] = IWSLookUp.GetArticles();
                    return(PartialView("ArticlesGridViewPartial", Session["Articles"]));
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("ArticlesGridViewPartial", item));
        }
Exemplo n.º 2
0
        public ActionResult BankAccountsGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] BankAccount item)
        {
            var model = db.BankAccounts;

            item.CompanyID          = (string)Session["CompanyID"];
            item.ModelId            = (int)IWSLookUp.MetaModelId.BankAccount;
            ViewData["bankAccount"] = item;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("BankAccountsGridViewPartial", db.BankAccounts.Where(c => c.CompanyID == (string)Session["CompanyID"])));
        }
Exemplo n.º 3
0
 public ActionResult AffectationJournalGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] AffectationJournal item)
 {
     item.CompanyID           = (string)Session["CompanyID"];
     ViewBag.AffectationDraft = item;
     if (ModelState.IsValid)
     {
         try
         {
             db.AffectationJournals.InsertOnSubmit(item);
             db.SubmitChanges();
             Session["AffectationJournal"] = IWSLookUp.GetAffectationJournal();
             return(PartialView("AffectationJournalGridViewPartial", Session["AffectationJournal"]));
         }
         catch (Exception e)
         {
             ViewData["GenericError"] = e.Message;
         }
     }
     else
     {
         ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
     }
     ViewBag.Aff = IWSLookUp.GetAffectationJournal();
     return(PartialView("AffectationJournalGridViewPartial", item));
 }
Exemplo n.º 4
0
        public ActionResult MenuUIGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Menu item)
        {
            var model = db.Menus;

            item.CompanyID    = (string)Session["CompanyID"];
            item.HasAccess    = false;
            item.Disable      = false;
            ViewData["menus"] = item;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);

                    db.SubmitChanges();
                    return(PartialView("MenuUIGridViewPartial", IWSLookUp.GetMenus()));
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("MenuUIGridViewPartial", item));
        }
Exemplo n.º 5
0
        public ActionResult TypeJournalsGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] TypeJournal item)
        {
            var model = db.TypeJournals;

            item.CompanyId = (string)Session["CompanyID"];
            item.ModelId   = (int)IWSLookUp.MetaModelId.TypeJournal;
            DateTime dateTime = IWSLookUp.GetCurrentDateTime();

            item.Posted       = dateTime;
            item.Updated      = dateTime;
            ViewBag.TypeDraft = item;
            if (ModelState.IsValid)
            {
                try
                {
                    item.Posted  = dateTime;
                    item.Updated = dateTime;
                    model.InsertOnSubmit(item);
                    db.SubmitChanges();
                    Session["TypeJournal"] = IWSLookUp.GetTypeJournals();
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("TypeJournalsGridViewPartial", item));
        }
Exemplo n.º 6
0
        public ActionResult MasterGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Brouillard item)
        {
            var model = db.Brouillards;

            item.CompanyId   = (string)Session["CompanyID"];
            ViewData["item"] = item;
            ViewBag.IsNewRow = true;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);
                    db.SubmitChanges();
                    ViewData["NewKeyValue"] = item.Id;
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("MasterGridViewPartial", IWSLookUp.GetBrouillard()));
        }
Exemplo n.º 7
0
        public ActionResult ImmoGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Depreciation item)
        {
            var model = db.Depreciations;

            item.CompanyId = (string)Session["CompanyID"];
            item.ModelId   = (int)IWSLookUp.MetaModelId.Asset;
            DateTime dateTime = IWSLookUp.GetCurrentDateTime();

            item.Posted      = dateTime;
            item.Updated     = dateTime;
            ViewData["immo"] = item;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);

                    db.SubmitChanges();

                    SetDepreciation(item);
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("ImmoGridViewPartial", IWSLookUp.GetDepreciation()));
        }
Exemplo n.º 8
0
        public ActionResult CompaniesGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Company item)
        {
            var model = db.Companies;

            ViewBag.Company = item;
            item.ModelId    = (int)IWSLookUp.MetaModelId.Company;
            if (ModelState.IsValid)
            {
                try
                {
                    model.InsertOnSubmit(item);
                    db.SubmitChanges();
                    Session["Company"] = IWSLookUp.GetCompany();
                    return(PartialView("CompaniesGridViewPartial", Session["Company"]));
                }
                catch (Exception e)
                {
                    ViewData["GenericError"] = e.Message;
                    IWSLookUp.LogException(e);
                }
            }
            else
            {
                ViewData["GenericError"] = IWSLookUp.GetModelSateErrors(ModelState);
            }
            return(PartialView("CompaniesGridViewPartial", item));
        }