public Master_Menu Add(Master_Menu model)
        {
            var dc = new eprocdbDataContext();

            dc.Master_Menus.InsertOnSubmit(model);
            dc.SubmitChanges();
            return(model);
        }
Exemplo n.º 2
0
        public Master_Menu Add(Master_Menu model)
        {
            var dc = new eprocdbDataContext();
            var id = "0" + (dc.Master_Menus.Count() + 1).ToString();

            model.MenuID = id;
            dc.Master_Menus.InsertOnSubmit(model);
            dc.SubmitChanges();
            return(model);
        }
Exemplo n.º 3
0
        public Master_Menu Edit(string menuId, Master_Menu model)
        {
            var dc = new eprocdbDataContext();
            var md = (from c in dc.Master_Menus where c.MenuID == menuId select c).SingleOrDefault();

            md.MenuID   = model.MenuID;
            md.MenuName = model.MenuName;
            md.Text     = model.Text;
            dc.SubmitChanges();
            return(model);
        }
 public ActionResult Edit(string menuId, Master_Menu model)
 {
     try
     {
         IFunctionService svc = new FunctionService();
         var result           = svc.Edit(menuId, model);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         general.AddLogError("Function Edit", ex.Message, ex.StackTrace);
         return(View("~/Views/Master/Function/Index.cshtml"));
     }
 }
Exemplo n.º 5
0
 public ActionResult Edit(string menuId, Master_Menu model)
 {
     try
     {
         // TODO: Add update logic here
         IModulService objIMS = new ModulService();
         var           result = objIMS.Edit(menuId, model);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         general.AddLogError("Modul Edit", ex.Message, ex.StackTrace);
         return(View("~/Views/Master/Modul/Index.cshtml"));
     }
 }
 public ActionResult Add(Master_Menu model)
 {
     try
     {
         IFunctionService svc = new FunctionService();
         model.MenuID = FunctionService.GenerateID();
         var result = svc.Add(model);
         this.AddNotification("Your Data Has Been Successfully Saved. ", NotificationType.SUCCESS);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         general.AddLogError("Function Add", ex.Message, ex.StackTrace);
         this.AddNotification("ID exist", NotificationType.ERROR);
         return(View("~/Views/Master/Function/Add.cshtml"));
     }
 }
Exemplo n.º 7
0
        public ActionResult Add(Master_Menu model)
        {
            try
            {
                // TODO: Add insert logic here

                IModulService objIMS = new ModulService();
                var           result = objIMS.Add(model);
                this.AddNotification("Your Data Has Been Successfully Saved. ", NotificationType.SUCCESS);
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                general.AddLogError("Modul Add", ex.Message, ex.StackTrace);
                this.AddNotification("ID exist", NotificationType.ERROR);
                return(View("~/Views/Master/Modul/Add.cshtml"));
            }
        }
        public ActionResult Download(Master_Menu model)
        {
            try
            {
                XLWorkbook xlWorkBook  = new XLWorkbook();
                var        xlWorkSheet = xlWorkBook.Worksheets.Add("Master Function");// xlWorkSheet;

                xlWorkSheet.Cell(1, 1).Value = "MenuId";
                xlWorkSheet.Cell(1, 2).Value = "ParentId";
                xlWorkSheet.Cell(1, 3).Value = "MenuName";
                xlWorkSheet.Cell(1, 4).Value = "Text";
                xlWorkSheet.Cell(1, 5).Value = "Form";
                xlWorkSheet.Cell(1, 6).Value = "Order";

                IFunctionService svc = new FunctionService();
                var Data             = svc.GetAll();
                int Row = 2;
                if (Data.Count > 0)
                {
                    for (int i = 0; i < Data.Count; i++)
                    {
                        xlWorkSheet.Cell(Row + i, 1).Value = Data[i].MenuID;
                        xlWorkSheet.Cell(Row + i, 2).Value = Data[i].ParentID;
                        xlWorkSheet.Cell(Row + i, 3).Value = Data[i].MenuName;
                        xlWorkSheet.Cell(Row + i, 4).Value = Data[i].Text;
                        xlWorkSheet.Cell(Row + i, 5).Value = Data[i].Url;
                        xlWorkSheet.Cell(Row + i, 6).Value = Data[i].OrderNumber;
                    }
                    xlWorkSheet.Columns().AdjustToContents();
                    var path = Server.MapPath("..") + "\\Master-Function.xlsx";
                    xlWorkBook.SaveAs(path);
                    xlWorkBook.Dispose();
                    return(File(path, "application/vnd.ms-excel", "Master-Function.xlsx"));
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                general.AddLogError("Function Download", ex.Message, ex.StackTrace);
                return(View("~/Views/Master/Function/Index.cshtml"));
            }
        }