private void BindData() { StringBuilder sbSql = new StringBuilder("Select NUMB_SYSLOG,FK_NAME_MENU,FLAG_LOGSORT,FK_NAME_USER,INFO_CONT,INFO_DATE FROM sys_client_syslog WHERE 1=1 "); if (txtUserName.Text.Trim() != "") { sbSql.Append(" AND FK_NAME_USER='******' "); } if (cmbOperationType.SelectedIndex > 0) { sbSql.Append(" AND FLAG_LOGSORT='" + (cmbOperationType.SelectedItem as ComboBoxItem).Content.ToString() + "' "); } sbSql.Append(" AND INFO_DATE>='" + Convert.ToDateTime(dtpStartDate.SelectedDate).ToShortDateString() + " 00:00:01" + "' AND INFO_DATE<='" + Convert.ToDateTime(dtpEndDate.SelectedDate).ToShortDateString() + " 23:59:59" + "'"); try { dbHelper = DBUtility.DbHelperMySQL.CreateDbHelper(); lvlist.DataContext = dbHelper.GetDataSet(sbSql.ToString()).Tables[0]; currentTable = dbHelper.GetDataSet(sbSql.ToString()).Tables[0]; } catch (Exception) { return; } }
public static void WriteLog(string menu, string userName, OperationType operationType, string content) { string type = string.Empty; switch (operationType) { case OperationType.Login: type = "登录"; break; case OperationType.Add: type = "添加"; break; case OperationType.Modify: type = "修改"; break; case OperationType.Delete: type = "删除"; break; case OperationType.AddAndModify: type = "添加和修改"; break; case OperationType.AddAndDelete: type = "添加和删除"; break; case OperationType.ModifyAndDelete: type = "修改和删除"; break; case OperationType.All: type = "全部"; break; } string strSql = string.Format(@"insert into sys_client_syslog (FK_NAME_MENU,FLAG_LOGSORT,FK_NAME_USER,INFO_CONT,INFO_DATE) values ('{0}','{1}','{2}','{3}','{4}')", menu, type, userName, content, DateTime.Now); DBUtility.DbHelperMySQL dbHelper = DBUtility.DbHelperMySQL.CreateDbHelper(); try { dbHelper.ExecuteSql(strSql); } catch (Exception) { return; } }
private void BindListView() { string strSql = "SELECT NUMB_ROLE,cdeptid,muserid,INFO_NAME,INFO_EXPL,FLAG_TIER,FK_NUMB_ROLE,INFO_NOTE FROM sys_client_role WHERE cuserid = " + (Application.Current.Resources["User"] as UserInfo).ID; try { dbHelper = DBUtility.DbHelperMySQL.CreateDbHelper(); DataSet ds = dbHelper.GetDataSet(strSql); lvlist.DataContext = ds.Tables[0]; currentTable = ds.Tables[0]; } catch (Exception) { return; } }
private void BindData() { string strSql = "select NUMB_DATADICT,INFO_CODE,INFO_NAME,INFO_GBCODE,Dept_ID, " + "(CASE WHEN INFO_USE=1 THEN '启用' ELSE '不启用' END) AS INFO_USE " + "from sys_client_dict " + "where dept_id=(select fk_dept from sys_client_user where reco_pkid='" + (Application.Current.Resources["User"] as UserInfo).ID + "')"; try { dbHelper = DBUtility.DbHelperMySQL.CreateDbHelper(); DataTable dt = dbHelper.GetDataSet(strSql).Tables[0]; currentTable = dt; } catch (Exception) { return; } }
public static void InitComboboxSource(ComboBox cmb, string strSql, string type) { try { DBUtility.DbHelperMySQL dbHelper = DBUtility.DbHelperMySQL.CreateDbHelper(); DataTable dt = dbHelper.GetDataSet(strSql).Tables[0]; if (cmb != null) { if (cmb.Items.Count > 0) { cmb.Items.Clear(); } } Label item = new Label(); item.Tag = -1; if (type == "cxtj") { item.Content = "-全部-"; } else { item.Content = "-请选择-"; } cmb.Items.Add(item); cmb.SelectedItem = item; if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { string strValue = dt.Rows[i][0].ToString(); //隐藏值 string strItem = dt.Rows[i][1].ToString(); //显示值 Label item1 = new Label(); item1.Tag = strValue; item1.Content = strItem; cmb.Items.Add(item1); } } } catch (Exception) { return; } }