public bool TryLoad(ModuleDescriptor descriptor, out ModuleAccess access) { //对于 Full Framework : //ModuleDescriptor.Path :(嵌入的模块配置文件)资源名称。 //ModuleDescriptor.Root :程序集文件名。 access = null; if (File.Exists(descriptor.LibraryPath)) { string resourceName = descriptor.ModuleManifest; Assembly assembly = null; try { assembly = _assemblyReader.ReadFile(descriptor.LibraryPath); access = new ModuleAccess(); access.Descriptor = descriptor; access.Assembly = assembly; access.Location = descriptor.LibraryPath; access.ExportedTypes = this.LoadTypes(descriptor.Name, assembly); return(true); } catch (BadImageFormatException) { } } return(false); }
public ActionResult UpdateModule() { ModuleService moduleService = new ModuleService(); AgreementInfoAccess agreement = new AgreementInfoAccess(); ModuleAccess module = new ModuleAccess(); var moduleName = Request.Form["ModuleName"]; var description = Request.Form["Description"]; var expiryDate = Request.Form["ExpiryDate"]; var userType = Request.Form["userType"]; var content = Request.Form["AgreementContent"]; var moduleId = Convert.ToInt32(Session["moduleId"]); string key = null; var modules = moduleService.GetModuleData(key); foreach (var item in modules) { if (item.ModuleId == moduleId) { module = item; } } agreement = moduleService.ShowAgreement(moduleId); module.Description = description; string oleExpiryDate = module.ExpiryDate.ToShortDateString(); DateTime newExpiryDate = Convert.ToDateTime(expiryDate); if (expiryDate != oleExpiryDate) { if (newExpiryDate.Year > DateTime.Now.Year) { module.ExpiryDate = Convert.ToDateTime(expiryDate); } else if (newExpiryDate.Year == DateTime.Now.Year && newExpiryDate.Month > DateTime.Now.Month) { module.ExpiryDate = Convert.ToDateTime(expiryDate); } else if (newExpiryDate.Year == DateTime.Now.Year && newExpiryDate.Month == DateTime.Now.Month && newExpiryDate.Day > DateTime.Now.Day) { module.ExpiryDate = Convert.ToDateTime(expiryDate); } else { TempData["message"] = "Update failed with Module No." + module.ModuleId + ", Error: Expiry date should be later than today'date."; return(RedirectToAction("Index")); } } agreement.UserType = userType; agreement.Content = content; moduleService.UpdateModule(module, agreement); //if (moduleService.UpdateModule(module, agreement)) //{ // return RedirectToAction("Index"); //} return(RedirectToAction("Index")); }
bool IModuleAccessForm.ShowDialog(ModuleAccess ma, Dictionary <string, List <string> > ListKey, ref bool AllDocumentData) { labelControl2.Text = ma.ModuleName; this.ma = ma; checkEdit5.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentView, false); return(ShowDialog(BaseWinFramework.MdiParent) == DialogResult.OK); }
public clsModule(string ModuleName, TreeListNode Node) { ModuleAccess GlobalMa = BaseSecurity.GetModuleAccess(ModuleName); Ma = new ModuleAccess(ModuleName, GlobalMa.FolderName, GlobalMa.FormSettingType); Ma.ListDataField = GlobalMa.ListDataField; this.Node = Node; }
/// <summary> /// Method to add/Update the Entity in the database. /// </summary> /// <param name="moduleAccess"></param> /// <returns></returns> public int DeleteEntry(ModuleAccess moduleAccess) { using (var moduleAccessRep = UnitOfWork.ModuleAccessRepository) { if (moduleAccess.ModuleAccessID > 0) { moduleAccessRep.UpdateEntity(moduleAccess, moduleAccess.ModuleAccessID); } else { moduleAccessRep.Create(moduleAccess); } return(moduleAccess.ModuleAccessID); } }
public clsModule(string ModuleName, TreeListNode Node) { ModuleAccess GlobalMa = BaseSecurity.GetModuleAccess(ModuleName); Ma = new ModuleAccess(ModuleName, GlobalMa.FolderName, GlobalMa.FormSettingType ?? typeof(frmSecurityDocument)); Ma.ListDataField = GlobalMa.ListDataField; foreach (ModuleDataField mdf in Ma.ListDataField) { ListKey.Add(mdf.DataFieldName, new List <string>()); } this.Node = Node; }
public bool TryLoad(ModuleDescriptor descriptor, out ModuleAccess access) { access = null; Assembly assembly = null; string libraryPath = descriptor.LibraryPath; if (File.Exists(libraryPath)) { try { assembly = _assemblyReader.ReadFile(libraryPath); } catch (BadImageFormatException) { this._logger.WriteWarning($"{libraryPath} 不是有效的程序集文件。"); } } else { try { assembly = _assemblyReader.ReadByName(descriptor.LibraryPath); } catch (Exception ex) { ex.ThrowIfNecessary(); } } if (assembly != null) { access = new ModuleAccess(); access.Descriptor = descriptor; access.Assembly = assembly; access.Location = descriptor.LibraryPath; access.ExportedTypes = this.LoadTypes(descriptor.ModuleManifest, assembly, descriptor.RootNamespce.IfNullOrWhiteSpace(assembly.GetName().Name)); return(true); } return(false); }
bool IModuleAccessForm.ShowDialog(ModuleAccess ma, Dictionary <string, List <string> > ListKey, ref bool AllDocumentData) { labelControl2.Text = string.Concat(ma.FolderName, "\\", ma.ModuleName); this.ma = ma; _OnLoad = true; checkEdit3.Checked = AllDocumentData; checkEdit1.Checked = ma.GetVariable <bool>( SecurityVarName.ReportView, false); checkEdit12.Checked = ma.GetVariable <bool>( SecurityVarName.ReportPrint, false); checkEdit11.Checked = ma.GetVariable <bool>( SecurityVarName.ReportDesignPrint, false); checkEdit10.Checked = ma.GetVariable <bool>( SecurityVarName.ReportSave, false); checkEdit4.Checked = ma.GetVariable <bool>( SecurityVarName.ReportLayoutSave, false); _OnLoad = false; return(ShowDialog(BaseWinFramework.MdiParent) == DialogResult.OK); }
public ActionResult CreateModule() { var moduleName = Request.Form["ModuleName"]; var description = Request.Form["Description"]; var expiryDate = Request.Form["ExpiryDate"]; var userType = Request.Form["userType"]; var content = Request.Form["AgreementContent"]; ModuleService moduleService = new ModuleService(); ModuleAccess module = new ModuleAccess(); AgreementInfoAccess agreement = new AgreementInfoAccess(); module.ModuleName = moduleName; module.Description = description; if (expiryDate != "") { module.ExpiryDate = Convert.ToDateTime(expiryDate); } else { module.ExpiryDate = DateTime.Now; } if (userType == "") { agreement.UserType = "RegularUser"; } else { agreement.UserType = userType; } agreement.Content = content; if (moduleService.AddModule(module, agreement)) { TempData["message"] = "Module has been created"; return(RedirectToAction("Index")); } TempData["message"] = "Module can not be created, Please check your input again."; return(View("Create")); }
//Create a new module. public ActionResult Create() { ModuleAccess module = new ModuleAccess(); AgreementInfoAccess agreement = new AgreementInfoAccess(); SelectListItem administrator = new SelectListItem() { Text = "Administrator", Value = "Administrator" }; SelectListItem manager = new SelectListItem() { Text = "Manager", Value = "Manager" }; SelectListItem regular = new SelectListItem() { Text = "RegularUser", Value = "RegularUser" }; ViewBag.userType = new SelectList(new SelectListItem[] { administrator, manager, regular }, "Value", "Text", "RegularUser"); return(View()); }
//Update module's information. public ActionResult Update(int id = 0, string key = null) { ModuleService moduleService = new ModuleService(); AgreementInfoAccess agreement = new AgreementInfoAccess(); ModuleAccess module = new ModuleAccess(); SelectListItem administrator = new SelectListItem() { Text = "Administrator", Value = "Administrator" }; SelectListItem manager = new SelectListItem() { Text = "Manager", Value = "Manager" }; SelectListItem regular = new SelectListItem() { Text = "RegularUser", Value = "RegularUser" }; if (id != 0) { var modules = moduleService.GetModuleData(key); foreach (var item in modules) { if (item.ModuleId == id) { module = item; } } var agree = moduleService.ShowAgreement(id); ViewBag.agreement = agree; ViewBag.module = module; ViewBag.userType = new SelectList(new SelectListItem[] { administrator, manager, regular }, "Value", "Text", agree.UserType); Session.Add("moduleId", id); } return(View()); }
private void ChildClick(object sender, EventArgs e) { MainLoad mainloadcc = (MainLoad)Application.OpenForms["MainLoad"]; Panel panelcc = (Panel)mainloadcc.Controls["pnl_Mainload"]; panelcc.Controls.Clear(); if (sender.ToString() == "CourseCreation") { CourseCreation CourseCreation = new CourseCreation(); CourseCreation.TopLevel = false; CourseCreation.TopMost = true; panelcc.Controls.Add(CourseCreation); CourseCreation.Show(); } else if (sender.ToString() == "UsersCreation") { UsersCreation UsersCreation = new UsersCreation(); UsersCreation.TopLevel = false; UsersCreation.TopMost = true; panelcc.Controls.Add(UsersCreation); UsersCreation.Show(); } else if (sender.ToString() == "ChangePassword") { ChangePassword ChangePassword = new ChangePassword(); ChangePassword.TopLevel = false; ChangePassword.TopMost = true; panelcc.Controls.Add(ChangePassword); ChangePassword.Show(); } else if (sender.ToString() == "EnquiryForm") { EnquiryForm EnquiryForm = new EnquiryForm(); EnquiryForm.TopLevel = false; EnquiryForm.TopMost = true; panelcc.Controls.Add(EnquiryForm); EnquiryForm.Show(); } else if (sender.ToString() == "UserTypes") { UserTypes UserTypes = new UserTypes(); UserTypes.TopLevel = false; UserTypes.TopMost = true; panelcc.Controls.Add(UserTypes); UserTypes.Show(); } else if (sender.ToString() == "RolesCreation") { RolesCreation RolesCreation = new RolesCreation(); RolesCreation.TopLevel = false; RolesCreation.TopMost = true; panelcc.Controls.Add(RolesCreation); RolesCreation.Show(); } else if (sender.ToString() == "FeeCreation") { FeeCreation FeeCreation = new FeeCreation(); FeeCreation.TopLevel = false; FeeCreation.TopMost = true; panelcc.Controls.Add(FeeCreation); FeeCreation.Show(); } else if (sender.ToString() == "SendCampaign") { SendCampaign SendCampaign = new SendCampaign(); SendCampaign.TopLevel = false; SendCampaign.TopMost = true; panelcc.Controls.Add(SendCampaign); SendCampaign.Show(); } else if (sender.ToString() == "MailChimpDetails") { MailChimpDetails MailChimpDetails = new MailChimpDetails(); MailChimpDetails.TopLevel = false; MailChimpDetails.TopMost = true; panelcc.Controls.Add(MailChimpDetails); MailChimpDetails.Show(); } else if (sender.ToString() == "DashBoard") { DashBoard DashBoard = new DashBoard(); DashBoard.TopLevel = false; DashBoard.TopMost = true; panelcc.Controls.Add(DashBoard); DashBoard.Show(); } else if (sender.ToString() == "Transactions") { Transactions Transactions = new Transactions(); Transactions.TopLevel = false; Transactions.TopMost = true; panelcc.Controls.Add(Transactions); Transactions.Show(); } else if (sender.ToString() == "EmployeeCreation") { EmployeeCreation EmployeeCreation = new EmployeeCreation(); EmployeeCreation.TopLevel = false; EmployeeCreation.TopMost = true; panelcc.Controls.Add(EmployeeCreation); EmployeeCreation.Show(); } else if (sender.ToString() == "ModuleAccess") { ModuleAccess ModuleAccess = new ModuleAccess(); ModuleAccess.TopLevel = false; ModuleAccess.TopMost = true; panelcc.Controls.Add(ModuleAccess); ModuleAccess.Show(); } }
public void ShowForm2(EntityForm EntityForm, string ReportName, string FreeFilter, object TransStartDate, object TransEndDate, object[] Parameters) { _ReportName = ReportName; _EntityForm = EntityForm; if (EntityForm.ModuleName.Length > 0 && BaseSecurity.CurrentLogin .CurrentRole.Length > 0) { ModuleAccess ma = BaseSecurity.GetModuleAccess(EntityForm.ModuleName); if (!ma.GetVariable <bool>(SecurityVarName.ReportDesignPrint, false)) { comboBoxEdit1.Properties.Buttons[2].Enabled = false; } } _Evaluator = BaseFactory.CreateInstance <Evaluator>(); if (_ReportName.Contains("Laporan")) { Text = _ReportName; } else { Text = "Laporan " + _ReportName; } _FilterForm = BaseFactory.CreateInstance( _EntityForm.FilterFormType) as IFilterForm; if (_FilterForm == null) { XtraMessageBox.Show("Form Filter harus implement Interface IFilterForm !", "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } _ShowViewForm = _FilterForm as IShowView; if (_ShowViewForm == null) { XtraMessageBox.Show("Form Filter harus implement Interface IShowView !", "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } if (_EntityForm.FilterFormType == null || _FilterForm as ReportEntity != null) { splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2; } else { XtraForm Frm = _FilterForm as XtraForm; if (Frm != null) { InitFilterForm(Frm, xtraScrollableControl1, splitContainerControl1); } else { QueryReportEntity(xtraScrollableControl1, splitContainerControl1); } } List <string> ListItems = DocPrintBrowseLayout .GetListLayout("F_" + _ReportName); if (ListItems.Count == 0) { if (re != null) { Dictionary <string, object> Vars = new Dictionary <string, object>(); re.GetVariables(Vars); SaveReportFromTemplateFolder("F_", ReportName, ListItems, Vars); } else { SaveReportFromTemplateFolder("F_", ReportName, ListItems, _FilterForm != null ? _FilterForm.FilterList : null); } } comboBoxEdit1.Properties.Items.AddRange(ListItems); string CurrBrowseLayoutId = string.Empty; bool Tmp; DocDefault.GetDefaultLayout(_ReportName, out CurrBrowseLayoutId, out CurrPrintLayoutId, out Tmp); if (re != null) { ((IShowView)re).ShowView(Parameters); } else if (_ShowViewForm != null) { _ShowViewForm.ShowView(Parameters); } comboBoxEdit1.SelectedItem = CurrBrowseLayoutId; if (comboBoxEdit1.SelectedIndex < 0 && comboBoxEdit1.Properties.Items.Count > 0) { comboBoxEdit1.SelectedIndex = 0; } else { comboBoxEdit1_SelectedIndexChanged(null, null); } sbTotal.Caption = "Total Halaman: " + printControl1.PrintingSystem.Pages.Count; ribbonStatusBar1.Refresh(); printControl1.PrintingSystem.AfterChange += new DevExpress.XtraPrinting.ChangeEventHandler(PrintingSystem_AfterChange); Show(); printControl1.Focus(); }
public AccessControl VerifyUserHasAccessToGroupCode(AccessControl accessControls, Scope scope) { AccessControl control = new AccessControl(); if (accessControls.CustomerKeyAccess != null) { foreach (var key in accessControls.CustomerKeyAccess) { var hasAccess = HasClientAccess(GetClientId(), key.Key, scope); if (hasAccess) { var ck = new CustomerKeyAccess { Key = key.Key, HasAccess = true }; control.CustomerKeyAccess.Add(ck); } else { var ck = new CustomerKeyAccess { Key = key.Key, HasAccess = false }; control.CustomerKeyAccess.Add(ck); } } } if (accessControls.ModuleAccess != null) { foreach (var key in accessControls.ModuleAccess) { var hasAccess = HasClientAccess(GetClientId(), key.Key, scope); if (hasAccess) { var ck = new ModuleAccess() { Key = key.Key, HasAccess = true }; control.ModuleAccess.Add(ck); } else { var ck = new ModuleAccess { Key = key.Key, HasAccess = false }; control.ModuleAccess.Add(ck); } } } return(control); }
bool IModuleAccessForm.ShowDialog(ModuleAccess ma, Dictionary <string, List <string> > ListKey, ref bool AllDocumentData) { labelControl2.Text = string.Concat(ma.FolderName, "\\", ma.ModuleName); this.ma = ma; _OnLoad = true; checkEdit5.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentView, false); checkEdit6.Checked = ma.GetVariable <bool>( SecurityVarName.ReportView, false); checkEdit1.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentNew, false); checkEdit2.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentEdit, false); checkEdit3.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentDelete, false); checkEdit7.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentPrint, false); checkEdit8.Checked = ma.GetVariable <bool>( SecurityVarName.DocumentDesignPrint, false); checkEdit12.Checked = ma.GetVariable <bool>( SecurityVarName.ReportPrint, false); checkEdit11.Checked = ma.GetVariable <bool>( SecurityVarName.ReportDesignPrint, false); checkEdit10.Checked = ma.GetVariable <bool>( SecurityVarName.ReportSave, false); checkEdit4.Checked = ma.GetVariable <bool>( SecurityVarName.ReportLayoutSave, false); _OnLoad = false; this.ListKey = ListKey; if (ma.ListDataField.Count == 0) { xtraTabPage2.PageVisible = false; } else { DataPersistance dp = BaseSecurity.CurrentLogin.Dp; checkEdit14.Checked = AllDocumentData; foreach (ModuleDataField mdf in ma.ListDataField) { List <Item> ListItem = new List <Item>(); ListDataField.Add(mdf.DataFieldName, ListItem); comboBoxEdit1.Properties.Items.Add(mdf.DataFieldName); IDataReader rdr = dp.ExecuteReader(mdf.SqlQuery); while (rdr.Read()) { bool Pilih = false; string DataKey = (string)rdr[0]; foreach (string key in ListKey[mdf.DataFieldName]) { if (key == DataKey) { Pilih = true; break; } } ListItem.Add(new Item(Pilih, DataKey)); } rdr.Close(); } comboBoxEdit1.SelectedIndex = 0; } if (ShowDialog(BaseWinFramework.MdiParent) == DialogResult.OK) { AllDocumentData = this.AllDocumentData; return(true); } else { return(false); } }