Exemplo n.º 1
0
        protected override void ShowData(int menuid)
        {
            oDetailButtonPanel.SetId = SetId;
            var data = new MenuDataModel();

            data.MenuId = menuid;
            var items = MenuDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                lblMenuId.Text           = item.MenuId.ToString();
                lblName.Text             = item.Name;
                lblDescription.Text      = item.Description;
                lblSortOrder.Text        = item.SortOrder.ToString();
                lblParentMenuId.Text     = item.ParentMenuId.ToString();
                lblPrimaryDeveloper.Text = item.PrimaryDeveloper;
                lblIsVisible.Text        = item.IsVisible.ToString();
                lblIsChecked.Text        = item.IsChecked.ToString();
                lblNavigateURL.Text      = item.NavigateURL;

                oUpdateInfo.LoadText(item.UpdatedDate, item.UpdatedBy, item.LastAction);

                oHistoryList.Setup(PrimaryEntity, menuid, "Menu");
            }
            else
            {
                Clear();
            }
        }
Exemplo n.º 2
0
        public static MenuDataModel GetAsModel()
        {
            string        fileText    = GetAsText().ToString();
            MenuDataModel loadedModel = Newtonsoft.Json.JsonConvert.DeserializeObject <MenuDataModel>(fileText);

            return(loadedModel);
        }
Exemplo n.º 3
0
        public void GenerateSearchList()
        {
            var strEntityName = Request.QueryString["SN"].ToString();
            var data          = new MenuDataModel();

            data.Name = strEntityName;
            var i = 0;

            lblResult.Text = "";
            var searchList = Framework.Components.Core.MenuDataManager.Search(data, SessionVariables.RequestProfile);

            plcSearchList.Controls.Clear();

            if (searchList.Rows.Count > 0)
            {
                foreach (DataRow dr in searchList.Rows)
                {
                    var menuText = Convert.ToString(dr[StandardDataModel.StandardDataColumns.Name]);

                    var menuItem = new MenuItem(menuText);
                    menuItem.Value       = Convert.ToString(dr[MenuDataModel.DataColumns.MenuId]);
                    menuItem.NavigateUrl = Convert.ToString(dr[MenuDataModel.DataColumns.NavigateURL]);

                    if (searchList.Rows.Count == 1)
                    {
                        Response.Redirect(menuItem.NavigateUrl);
                        break;
                    }

                    if (searchList.Rows.Count == 2 && Convert.ToString(menuItem.NavigateUrl) != "#")
                    {
                        Response.Redirect(menuItem.NavigateUrl);
                        break;
                    }

                    if (Convert.ToString(menuItem.NavigateUrl) != "#")
                    {
                        var lnk1 = new LinkButton();
                        lnk1.ID = "Link" + i;
                        lnk1.Style.Add("text-decoration", "none");
                        lnk1.Style.Add("font-weight", "normal");
                        lnk1.PostBackUrl = menuItem.NavigateUrl;
                        lnk1.Text        = i + 1 + ". " + menuItem.Text.ToString() + "<br/>";
                        lnk1.Style.Add("display", "block");
                        lnk1.Style.Add("line-height", "1.35em");
                        lnk1.Style.Add("padding", "4px 20px");
                        lnk1.Style.Add("white-space", "nowrap");
                        lnk1.Style.Add("font-size", "9");
                        lnk1.Style.Add("font-family", "Helvetica, Verdana, sans-serif");

                        i++;
                        plcSearchList.Controls.Add(lnk1);
                    }
                }
            }
            else
            {
                lblResult.Text = "0 records";
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 確認是否已實作網站
        /// </summary>
        /// <param name="muID"></param>
        /// <returns></returns>
        private bool CheckIsMadeSite(string muID)
        {
            string        msg             = string.Empty;
            MenuDataModel menu            = this.GetMenuByID(muID);
            string        controllerName  = menu.MenuPathController;
            string        actionName      = menu.MenuPathAction;
            var           controllerNames = PublicStaticMethod.GetControllerNames();
            bool          hasController   = controllerNames.Any(a => a.Key == controllerName);
            bool          hasAction       = hasController ? controllerNames[controllerName].Any(a => a == actionName) : false;

            if (muID.Length == 1)
            {
                if (!hasController)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            if (!hasController || !hasAction)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 5
0
        public static int Create(MenuDataModel data, RequestProfile requestProfile)
        {
            var sql    = Save(data, requestProfile, "Create");
            var menuId = DBDML.RunScalarSQL("Menu.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(menuId));
        }
        public async Task <IActionResult> MenuData_Search([Bind("idMenu,Action,Controller,NamaMenu,Img,Platform,Status")] MenuData data)
        {
            var model = new MenuDataModel();
            var r     = new ErrorViewModel();

            if (ModelState.IsValid)
            {
                try
                {
                    model.ListData = await f.MenuData_GetSearch(data);

                    return(await Task.Run(() => Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "MenuData_Table", model) })));
                }
                catch (Exception ex)
                {
                    r.MessageContent = ex.ToString();
                    r.MessageTitle   = "Error ";
                    r.RequestId      = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
                    model.Error      = r;
                    model.ListData   = await f.MenuData_Get();

                    return(await Task.Run(() => Json(new { isValid = false, message = r.MessageContent, title = r.MessageTitle, html = Helper.RenderRazorViewToString(this, "MenuData_Table", data) })));
                }
            }
            else
            {
                r.MessageContent = "State Model tidak valid";
                r.MessageTitle   = "Error ";
                r.RequestId      = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
                model.Error      = r;
                model.ListData   = await f.MenuData_Get();

                return(await Task.Run(() => Json(new { isValid = false, message = r.MessageContent, title = r.MessageTitle, html = Helper.RenderRazorViewToString(this, "MenuData_Table", model) })));
            }
        }
Exemplo n.º 7
0
        public ActionResult MenuAdd(MenuDataModel model)
        {
            Exception     error  = null;
            MenuDataModel result = new MenuDataModel();

            try
            {
                result = this.Repository.MenuSave(model, Enums.DataSaveMode.Add);
                if (result == null)
                {
                    throw new Exception("新增目錄失敗");
                }
            }
            catch (Exception ex)
            {
                error = ex;
            }

            if (error != null)
            {
                ViewBag.AddFail = error.Message;
                return(View(model));
            }
            else
            {
                ViewBag.AddFail = "success";
            }

            return(RedirectToAction("MenuEdit", new { muID = result.MenuID }));
        }
Exemplo n.º 8
0
        private static string Save(MenuDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

            switch (action)
            {
            case "Create":
                sql += "dbo.MenuInsert  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);                         // +
                //", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
                break;

            case "Update":
                sql += "dbo.MenuUpdate  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
                break;

            default:
                break;
            }

            sql = sql + ", " + ToSQLParameter(data, MenuDataModel.DataColumns.MenuId) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.Value) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.IsVisible) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.IsChecked) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.ParentMenuId) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.ApplicationId) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.PrimaryDeveloper) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.NavigateURL);
            return(sql);
        }
