/// <summary> /// 绑定数据。 /// 作者:董帅 创建时间:2012-8-27 17:24:18 /// </summary> private void bindData() { try { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建数据库操作对象。 RoleOperater roleOper = RoleOperater.createRoleOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (roleOper != null) { List <UserRoleInfo> roles = roleOper.getChouseRoles(Convert.ToInt32(this.hidUserId.Value)); if (roles != null) { this.rolesRepeater.DataSource = roles; this.rolesRepeater.DataBind(); } else { YMessageBox.show(this, "查询出错!错误信息:[" + roleOper.errorMessage + "]"); } } } catch (Exception ex) { YMessageBox.show(this, "查询出错!错误信息:[" + ex.Message + "]"); } }
/// <summary> /// 绑定用户。 /// 作者:董帅 创建时间:2012-8-23 21:40:38 /// </summary> public void bindUserInfos() { try { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库操作对象 OrgOperater orgOper = OrgOperater.createOrgOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgOper != null) { List <UserInfo> users = orgOper.getUserByOrganizationId(Convert.ToInt32(this.hidParentId.Value)); if (users != null) { this.userList.DataSource = users; this.userList.DataBind(); } else { YMessageBox.show(this, "获取用户数据失败!错误信息[" + orgOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库操作对象失败!"); } } catch (Exception ex) { YMessageBox.show(this, "运行错误!错误信息[" + ex.Message + "]"); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!this.IsPostBack) { //获取父id string parentId = Request.QueryString["parentId"]; if (!string.IsNullOrEmpty(parentId)) { this.hidParentId.Value = parentId; } else { this.hidParentId.Value = "-1"; } //获取组织机构 this.bindOrgInfos(); //获取用户 this.bindUserInfos(); } } catch (Exception ex) { YMessageBox.show(this, "程序运行出错!错误信息[" + ex.Message + "]"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //获取用户id try { //获取用户id string userId = Request.QueryString["userId"]; if (!string.IsNullOrEmpty(userId)) { this.hidUserId.Value = userId; } else { YMessageBox.show(this, "获取用户id失败!"); return; } this.bindData(); } catch (Exception ex) { YMessageBox.showAndRedirect(this, "系统运行异常!异常信息[" + ex.Message + "]", "sys/login.aspx"); } } }
private bool ValidConvertFilePath() { if (string.IsNullOrEmpty(this.lblSavePath.Text.Trim())) { YMessageBox.ShowMsgBox(100, "请先选择要保存的路径!"); return(false); } return(true); }
// link the instance to a real YoctoAPI object internal override void linkToHardware(string hwdName) { YMessageBox hwd = YMessageBox.FindMessageBox(hwdName); // first redo base_init to update all _func pointers base_init(hwd, hwdName); // then setup Yocto-API pointers and callbacks init(hwd); }
protected void Page_Load(object sender, EventArgs e) { try { if (!this.IsPostBack) { //获取父id string parentId = Request.QueryString["parentId"]; if (!string.IsNullOrEmpty(parentId)) { this.hidParentId.Value = parentId; } else { YMessageBox.show(this, "未设置父菜单id失败!"); } //获取id string strId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(strId)) { this.hidOrgId.Value = strId; //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建操作对象 OrgOperater orgOper = OrgOperater.createOrgOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgOper != null) { //获取机构信息 OrganizationInfo org = orgOper.getOrganization(Convert.ToInt32(strId)); if (org != null) { this.txtOrgName.Value = org.name; this.txtOrgOrder.Value = org.order.ToString(); } else { YMessageBox.show(this, "获取机构信息失败!错误信息[" + orgOper.errorMessage + "]"); return; } } else { YMessageBox.show(this, "创建数据库操作对象失败!"); return; } } } } catch (Exception ex) { YMessageBox.show(this, "程序运行出错!错误信息[" + ex.Message + "]"); } }
/// <summary> /// 修改密码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void butChange_onClick(object sender, EventArgs e) { try { UserInfo user = (UserInfo)Session["UserInfo"]; if (user != null) { MD5Encrypt md5Encrypt = new MD5Encrypt(); if (user.logPassword == md5Encrypt.GetMD5(this.pswOldPsw.Value)) { user.logPassword = md5Encrypt.GetMD5(this.pswNewPsw1.Value); OrgOperater orgDB = new OrgOperater(); //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { //更新数据 OrgOperater orgOper = new OrgOperater(); orgOper.orgDataBase = orgDb; bool bRet = orgOper.changePassword(user); if (bRet) { //更新成功。 YMessageBox.showAndResponseScript(this, "修改用户密码成功!", "", "window.parent.closePopupsWindow('#popups');"); } else { //更新出错。 YMessageBox.show(this, "修改用户密码出错!错误信息[" + orgOper.errorMessage + "]"); } } } else { //原密码验证出错。 YMessageBox.show(this, "原密码验证错误!"); } } else { Exception ex = new Exception("用户登陆超时,请重新登陆!"); throw ex; } } catch (Exception ex) { YMessageBox.show(this, "修改用户密码出错!错误信息[" + ex.Message + "]"); } }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YMessageBox hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering MessageBox callback"); _func.registerValueCallback(valueChangeCallback); }
/// <summary> /// 删除数据 /// 作者:董帅 创建时间:2013-5-4 23:07:57 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void butDeleteItems_Click(object sender, EventArgs e) { try { string s = Request["chkPage"]; string[] dicIds = new string[0]; if (!string.IsNullOrEmpty(s)) { dicIds = s.Split(','); //要删除的字典id } if (dicIds.Length > 0) { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { MenuOperater menuOper = new MenuOperater(); menuOper.menuDataBase = orgDb; //删除字典项 int[] dicIntIds = new int[dicIds.Length]; for (int i = 0; i < dicIds.Length; i++) { dicIntIds[i] = Convert.ToInt32(dicIds[i]); } if (menuOper.deletePages(dicIntIds)) { this.Response.Redirect("setPage_list.aspx?menuId=" + this.hidMenuId.Value); } else { YMessageBox.show(this, "删除数据失败!错误信息[" + menuOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } else { YMessageBox.show(this, "没有选择要删除的页面!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }
/** * <summary> * Enumerates all functions of type MessageBox available on the devices * currently reachable by the library, and returns their unique hardware ID. * <para> * Each of these IDs can be provided as argument to the method * <c>YMessageBox.FindMessageBox</c> to obtain an object that can control the * corresponding device. * </para> * </summary> * <returns> * an array of strings, each string containing the unique hardwareId * of a device function currently connected. * </returns> */ public static new string[] GetSimilarFunctions() { List <string> res = new List <string>(); YMessageBox it = YMessageBox.FirstMessageBox(); while (it != null) { res.Add(it.get_hardwareId()); it = it.nextMessageBox(); } return(res.ToArray()); }
public static YMessageBoxProxy FindMessageBox(string name) { // cases to handle: // name ="" no matching unknwn // name ="" unknown exists // name != "" no matching unknown // name !="" unknown exists YMessageBox func = null; YMessageBoxProxy res = (YMessageBoxProxy)YFunctionProxy.FindSimilarUnknownFunction("YMessageBoxProxy"); if (name == "") { if (res != null) { return(res); } res = (YMessageBoxProxy)YFunctionProxy.FindSimilarKnownFunction("YMessageBoxProxy"); if (res != null) { return(res); } func = YMessageBox.FirstMessageBox(); if (func != null) { name = func.get_hardwareId(); if (func.get_userData() != null) { return((YMessageBoxProxy)func.get_userData()); } } } else { func = YMessageBox.FindMessageBox(name); if (func.get_userData() != null) { return((YMessageBoxProxy)func.get_userData()); } } if (res == null) { res = new YMessageBoxProxy(func, name); } if (func != null) { res.linkToHardware(name); if (func.isOnline()) { res.arrival(); } } return(res); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //获取用户信息。 UserInfo user = (UserInfo)Session["UserInfo"]; try { if (user != null) { this.userName.InnerText = user.name; this.logName.InnerText = user.logName; } else { YMessageBox.showAndRedirect(this, "用户登陆超时,请重新登陆!", "sys/login.aspx"); } } catch (Exception ex) { YMessageBox.showAndRedirect(this, "系统运行异常!异常信息[" + ex.Message + "]", "sys/login.aspx"); } //获取菜单 try { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { MenuOperater menuOper = new MenuOperater(); menuOper.menuDataBase = orgDb; List <MenuInfo> menus = menuOper.getMainPageMunus(user.id); this.menuGroup.DataSource = menus; this.menuGroup.DataBind(); } else { YMessageBox.show(this, "获取数据库实例失败!"); } } catch (Exception ex) { YMessageBox.showAndRedirect(this, "系统运行异常!异常信息[" + ex.Message + "]", "sys/login.aspx"); } } }
/// <summary> /// 删除数据 /// 作者:董帅 创建时间:2012-8-28 22:17:10 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void butDeleteItems_Click(object sender, EventArgs e) { try { string s = Request["chkDic"]; string[] dicIds = new string[0]; if (!string.IsNullOrEmpty(s)) { dicIds = s.Split(','); //要删除的字典id } if (dicIds.Length > 0) { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建数据库操作对象。 DataDicOperater dicOper = DataDicOperater.createDataDicOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (dicOper != null) { //删除字典项 int[] dicIntIds = new int[dicIds.Length]; for (int i = 0; i < dicIds.Length; i++) { dicIntIds[i] = Convert.ToInt32(dicIds[i]); } if (dicOper.deleteDataDictionarys(dicIntIds)) { this.Response.Redirect("dataDictionary_list.aspx?parentId=" + this.hidParentId.Value); //YMessageBox.showAndResponseScript(this, "删除数据成功!", "", "window.location.href='dataDictionary_list.aspx?parentId=" + this.hidParentId.Value + "'"); } else { YMessageBox.show(this, "删除数据失败!错误信息[" + dicOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } else { YMessageBox.show(this, "没有选择要删除的字典!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //获取父id string orgId = Request.QueryString["orgId"]; if (!string.IsNullOrEmpty(orgId)) { this.hidOrgId.Value = orgId; } else { YMessageBox.show(this, "未设置组织机构id!"); } //获取id string strId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(strId)) { this.hidUserId.Value = strId; this.txtUserLogName.Disabled = true; //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建操作对象 OrgOperater orgOper = OrgOperater.createOrgOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgOper != null) { ////获取用户信息 UserInfo user = orgOper.getUser(Convert.ToInt32(strId)); if (user != null) { this.txtUserLogName.Value = user.logName; this.txtUserName.Value = user.name; this.txtUserOrder.Value = user.order.ToString(); } else { YMessageBox.show(this, "获取机构信息失败!错误信息[" + orgOper.errorMessage + "]"); return; } } else { YMessageBox.show(this, "创建数据库操作对象失败!"); return; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //获取父id string parentId = Request.QueryString["parentId"]; if (!string.IsNullOrEmpty(parentId)) { this.hidParentId.Value = parentId; } else { this.hidParentId.Value = "-1"; } //获取id string strId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(strId)) { this.hidDicId.Value = strId; //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建操作对象 DataDicOperater dicOper = DataDicOperater.createDataDicOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (dicOper != null) { ////获取字典项信息 DataDictionaryInfo dicInfo = dicOper.getDataDictionary(Convert.ToInt32(strId)); if (dicInfo != null) { this.txtDicName.Value = dicInfo.name; this.txtDicValue.Value = dicInfo.value.ToString(); this.txtDicCode.Value = dicInfo.code; this.txtDicOrder.Value = dicInfo.order.ToString(); } else { YMessageBox.show(this, "获取字典信息失败!错误信息[" + dicOper.errorMessage + "]"); return; } } else { YMessageBox.show(this, "创建数据库操作对象失败!"); return; } } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!this.IsPostBack) { this.menuId = Request.QueryString["menuId"]; if (!string.IsNullOrEmpty(this.menuId)) { this.hidMenuId.Value = menuId; } string pageId = Request.QueryString["pageId"]; if (!string.IsNullOrEmpty(pageId)) { this.hidPageId.Value = pageId; //获取页面信息。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { MenuOperater menuOper = new MenuOperater(); menuOper.menuDataBase = orgDb; PageInfo page = menuOper.getPage(Convert.ToInt32(this.hidPageId.Value)); if (page != null) { this.txtFileDetail.Value = page.detail; this.txtFilePath.Value = page.filePath; } else { YMessageBox.show(this, "获取页面信息失败!错误信息[" + menuOper.errorMessage + "]"); return; } } else { YMessageBox.show(this, "创建数据库操作对象失败!"); return; } } } } catch (Exception ex) { YMessageBox.show(this, "程序异常," + ex.Message); } }
/// <summary> /// 删除菜单。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void butDeleteItem_Click(object sender, EventArgs e) { try { string[] ids = Request["chkItem"].Split(','); if (ids.Length > 0) { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { MenuOperater menuOper = new MenuOperater(); menuOper.menuDataBase = orgDb; //删除数据 int[] intIds = new int[ids.Length]; for (int i = 0; i < intIds.Length; i++) { intIds[i] = Convert.ToInt32(ids[i]); } if (menuOper.deleteItem(intIds)) { YMessageBox.showAndResponseScript(this, "删除数据成功!", "", "window.parent.menuButtonOnClick('系统菜单','icon-menu','sys/menu/menu_list.aspx')"); } else { YMessageBox.show(this, "删除数据失败!错误信息[" + menuOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } else { YMessageBox.show(this, "没有选择要删除的分组!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }
protected void butLogin_Click(object sender, EventArgs e) { //用户登陆 try { //校验数据 if (string.IsNullOrEmpty(this.txtUserName.Value)) { //用户名不能为空 YMessageBox.show(this, "用户名不能为空,请输入用户名后重新登录!"); return; } //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { //获取用户 OrgOperater orgOper = new OrgOperater(); orgOper.orgDataBase = orgDb; //用户密码二次加密 MD5Encrypt md5Encrypt = new MD5Encrypt(); UserInfo logUser = orgOper.getUser(this.txtUserName.Value, md5Encrypt.GetMD5(this.passUserPassword.Value)); if (logUser != null && logUser.id > 0) { //验证成功,跳转主页 FormsAuthentication.RedirectFromLoginPage(logUser.id.ToString(), false); Session.Add("UserInfo", logUser); } else { //验证失败 YMessageBox.show(this, "用户验证失败,请核对用户名和密码后重新登录!"); } } } catch (Exception ex) { YMessageBox.show(this, "用户登陆异常!异常消息[" + ex.Message + "]"); } }
/// <summary> /// 绑定组织机构。 /// 作者:董帅 创建时间:2012-8-22 13:45:41 /// </summary> public void bindOrgInfos() { try { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库操作对象 OrgOperater orgOper = OrgOperater.createOrgOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgOper != null) { //获取父机构信息 if (this.hidParentId.Value == "-1") { this.spanParentName.InnerText = "顶级机构"; this.returnButton.Disabled = true; this.hidReturnId.Value = ""; } else { OrganizationInfo org = orgOper.getOrganization(Convert.ToInt32(this.hidParentId.Value)); this.spanParentName.InnerText = org.name; this.hidReturnId.Value = org.parentId.ToString(); } //获取组织机构列表 List <OrganizationInfo> orgs = orgOper.getOrganizationByParentId(Convert.ToInt32(this.hidParentId.Value)); if (orgs != null) { this.orgList.DataSource = orgs; this.orgList.DataBind(); } else { YMessageBox.show(this, "获取组织机构数据失败!错误信息[" + orgOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库操作对象失败!"); } } catch (Exception ex) { YMessageBox.show(this, "运行错误!错误信息[" + ex.Message + "]"); } }
protected void butDeleteRoles_Click(object sender, EventArgs e) { try { string[] ids = Request["chkItem"].Split(','); if (ids.Length > 0) { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建数据库操作对象。 RoleOperater roleOper = RoleOperater.createRoleOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (roleOper != null) { //删除数据 int[] intIds = new int[ids.Length]; for (int i = 0; i < intIds.Length; i++) { intIds[i] = Convert.ToInt32(ids[i]); } if (roleOper.deleteRoles(intIds)) { this.Response.Redirect("role_list.aspx"); //YMessageBox.showAndResponseScript(this, "删除数据成功!", "", "window.parent.menuButtonOnClick('角色管理','icon-role','sys/role/role_list.aspx')"); } else { YMessageBox.show(this, "删除数据失败!请确认是否有用户设置了该角色!"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } else { YMessageBox.show(this, "没有选择要删除的角色!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }
/// <summary> /// 绑定字典项。 /// 作者:董帅 创建时间:2012-8-28 21:46:08 /// </summary> public void bindDicInfos() { try { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库操作对象 DataDicOperater dicOper = DataDicOperater.createDataDicOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (dicOper != null) { //获取父字典项 if (this.hidParentId.Value == "-1") { this.spanParentName.InnerText = "顶级字典"; this.returnButton.Disabled = true; this.hidReturnId.Value = ""; } else { DataDictionaryInfo org = dicOper.getDataDictionary(Convert.ToInt32(this.hidParentId.Value)); this.spanParentName.InnerText = org.name; this.hidReturnId.Value = org.parentId.ToString(); } //获取组织机构列表 List <DataDictionaryInfo> dics = dicOper.getDataDictionaryByParentId(Convert.ToInt32(this.hidParentId.Value)); if (dics != null) { this.dicList.DataSource = dics; this.dicList.DataBind(); } else { YMessageBox.show(this, "获取字典数据失败!错误信息[" + dicOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库操作对象失败!"); } } catch (Exception ex) { YMessageBox.show(this, "运行错误!错误信息[" + ex.Message + "]"); } }
private void FillDataGrid(List <Pdf2JpgFileInfo> pdfFiles) { var rowStyle = new RowStyle { Font = new Font("微软雅黑", 9f, FontStyle.Regular) }; var index = this.tableFiles.TableModel.Rows.Count; var sameFilesName = new List <string>(); foreach (var pdfFile in pdfFiles) { if (IsExistSameFileName(pdfFile.FileName)) { sameFilesName.Add(pdfFile.FileName); continue; } var row = new Row(); row.Cells.AddRange(new Cell[] { new Cell(pdfFile.FileName, Properties.Resources.pdf_ico), new Cell(Utils.CountSize(Utils.GetFileSize(pdfFile.FilePath))), new Cell(1), new Cell(100), new Cell(0), new Cell("删除", Properties.Resources.trash_empty), new Cell(pdfFile.FilePath) }); row.Tag = ConvertState.NotConvert; this.tableFiles.TableModel.Rows.Add(row); this.tableFiles.TableModel.Rows[index].RowStyle = rowStyle; index++; } if (sameFilesName.Count > 0) { if (sameFilesName.Count > 5) { sameFilesName = sameFilesName.Take(5).ToList(); sameFilesName.Add("... ..."); } var height = sameFilesName.Count * 20 + 150; var strNames = string.Join("\n", sameFilesName); YMessageBox.ShowMsgBox(height, $"下列文件:\n{strNames}\n已存在,将忽略添加!"); } }
public void ProgressAction(NoticeResult result) { if (result.Success) { try { this.tableFiles.TableModel.Rows[result.rowIndex].Cells[ProgressColIndex].Data = result.per; } catch (Exception) { convertThread.Abort(); } } else { YMessageBox.ShowMsgBox(150, result.ErrMsg); } }
protected void butChouse_Click(object sender, EventArgs e) { try { string strIds = Request["chkItem"]; string[] ids = new string[0]; if (!string.IsNullOrEmpty(strIds)) { ids = strIds.Split(','); } //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建数据库操作对象。 RoleOperater roleOper = RoleOperater.createRoleOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (roleOper != null) { //删除数据 int[] intIds = new int[ids.Length]; for (int i = 0; i < intIds.Length; i++) { intIds[i] = Convert.ToInt32(ids[i]); } if (roleOper.chouseRoleMenus(Convert.ToInt32(this.hidRoleId.Value), intIds)) { YMessageBox.showAndResponseScript(this, "选择菜单成功!", "", "window.parent.menuButtonOnClick('角色管理','icon-role','sys/role/role_list.aspx');window.parent.closePopupsWindow('#popups');"); } else { YMessageBox.show(this, "选择菜单失败!错误信息[" + roleOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //获取菜单 try { //获取id,没有id表示新增,否则为修改 string roleId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(roleId)) { this.hidRoleId.Value = roleId; } //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { RoleOperater roleOper = new RoleOperater(); roleOper.roleDataBase = orgDb; List <RoleMenuInfo> menus = roleOper.getChouseMenus(Convert.ToInt32(this.hidRoleId.Value)); this.menuGroup.DataSource = menus; this.menuGroup.DataBind(); } else { YMessageBox.show(this, "获取数据库实例失败!"); } } catch (Exception ex) { YMessageBox.showAndRedirect(this, "系统运行异常!异常信息[" + ex.Message + "]", "sys/login.aspx"); } } }
/// <summary> /// 绑定数据。 /// </summary> private void bindData() { //获取菜单 try { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //获取数据库实例。 YDataBase orgDb = YDataBaseConfigFile.createDataBase(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgDb != null) { MenuOperater menuOper = new MenuOperater(); menuOper.menuDataBase = orgDb; //绑定分组 List <PageInfo> pages = menuOper.getPageByMenuId(Convert.ToInt32(this.hidMenuId.Value)); if (pages != null) { this.pageList.DataSource = pages; this.pageList.DataBind(); } else { YMessageBox.show(this, "获取数据失败!"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { try { //获取id,没有id表示新增,否则为修改 string roleId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(roleId)) { this.hidRoleId.Value = roleId; //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建数据库操作对象。 RoleOperater roleOper = RoleOperater.createRoleOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (roleOper != null) { RoleInfo role = roleOper.getRole(Convert.ToInt32(roleId)); if (role != null) { this.txtRoleName.Value = role.name; this.txtRoleExplain.Value = role.explain; } } else { YMessageBox.show(this, "创建数据库对象失败!"); return; } } } catch (Exception ex) { YMessageBox.show(this, "错误信息:[" + ex.Message + "]"); } } }
private void btnStartConvert_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_mainForm.LbllblSavePath.Text.Trim())) { YMessageBox.ShowMsgBox(100, "请先选择要保存的路径!"); return; } this.btnStartConvert.Text = "转换中..."; SetConvertBtnEnable(false); ProgressNotice notice = ProgressAction;//创建一个委托对象 ConvertComplete convertCompleted = ConvertCompleteAction; if (convertThread != null) { convertThread = null; } convertThread = new Thread(StartConvert); var imgType = GetConvertedImgType(); convertThread.Start(new List <object> { 0, notice, convertCompleted, imgType }); }
/// <summary> /// 删除数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void butDeleteItems_Click(object sender, EventArgs e) { try { string s = Request["chkOrg"]; string[] orgIds = new string[0]; string[] userIds = new string[0]; if (!string.IsNullOrEmpty(s)) { orgIds = s.Split(','); //要删除的机构id } s = Request["chkUser"]; if (!string.IsNullOrEmpty(s)) { userIds = s.Split(','); //要删除的用户id } if ((orgIds.Length + userIds.Length) > 0) { //获取配置文件路径。 string configFile = AppDomain.CurrentDomain.BaseDirectory.ToString() + SystemConfig.databaseConfigFileName; //创建数据库操作对象。 OrgOperater orgOper = OrgOperater.createOrgOperater(configFile, SystemConfig.databaseConfigNodeName, SystemConfig.configFileKey); if (orgOper != null) { //删除机构和用户 int[] orgIntIds = new int[orgIds.Length]; for (int i = 0; i < orgIds.Length; i++) { orgIntIds[i] = Convert.ToInt32(orgIds[i]); } int[] userIntIds = new int[userIds.Length]; for (int i = 0; i < userIds.Length; i++) { userIntIds[i] = Convert.ToInt32(userIds[i]); } if (orgOper.deleteOrganizationAndUser(orgIntIds, userIntIds)) { this.Response.Redirect("organization_list.aspx?parentId=" + this.hidParentId.Value); //YMessageBox.showAndResponseScript(this, "删除数据成功!", "", "window.parent.menuButtonOnClick('组织机构管理','icon-organization','sys/organization/organization_list.aspx?parentId=" + this.hidParentId.Value + "')"); } else { YMessageBox.show(this, "删除数据失败!错误信息[" + orgOper.errorMessage + "]"); } } else { YMessageBox.show(this, "获取数据库实例失败!"); } } else { YMessageBox.show(this, "没有选择要删除的角色!"); } } catch (Exception ex) { YMessageBox.show(this, "系统运行异常!异常信息[" + ex.Message + "]"); } }