public static CommonScreenFunctions GetScreenFunctionsByScreen(string screenName, List<ScreenBO> screens) { var funtions = new CommonScreenFunctions(); var selectedScreenFunction = from selectedrows in screens where selectedrows.ScreenName.ToUpper() == screenName.ToUpper() select selectedrows; ScreenBO[] selectedFunctions = selectedScreenFunction.ToArray<ScreenBO>(); if (selectedFunctions.Length > 0) { foreach (ScreenFunctionsBO screenFun in selectedFunctions[0].ScreenFunctions) { if (screenFun.ScreenFunctionCode.Replace("UPDATE", " ").Trim().ToUpper().Equals(screenName.ToUpper())) { if (!screenFun.IsGranted) { funtions.Update = false; } else { funtions.Update = true; } } else if (screenFun.ScreenFunctionCode.Replace("DELETE", " ").Trim().ToUpper().Equals(screenName.ToUpper())) { if (!screenFun.IsGranted) { funtions.Delete = false; } else { funtions.Delete = true; } } else if (screenFun.ScreenFunctionCode.Replace("SAVE", " ").Trim().ToUpper().Equals(screenName.ToUpper())) { if (!screenFun.IsGranted) { funtions.Save = false; } else { funtions.Save = true; } } } } return funtions; }
private void FormItemMaster_Load(object sender, EventArgs e) { ScreenFunctions = CommonMethods.GetScreenFunctionsByScreen("MANAGEITEMS", Common.Screens); if (!ScreenFunctions.Delete) { buttonDelete.Visible = false; } if (!ScreenFunctions.Save) { buttonSave.Visible = false; } }
private void MeasurementUnits_Load(object sender, EventArgs e) { ScreenFunctions = CommonMethods.GetScreenFunctionsByScreen("MESURMENTUNITS", Common.Screens); if (!ScreenFunctions.Save) { buttonSave.Visible = false; } }