Exemplo n.º 9
0
        private string GetParentMenuUrl(MenuDataModel objMenu)
        {
            var menuText = objMenu.MenuDisplayName;

            if (SessionVariables.IsTesting && !string.IsNullOrEmpty(objMenu.PrimaryDeveloper))
            {
                menuText += " (" + objMenu.PrimaryDeveloper + ")";
            }

            var menuItem = new MenuItem(menuText);

            menuItem.Value       = Convert.ToString(objMenu.MenuId);
            menuItem.NavigateUrl = objMenu.NavigateURL;

            MenuHelper.GenerateChildMenus(menuItem);

            var tempNavURL    = string.Empty;
            var parentMenuUrl = string.Empty;

            if (menuItem.ChildItems.Count >= 1)
            {
                if (Convert.ToString(menuItem.NavigateUrl) == "#")
                {
                    tempNavURL           = Convert.ToString(menuItem.ChildItems[0].NavigateUrl);
                    menuItem.NavigateUrl = tempNavURL.Remove(0, 2);
                    parentMenuUrl        = menuItem.NavigateUrl;
                }
            }

            return(parentMenuUrl);
        }
Exemplo n.º 10
0
        public static void Create(MenuDataModel menu)
        {
            MySqlConnection  connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]);
            MySqlDataAdapter adapter    = new MySqlDataAdapter("Core_CreateMenu", connection);

            adapter.SelectCommand.CommandType = CommandType.StoredProcedure;


            MySqlParameter paramID = new MySqlParameter("pID", menu.ID);

            paramID.Direction = ParameterDirection.Input;
            adapter.SelectCommand.Parameters.Add(paramID);
            MySqlParameter paramName = new MySqlParameter("pName", menu.Name);

            paramName.Direction = ParameterDirection.Input;
            adapter.SelectCommand.Parameters.Add(paramName);
            MySqlParameter paramURL = new MySqlParameter("pURL", menu.URL);

            paramURL.Direction = ParameterDirection.Input;
            adapter.SelectCommand.Parameters.Add(paramURL);
            MySqlParameter paramMenuOrder = new MySqlParameter("pMenuOrder", menu.MenuOrder);

            paramMenuOrder.Direction = ParameterDirection.Input;
            adapter.SelectCommand.Parameters.Add(paramMenuOrder);
            MySqlParameter paramMenuID = new MySqlParameter("pMenuID", menu.MenuID);

            paramMenuID.Direction = ParameterDirection.Input;
            adapter.SelectCommand.Parameters.Add(paramMenuID);

            DataTable results = new DataTable();

            adapter.Fill(results);
        }
