//加载功能 private void LoadModule(ModuleModel m, out NavBarGroup CurrentGroup, out BarSubItem CurrentBarItem) { var ModuleImage = LoadUIImage.LoadNavBarImage_Group(ConvertLib.ToString(m.ModuleImg)); //添加模块到navBarControl1 //m.ModuleName = "(新)" + m.ModuleName; //LoadModule(hp, dtModulesFun, m); //hp.CurrentGroup.Appearance.ForeColor = Color.FromArgb(0x99, 0x00, 0x33); //hp.CurrentGroup.Appearance.Font = new Font(hp.CurrentGroup.Appearance.Font, FontStyle.Bold); CurrentGroup = new NavBarGroup() { Caption = m.Caption, SmallImage = ModuleImage, Tag = m }; navBarControl1.Groups.Add(CurrentGroup); //添加模块到bbi_Module CurrentBarItem = new BarSubItem() { Caption = m.Caption, Glyph = ModuleImage }; if (m.IsNew) { CurrentGroup.Appearance.ForeColor = Color.FromArgb(0x99, 0x00, 0x33); CurrentGroup.Appearance.Font = new Font(CurrentGroup.Appearance.Font, FontStyle.Bold); } ribbonControl1.Items.Add(CurrentBarItem); bsi_Modules.AddItem(CurrentBarItem); }
void refreshDataSource() { var v = ConvertLib.ToString(treeProductCategory.FocusedNode.GetValue(treeListColumn1)); gc_Detail_tb_PODetail.DataSource = bll.SearchData(v); gv_Detail_tb_PODetail.ExpandAllGroups(); }
public static void AddColumns(DataTable dt, params string[] Cols) { if (dt.Columns[DefNewColName] != null) { return; } dt.Columns.Add(DefNewColName, Type.GetType("System.String")); foreach (DataRow dr in dt.Rows) { string Combine = string.Empty; foreach (string Col in Cols) { if (String.IsNullOrEmpty(Combine)) { Combine = ConvertLib.ToString(dr[Col]); } else { Combine += " - " + ConvertLib.ToString(dr[Col]); } } dr[DefNewColName] = Combine; } }
private void TreeProductCategory_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { var v = ConvertLib.ToString(e.Node.GetValue(treeListColumn1)); gc_Detail_tb_PODetail.DataSource = bll.SearchListData(v); gv_Detail_tb_PODetail.ExpandAllGroups(); }
public static bool VerificationEmpEditValue(BaseEdit edit) { if (String.IsNullOrEmpty(ConvertLib.ToString(edit.EditValue))) { return(true); } return(false); }
private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e) { if (String.IsNullOrEmpty(ConvertLib.ToString(e.Value))) { e.Valid = false; e.ErrorText = gridView1.FocusedColumn.Caption + "不能为空!"; } }
private void txt_ProviderName_EditValueChanged(object sender, EventArgs e) { string str = ConvertLib.ToString(txt_ProviderName.EditValue); xtraTabControl1.Enabled = !String.IsNullOrEmpty(str); str = String.IsNullOrEmpty(str) ? "Error" : str; ProviderName = str; }
public List <ModuleModel> GetModuleALL() { List <ModuleModel> lst = new List <ModuleModel>(); var modules = GetLocalAllModules(); DataSet ds = new bllModules().GetUserModules(Loginer.CurrentLoginer.Account); DataTable dtModules = ds.Tables[sys_Modules._TableName]; DataTable dtModulesFun = ds.Tables[sys_ModulesFunction._TableName]; foreach (IModule m in modules.Modules) { DataRow drModule = dtModules.Select($"{sys_Modules.ModuleID}='{m.ModuleID}'").FirstOrDefault(); ModuleModel module = new ModuleModel() { ModuleImg = m.ModuleImg, ModuleName = m.ModuleName, ModuleID = m.ModuleID, Sort = -1, ModuleMainType = (m is Form) ? m.GetType() : null }; if (drModule != null) { module.ModuleName = ConvertLib.ToString(drModule[sys_Modules.ModuleName]); module.Sort = ConvertLib.ToInt(drModule[sys_Modules.Sort]); module.IsNew = false; } foreach (ModuleFunction fun in m.FunctionCollection) { fun.Sort = -1; DataRow drFun = dtModulesFun.Select($"{sys_ModulesFunction.FunctionID}='{fun.FunctionID}'").FirstOrDefault(); if (drFun != null) { fun.FunctionName = ConvertLib.ToString(drFun[sys_ModulesFunction.FunctionName]); fun.Sort = ConvertLib.ToInt(drFun[sys_ModulesFunction.Sort]); byte[] imgByte = drFun[sys_ModulesFunction.Image] as byte[]; if (imgByte != null && imgByte.Length > 0) { fun.FormIcon = Common.ImageLibrary.ConvertBytesToImage(imgByte); } fun.IsNew = false; } fun.UserAuthority = GZFramework.UI.Core.FunctionAuthority.All; module.functions.Add(fun); } if (module.functions.Count > 0) { lst.Add(module); } } SortModule(lst); return(lst); }
private void btn_OK_Click(object sender, EventArgs e) { bool b = LibraryTools.IsNotEmpBaseEdit(txtItemNo, "货号不能为空!"); if (b == false) { return; } Data = new DataTable(); Data.Columns.Add(nameof(tb_PODetail.ItemNo), typeof(System.String)); Data.Columns.Add(nameof(tb_PODetail.ItemName), typeof(System.String)); Data.Columns.Add(nameof(tb_PODetail.CategoryID), typeof(System.String)); Data.Columns.Add(nameof(tb_PODetail.POPrice), typeof(System.Decimal)); Data.Columns.Add(nameof(tb_PODetail.SOPrice), typeof(System.Decimal)); Data.Columns.Add(nameof(tb_PODetail.Color), typeof(System.String)); Data.Columns.Add(nameof(tb_PODetail.Size), typeof(System.String)); Data.Columns.Add(nameof(tb_PODetail.Qty), typeof(System.Int16)); Data.Columns.Add(nameof(tb_PODetail.TotalPOAmount), typeof(System.Decimal)); foreach (DataRow row in dtQty.Rows) { string color = ConvertLib.ToString(row["Color"]); for (int i = 0; i < dtSize.Rows.Count; i++) { string fileName = "Qty_" + (i + 1); int qty = ConvertLib.ToInt(row[fileName]); if (qty > 0) { DataRow dr = Data.NewRow(); dr[tb_PODetail.ItemNo] = txtItemNo.EditValue; if (!String.IsNullOrEmpty(ConvertLib.ToString(txtItemName.EditValue))) { dr[tb_PODetail.ItemName] = txtItemName.EditValue; } dr[tb_PODetail.CategoryID] = txtCategory.EditValue; if (!String.IsNullOrEmpty(ConvertLib.ToString(txtPOPrice.EditValue))) { dr[tb_PODetail.POPrice] = txtPOPrice.EditValue; } if (!String.IsNullOrEmpty(ConvertLib.ToString(txtSOPrice.EditValue))) { dr[tb_PODetail.SOPrice] = txtSOPrice.EditValue; } dr[tb_PODetail.Color] = color; dr[tb_PODetail.Size] = dtSize.Rows[i]["DataName"]; dr[tb_PODetail.Qty] = qty; dr[tb_PODetail.TotalPOAmount] = ConvertLib.ToDecimal(txtPOPrice.EditValue, 0) * qty; Data.Rows.Add(dr); } } } Data.AcceptChanges(); this.DialogResult = DialogResult.OK; }
private List <ModuleModel> GetModuleConfig() { List <ModuleModel> lst = new List <ModuleModel>(); var lstModules = GetLocalAllModules(); DataSet ds = new bllModules().GetUserModules(Loginer.CurrentLoginer.Account); DataTable dtModules = ds.Tables[sys_Modules._TableName]; DataTable dtModulesFun = ds.Tables[sys_ModulesFunction._TableName]; foreach (DataRow dr in dtModules.Rows) { var m = lstModules.Modules[dr[sys_Modules.ModuleID].ToString()]; if (m == null) { continue; } ModuleModel module = new ModuleModel() { ModuleImg = m.ModuleImg, ModuleName = dr[sys_Modules.ModuleName] + "", ModuleID = m.ModuleID, Sort = ConvertLib.ToInt(dr[sys_Modules.Sort]), IsNew = false, ModuleMainType = (m is Form) ? m.GetType() : null }; dtModulesFun.DefaultView.RowFilter = String.Format("{0}='{1}'", sys_ModulesFunction.ModuleID, dr[sys_Modules.ModuleID]); foreach (DataRow row in dtModulesFun.DefaultView.ToTable().Rows) { var fun = m.FunctionCollection[row[sys_ModulesFunction.FunctionID].ToString()]; fun.UserAuthority = ConvertLib.ToInt(row["UserAuthority"]); fun.FunctionName = ConvertLib.ToString(row[sys_ModulesFunction.FunctionName]); fun.Sort = ConvertLib.ToInt(row[sys_ModulesFunction.Sort]); fun.IsNew = false; byte[] imgByte = row[sys_ModulesFunction.Image] as byte[]; if (imgByte != null && imgByte.Length > 0) { fun.FormIcon = Common.ImageLibrary.ConvertBytesToImage(imgByte); } if (fun == null) { continue; } module.functions.Add(fun); } if (module.functions.Count > 0) { lst.Add(module); } } SortModule(lst); return(lst); }
bool ValidatePwd() { string pwd = ConvertLib.ToString(txt_pwd.EditValue); bllLogin bll = new Business.bllLogin(); bool Success = bll.VerifyPwdEx(Loginer.CurrentLoginer.Account, pwd); if (Success == false) { txt_pwd.ErrorText = "密码错误!"; } return(Success); }
private frmDialogSaleEdit(DataRow row) { InitializeComponent(); DataSource = row; txtBarCode.Text = ConvertLib.ToString(DataSource[tb_SODetail.BarCode]); txtItemNo.Text = ConvertLib.ToString(DataSource[tb_SODetail.ItemNo]); txtItemName.Text = ConvertLib.ToString(DataSource[tb_SODetail.ItemName]); txtQty.EditValue = DataSource[tb_SODetail.Qty]; txtUnitPrice.EditValue = DataSource[tb_SODetail.UnitPrice]; txtTotalAmount.EditValue = DataSource[tb_SODetail.TotalAmount]; txtRemark.EditValue = DataSource[tb_SODetail.Remark]; }
private void btn_OK_Click(object sender, EventArgs e) { if (ConvertLib.ToString(txt_DBName.EditValue) == "") { txt_DBName.ErrorText = "名称不能为空!"; return; } else { this.DialogResult = DialogResult.OK; } }
/// <summary> /// 绑定RadioGroup组控件的数据源 /// </summary> /// <param name="edit">RadioGroup组控件</param> /// <param name="dataSource">数据源</param> /// <param name="bindField">取值字段</param> public static void BindingRadioEdit(RadioGroup edit, DataTable dataSource, string displayMember, string valueMember) { foreach (DataRow dr in dataSource.Rows) { string strName = ConvertLib.ToString(dr[displayMember]); //获取名称 string strVaule = ConvertLib.ToString(dr[valueMember]); //获取值 DevExpress.XtraEditors.Controls.RadioGroupItem rgItem = new DevExpress.XtraEditors.Controls.RadioGroupItem() { Description = strName, Value = strVaule }; edit.Properties.Items.Add(rgItem); } }
//删除 private void btn_Delete_Click(object sender, EventArgs e) { DataRow dr = gv_Summary.GetFocusedDataRow(); if (dr == null) { return; } string DBCode = ConvertLib.ToString(dr[sys_DataBaseList.DBCode]); bll.Delete(DBCode); gv_Summary.DeleteSelectedRows(); Msg.ShowInformation("删除成功!"); }
/// <summary> /// 验证用户名密码 /// </summary> /// <param name="User"></param> /// <param name="Pwd"></param> /// <param name="dr"></param> /// <returns></returns> public Loginer VerifyPwd(string User, string Pwd, string LoginDBCode) { Pwd = PwdEncrypt(Pwd); SqlParameterProvider p = new SqlParameterProvider(); p.AddParameter("@Account", SqlDbType.VarChar, User); p.AddParameter("@Pwd", SqlDbType.VarChar, Pwd); p.AddParameter("@LoginDBCode", SqlDbType.VarChar, LoginDBCode); DataTable dt = DataBaseFactoryEx.CreateDataBase(Loginer.CurrentLoginer.SystemDBCode).GetTableSP("usp_UserLogin", "tmp", p); if (dt.Rows.Count == 0) { return(null); } else { DataRow row = dt.Rows[0]; Loginer user = new Loginer(); user.Account = (string)row[dt_MyUser.Account]; user.UserName = (string)row[dt_MyUser.UserName]; user.IsSysAdmin = Object.Equals(row[dt_MyUser.IsSysAdmain], "Y"); user.IsSysLock = Object.Equals(row[dt_MyUser.IsSysLock], "Y"); user.LoginDBCode = ConvertLib.ToString(row[dt_MyUserDBs.DBCode]); user.IsDBAdmin = Object.Equals(row[dt_MyUserDBs.IsDBAdmin], "Y"); user.IsDBLock = Object.Equals(row[dt_MyUserDBs.IsDBLock], "Y"); if (user.IsSysAdmin && String.IsNullOrEmpty(user.LoginDBCode)) { user.LoginDBCode = LoginDBCode; } return(user); } //var v = DatabaseFactory.CreateDataBaseEx(Loginer.CurrentLoginer.SystemDBCode).ExecuteDataReader(sql, new { Account = User, Pwd = Pwd }, row => //{ // return new Loginer() // { // Account = (string)row[dt_MyUser.Account], // UserName = (string)row[dt_MyUser.UserName], // IsDBAdmin = Object.Equals(row[dt_MyUser.IsAdmain], "Y") // }; //}); //if (v.Count() > 0) // return v.First(); //else // return null; }
void LoadConfigDBList() { bllDataBaseList bll = new bllDataBaseList(); DataTable dt = bll.GetUserDBList(Loginer.CurrentLoginer.Account); foreach (DataRow dr in dt.Rows) { string DBCode = ConvertLib.ToString(dr[sys_DataBaseList.DBCode]); string DBConnection = Encrypt.DESDecrypt(ConvertLib.ToString(dr[sys_DataBaseList.DBConnection]), Globals.KeyConnectionStr); string DBProviderName = ConvertLib.ToString(dr[sys_DataBaseList.DBProviderName]); dic.Add(DBCode, new DabaBaseModel() { ConnnectionString = DBConnection, ProviderName = DBProviderName }); } }
/// <summary> /// /// </summary> /// <param name="edit"></param> /// <param name="EmpErrorText">空值时提醒</param> /// <param name="EIA">ErrorIcon显示位置</param> /// <returns>不为空返回Ture,空返回false</returns> public static bool VerificationNotEmpEditValue(BaseEdit edit, string EmpErrorText, ErrorIconAlignment EIA = ErrorIconAlignment.MiddleRight) { if (edit.Visible == false) { return(true); } if (String.IsNullOrEmpty(ConvertLib.ToString(edit.EditValue))) { if (EmpErrorText != "") { edit.ErrorText = EmpErrorText; edit.ErrorIconAlignment = EIA; } return(false); } return(true); }
public static DialogResult ShowForm(ref string DBName) { frmDialogChangeDBText frm = new frmDialogChangeDBText(); frm.ShowIcon = frm.ShowInTaskbar = false; frm.StartPosition = FormStartPosition.CenterScreen; frm.txt_DBName.EditValue = DBName; var v = frm.ShowDialog(); if (v == DialogResult.OK) { DBName = ConvertLib.ToString(frm.txt_DBName.EditValue); } return(v); }
private void btn_Edit_Click(object sender, EventArgs e) { DataTable dt = gc_Summary.DataSource as DataTable; dt.AcceptChanges(); DataRow dr = gv_Summary.GetFocusedDataRow(); if (dr == null) { return; } string DBName = ConvertLib.ToString(dr[sys_DataBaseList.DBDisplayText]); string NewDBName = ConvertLib.ToString(txt_DBName.EditValue); DataSet ds = new DataSet(); try { if (DBName != NewDBName) { dr[sys_DataBaseList.DBDisplayText] = NewDBName; ds.Tables.Add(dt); } if (ucModuleTreeList1.EditData.GetChanges() != null) { ds.Tables.Add(ucModuleTreeList1.EditData); } if (ds.Tables.Count > 0) { bll.Update(ds); ds.AcceptChanges(); Msg.ShowInformation("保存成功!"); } } catch (Exception ex) { throw ex; } finally { ds.Tables.Clear(); } }
void lue_LayoutName_EditValueChanged(object sender, EventArgs e) { DataRowView dv = lue_LayoutName.Properties.GetDataSourceRowByKeyValue(lue_LayoutName.EditValue) as DataRowView; if (dv.Row.RowState == DataRowState.Added) { return; } string LayoutID = ConvertLib.ToString(lue_LayoutName.EditValue); if (String.IsNullOrEmpty(LayoutID)) { return; } dsData = bll.GetViewLayoutLayoutID(_ViewCode, LayoutID); BoundData(dsData, LayoutID); }
private void btn_Delete_Click(object sender, EventArgs e) { if (Msg.AskQuestion("确定要删除吗?") == false) { return; } DataRowView dv = lue_LayoutName.Properties.GetDataSourceRowByKeyValue(lue_LayoutName.EditValue) as DataRowView; if (dv.Row.RowState != DataRowState.Added) { string LayoutID = ConvertLib.ToString(lue_LayoutName.EditValue); if (bll.Delete(LayoutID) == true) { Msg.ShowInformation("删除成功!"); } } dv.Row.Table.Rows.Remove(dv.Row); }
private void btn_UNLock_Click(object sender, EventArgs e) { string pwd = ConvertLib.ToString(txt_pwd.EditValue); if (new bllLogin().VerifyPwdEx(Loginer.CurrentLoginer.Account, pwd)) { if (VerifySuccess != null) { VerifySuccess(null, null); } this.Close(); this.Dispose(); } else { txt_pwd.ErrorText = "密码错误!"; } }
private void gv_Summary_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = gv_Summary.GetFocusedDataRow(); if (dr == null) { return; } string DBCode = ConvertLib.ToString(dr[sys_DataBaseList.DBCode]); string PreDBDisplayText = ""; DataRow preRow = gv_Summary.GetDataRow(e.PrevFocusedRowHandle); if (preRow != null) { PreDBDisplayText = ConvertLib.ToString(preRow[sys_DataBaseList.DBDisplayText]); } if (Object.Equals(ucModuleTreeList1.Tag, DBCode)) { return; } else { bool Edit = ucModuleTreeList1.EditData != null && ((ucModuleTreeList1.EditData.GetChanges() != null) || !Object.Equals(PreDBDisplayText, txt_DBName.EditValue)); if (Edit) { if (Msg.AskQuestion("修改没有保存,确定要舍弃吗?") == false) { gv_Summary.FocusedRowHandle = e.PrevFocusedRowHandle; return; } } //获得新的一组EditData DataTable dt = bll.GetDBAuthority(dr[sys_DataBaseList.DBCode].ToString()); txt_DBName.EditValue = dr[sys_DataBaseList.DBDisplayText]; //绑定 ucModuleTreeList1.EditData = dt; ucModuleTreeList1.Tag = DBCode; } }
private void MDIPageOptionBool_EditValueChanged(object sender, ItemClickEventArgs e) { BarCheckItem bci = (sender as BarCheckItem); bool check = bci.Checked; string tag = ConvertLib.ToString(bci.Tag); DefaultBoolean boolean = check == true ? DefaultBoolean.True : DefaultBoolean.False; switch (tag) { case "TabFloatOnDoubleClick": { xtraTabbedMdiManager1.FloatOnDoubleClick = boolean; }; break; case "TabFloatOnDrag": { xtraTabbedMdiManager1.FloatOnDrag = boolean; }; break; case "TabColored": { if (check) { PageHeadColor.BoundChildPagesBackColor(xtraTabbedMdiManager1); } else { PageHeadColor.UnBoundChildPagesBackColor(xtraTabbedMdiManager1); } }; break; case "TabHeaderAutoFill": { xtraTabbedMdiManager1.HeaderAutoFill = boolean; }; break; } INISystemConfig.SetTabStrValue(tag, check); }
private static void LoadDetailData(GridView gv, DataTable dt) { bool ShowFoot = false; List <GridColumn> lst = new List <GridColumn>(); foreach (GridColumn col in gv.Columns) { var drs = dt.Select(String.Format("{0}='{1}'", sys_GridViewLayoutDetail.FileName, col.FieldName)); if (drs.Length > 0) { DataRow row = drs[0]; col.Caption = ConvertLib.ToString(row[sys_GridViewLayoutDetail.FileCaption]); col.Visible = Object.Equals(row[sys_GridViewLayoutDetail.IsShow], "Y"); if (col.Visible == false) { lst.Add(col); } col.Width = ConvertLib.ToInt(row[sys_GridViewLayoutDetail.Width], 75); col.AppearanceCell.ForeColor = Color.FromArgb(ConvertLib.ToInt(row[sys_GridViewLayoutDetail.FontColor])); col.AppearanceCell.BackColor = Color.FromArgb(ConvertLib.ToInt(row[sys_GridViewLayoutDetail.BackColor])); int alignmeng = ConvertLib.ToInt(row[sys_GridViewLayoutDetail.Alignment]); col.AppearanceCell.TextOptions.HAlignment = (HorzAlignment)alignmeng; if (ConvertLib.ToInt(row[sys_GridViewLayoutDetail.SummaryType], 6) != 6) { ShowFoot = true; col.Summary.Clear(); var item = col.Summary.Add(); item.FieldName = col.FieldName; item.SummaryType = (SummaryItemType)ConvertLib.ToInt(row[sys_GridViewLayoutDetail.SummaryType]); item.DisplayFormat = ConvertLib.ToString(row[sys_GridViewLayoutDetail.SummaryFormat]); } } } foreach (GridColumn col in lst) { gv.Columns.Remove(col); } gv.OptionsView.ShowFooter = ShowFoot; }
protected override void DoView(object sender) { DataRow dr = _SummaryView.GetFocusedDataRow(); if (dr == null) { Msg.Warning("没有选择数据!"); return; } CurrentDataState = FormDataState.View;//设置状态 string Key = ConvertLib.ToString(dr[_bll.SummaryModel.PrimaryKey]); //2015年10月21日11:55:26 当双击不同记录的时候再重新获取数据,避免重复读取数据库 bool Repeat = EditData != null && Object.Equals(Key, EditData.Tables[_bll.SummaryModel.TableName].Rows[0][_bll.SummaryModel.PrimaryKey]); if (!Repeat) { EditData = GetEditData(Key); //获得需要绑定的数据 DoBoundEditData(); //绑定数据 } }
/* * // 设置当前 tab页的 图标,我这里也默认取navBar中的Item中的图标 * xtraTabbedMdiManager1.Pages[frm].Image = Image.FromHbitmap(frm.Icon.ToBitmap().GetHbitmap()); */ private void MDIPageOptionEmun_EditValueChanged(object sender, EventArgs e) { BarEditItem bei = (sender as BarEditItem); string text = ""; string tag = ConvertLib.ToString(bei.Tag); switch (tag) { case "TabPageImagePosition": { text = ((TabPageImagePosition)bei.EditValue).ToString(); xtraTabbedMdiManager1.PageImagePosition = (TabPageImagePosition)bei.EditValue; }; break; case "ClosePageButtonShowMode": { text = ((ClosePageButtonShowMode)bei.EditValue).ToString(); xtraTabbedMdiManager1.ClosePageButtonShowMode = (ClosePageButtonShowMode)bei.EditValue; }; break; case "TabHeaderLocation": { text = ((TabHeaderLocation)bei.EditValue).ToString(); xtraTabbedMdiManager1.HeaderLocation = (TabHeaderLocation)bei.EditValue; }; break; case "TabOrientation": { text = ((TabOrientation)bei.EditValue).ToString(); xtraTabbedMdiManager1.HeaderOrientation = (TabOrientation)bei.EditValue; }; break; } INISystemConfig.SetTabStrValue(tag, text); }
private void item_LinkClicked(object sender, NavBarLinkEventArgs e) { string fun = ConvertLib.ToString(e.Link.Item.Tag); ShowChildForm(fun); }
private void bbi_ItemClick(object sender, ItemClickEventArgs e) { string fun = ConvertLib.ToString(e.Item.Tag); ShowChildForm(fun); }