Exemplo n.º 11
0
        public static List <MenuDataModel> GetEntityDetails(MenuDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.MenuSearch ";

            var parameters =
                new
            {
                AuditId            = requestProfile.AuditId
                , ApplicationId    = dataQuery.ApplicationId
                , MenuId           = dataQuery.MenuId
                , Name             = dataQuery.Name
                , ApplicationMode  = requestProfile.ApplicationModeId
                , Value            = dataQuery.Value
                , PrimaryDeveloper = dataQuery.PrimaryDeveloper
                , ParentMenuId     = dataQuery.ParentMenuId
                , IsVisible        = dataQuery.IsVisible
                , IsChecked        = dataQuery.IsChecked
                , ReturnAuditInfo  = returnAuditInfo
            };

            List <MenuDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <MenuDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }

            return(result);
        }
Exemplo n.º 12
0
        public static MenuDataModel Get(int id)
        {
            MenuDataModel menu = null;

            MySqlConnection  connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]);
            MySqlDataAdapter adapter    = new MySqlDataAdapter("GetMenuByID", connection);
            MySqlParameter   paramID    = new MySqlParameter("pId", id);

            paramID.Direction = ParameterDirection.Input;
            adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            adapter.SelectCommand.Parameters.Add(paramID);

            DataTable results = new DataTable();

            adapter.Fill(results);

            if (results.Rows.Count > 0)
            {
                DataRow item = results.Rows[0];
                menu = new MenuDataModel();

                menu.ID    = Convert.ToInt32(item["ID"]);
                menu.Name  = Convert.ToString(item["Name"]);
                menu.URL   = Convert.ToString(item["URL"]);
                menu.Order = Convert.ToInt32(item["Order"]);
            }

            return(menu);
        }
Exemplo n.º 13
0
        private static void CreateChildMenuRecords(int newParentMenuId, string newApplicationModule,
                                                   List <MenuDataModel> childMenuRecords, List <MenuDataModel> dataSourceMenu, List <MenuDisplayNameDataModel> menuDisplayNameList,
                                                   int languageId, RequestProfile newRequestProfile)
        {
            if (childMenuRecords.Count > 0)
            {
                var sortOrderSeed = 1;
                foreach (MenuDataModel menuSourceRecord in childMenuRecords)
                {
                    var menuModel = new MenuDataModel();

                    menuModel.Name             = menuSourceRecord.Name;
                    menuModel.Value            = menuSourceRecord.Value;
                    menuModel.Description      = menuSourceRecord.Description;
                    menuModel.IsVisible        = menuSourceRecord.IsVisible;
                    menuModel.IsChecked        = menuSourceRecord.IsChecked;
                    menuModel.PrimaryDeveloper = menuSourceRecord.PrimaryDeveloper;
                    menuModel.NavigateURL      = menuSourceRecord.NavigateURL;

                    menuModel.ParentMenuId      = newParentMenuId;
                    menuModel.ApplicationId     = newRequestProfile.ApplicationId;
                    menuModel.ApplicationModule = newApplicationModule;
                    menuModel.SortOrder         = sortOrderSeed;

                    if (!DoesExist(menuModel, newRequestProfile))
                    {
                        var newMenuId = MenuDataManager.Create(menuModel, newRequestProfile);

                        var menuDisplayNameValue = menuModel.Value;

                        try
                        {
                            menuDisplayNameValue = menuDisplayNameList.Find(x => x.MenuId == menuSourceRecord.MenuId && x.IsDefault == 1).Value;
                        }
                        catch { }

                        var dataDisplayName = new MenuDisplayNameDataModel();
                        dataDisplayName.MenuId     = newMenuId;
                        dataDisplayName.Value      = menuDisplayNameValue;
                        dataDisplayName.LanguageId = languageId;
                        dataDisplayName.IsDefault  = 1;

                        // create display name entry according to the default display name
                        MenuDisplayNameDataManager.Create(dataDisplayName, newRequestProfile);

                        sortOrderSeed++;

                        var childMenuRecordsList = dataSourceMenu
                                                   .Where(t => t.ParentMenuId == menuSourceRecord.MenuId)
                                                   .Select(t => t)
                                                   .OrderBy(t => t.SortOrder).ToList();

                        CreateChildMenuRecords(newMenuId, newApplicationModule,
                                               childMenuRecordsList, dataSourceMenu, menuDisplayNameList,
                                               languageId, newRequestProfile);
                    }
                }
            }
        }
Exemplo n.º 14
0
        public static DataTable Search(MenuDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            var table = list.ToDataTable();

            return(table);
        }
Exemplo n.º 15
0
        public IEnumerable <MenuDataModel> GetUserPreferenceMenu()
        {
            var data = new MenuDataModel();

            var listUPMenu = SessionVariables.UserPreferedMenuData;

            return(listUPMenu);
        }
Exemplo n.º 16
0
        private System.Data.DataTable GetData()
        {
            // TODO: on all export pages
            var data = new MenuDataModel();

            var dt = Framework.Components.Core.MenuDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Exemplo n.º 17
0
        public override void Create(MenuDataModel menu)
        {
            if (HttpContext.Current.Session["ParentID"] != null)
            {
                menu.MenuID = Convert.ToInt32(HttpContext.Current.Session["ParentID"]);
            }

            base.Create(menu);
        }
Exemplo n.º 18
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var data = new MenuDataModel();

            data.MenuId = entityKey;
            var results = Framework.Components.Core.MenuDataManager.Search(data, SessionVariables.RequestProfile);

            return(results);
        }
Exemplo n.º 19
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new MenuDataModel();

            UpdatedData = Framework.Components.Core.MenuDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.MenuId = Convert.ToInt32(SelectedData.Rows[i][MenuDataModel.DataColumns.MenuId].ToString());

                data.Name         = Convert.ToString(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name]);
                data.ParentMenuId = Convert.ToInt32(SelectedData.Rows[i][MenuDataModel.DataColumns.ParentMenuId]);
                data.NavigateURL  = Convert.ToString(SelectedData.Rows[i][MenuDataModel.DataColumns.NavigateURL]);
                data.Value        = Convert.ToString(SelectedData.Rows[i][MenuDataModel.DataColumns.Value]);

                data.IsChecked =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(MenuDataModel.DataColumns.IsChecked))
                    ? Convert.ToInt32(CheckAndGetRepeaterTextBoxValue(MenuDataModel.DataColumns.IsChecked))
                    : Convert.ToInt32(SelectedData.Rows[i][MenuDataModel.DataColumns.IsChecked]);

                data.IsVisible =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(MenuDataModel.DataColumns.IsVisible))
                    ? Convert.ToInt32(CheckAndGetRepeaterTextBoxValue(MenuDataModel.DataColumns.IsVisible))
                    : Convert.ToInt32(SelectedData.Rows[i][MenuDataModel.DataColumns.IsVisible]);

                data.Description =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description))
                    ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)
                    : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString();

                data.PrimaryDeveloper =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(MenuDataModel.DataColumns.PrimaryDeveloper))
                    ? CheckAndGetRepeaterTextBoxValue(MenuDataModel.DataColumns.PrimaryDeveloper)
                    : SelectedData.Rows[i][MenuDataModel.DataColumns.PrimaryDeveloper].ToString();

                data.SortOrder =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder))
                    ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString())
                    : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

                if (string.IsNullOrEmpty(data.PrimaryDeveloper))
                {
                    data.PrimaryDeveloper = " ";
                }

                Framework.Components.Core.MenuDataManager.Update(data, SessionVariables.RequestProfile);
                data        = new MenuDataModel();
                data.MenuId = Convert.ToInt32(SelectedData.Rows[i][MenuDataModel.DataColumns.MenuId].ToString());
                var dt = Framework.Components.Core.MenuDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Exemplo n.º 20
0
        public static List <MenuDataModel> GetList(int?applicationId, RequestProfile requestProfile)
        {
            var data = new MenuDataModel()
            {
                ApplicationId = applicationId
            };

            return(GetEntityDetails(data, requestProfile, 0));
        }
Exemplo n.º 21
0
        public static DataTable DoesExist(MenuDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new MenuDataModel();

            doesExistRequest.Name          = data.Name;
            doesExistRequest.ParentMenuId  = data.ParentMenuId;
            doesExistRequest.ApplicationId = requestProfile.ApplicationId;
            return(Search(doesExistRequest, requestProfile));
        }
Exemplo n.º 22
0
        public void LoadData(int menuId, bool showId)
        {
            // clear UI
            Clear();

            // set up parameters
            var data = new MenuDataModel();

            data.MenuId = menuId;

            // get data
            var items = MenuDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            // should only have single match -- should log exception.
            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            txtDescription.Value      = item.Description;
            txtName.Text              = item.Name;
            txtSortOrder.Text         = item.SortOrder.ToString();
            txtDisplayName.Text       = item.MenuDisplayName;
            txtNavigateURL.Text       = item.NavigateURL;
            txtParentMenuId.Text      = item.ParentMenuId.ToString();
            txtApplicationId.Text     = item.ApplicationId.ToString();
            txtPrimaryDeveloper.Text  = item.PrimaryDeveloper;
            txtSortOrder.Text         = item.SortOrder.ToString();
            txtApplicationModule.Text = item.ApplicationModule;

            if (item.ParentMenuId != null)
            {
                var parentMenu = new MenuDataModel();
                parentMenu.ParentMenuId     = item.ParentMenuId;
                parentMenu.Name             = item.Name;
                parentMenu.PrimaryDeveloper = item.PrimaryDeveloper;
                var parentMenudata = MenuDataManager.GetDetails(parentMenu, SessionVariables.RequestProfile);
                drpParentMenu.SelectedItem.Value = parentMenudata.ToString();
            }

            if (!showId)
            {
                txtMenuId.Text = item.MenuId.ToString();
                //PlaceHolderAuditHistory.Visible = true;
                // only show Audit History in case of Update page, not for Clone.
                oHistoryList.Setup(PrimaryEntity, menuId, PrimaryEntityKey);
            }
            else
            {
                txtMenuId.Text = String.Empty;
            }

            oUpdateInfo.LoadText(item.UpdatedDate, item.UpdatedBy, item.LastAction);
        }
Exemplo n.º 23
0
        public ActionResult MenuEdit(string muID)
        {
            if (string.IsNullOrEmpty(muID))
            {
                throw new Exception("查無該目錄");
            }
            MenuDataModel result = this.Repository.GetMenuByID(muID);

            return(View(result));
        }
Exemplo n.º 24
0
        public static DataTable ListOfParentMenuOnly(MenuDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.MenuListOfParentMenuOnly " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);

            var oDT = new DBDataTable("Menu.Search", sql, DataStoreKey);

            return(oDT.DBTable);
        }
Exemplo n.º 25
0
        public static void UpdateParentMenuOnly(MenuDataModel data, int auditId)
        {
            var sql = String.Empty;

            sql = "dbo.MenuUpdateParentMenuOnly  " +
                  " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, auditId) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.MenuId) +
                  ", " + ToSQLParameter(data, MenuDataModel.DataColumns.ParentMenuId);

            DBDML.RunSQL("Menu.Update", sql, DataStoreKey);
        }
Exemplo n.º 26
0
 public virtual void Update(MenuDataModel menu)
 {
     if (menu.ID > 0)
     {
         MenuDAL.Update(menu);
     }
     else
     {
         throw new Exception("Page not found");
     }
 }
Exemplo n.º 27
0
        protected override void Update(Dictionary <string, string> values)
        {
            // set data
            var data = new MenuDataModel();

            // copies properties from values dictionary object to Menu data object
            PropertyMapper.CopyProperties(data, values);

            // save datga
            MenuDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Exemplo n.º 28
0
        public void CreateAMenuItemTest()
        {
            List <string> ingredients = new List <string>();

            ingredients.Add("tofu");
            ingredients.Add("rice");
            ingredients.Add("egg");
            MenuDataModel controlData = new MenuDataModel(5, "tofu", "tofu and rice", ingredients, decimal.Parse("4.99"));

            repoWindow.CreateAMenuItem(controlData);

            Assert.AreEqual(1, repoWindow.FullListOfMenuItems.Count);
        }
Exemplo n.º 29
0
        public static bool DoesExist(MenuDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new MenuDataModel();

            doesExistRequest.Name              = data.Name;
            doesExistRequest.ParentMenuId      = data.ParentMenuId;
            doesExistRequest.ApplicationId     = data.ApplicationId;
            doesExistRequest.ApplicationModule = data.ApplicationModule;

            var list = GetEntityDetails(doesExistRequest, requestProfile, 0);

            return(list.Count > 0);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 儲存一筆目錄
        /// </summary>
        /// <param name="member"></param>
        public MenuDataModel MenuSave(MenuDataModel model, DataSaveMode mode)
        {
            MenuDataModel updateModel = null;
            MenuModule    menuModule  = new MenuModule();

            try
            {
                updateModel = menuModule.SaveMenuData(mode, model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(updateModel);
        }