private void Window_Loaded(object sender, RoutedEventArgs e) { AccessCUID acuid = new AccessCUID(); lvwContact.ItemsSource = acuid.Query("select * from 客户联系人", "C:\\WORK\\MyData\\数据集.accdb").DefaultView; lvwCompany.ItemsSource = acuid.Query("select * from 客户公司", "C:\\WORK\\MyData\\数据集.accdb").DefaultView; }
private void checkpassword() { string sql = "select * from 用户 where 用户名='" + tbUser.Text + "' and 密码='" + tbPassword.Password + "'"; string currentDir = "C:\\WORK\\"; if (tbUser.Text != "舒丁") { currentDir = "D:\\"; } AccessCUID acuid = new AccessCUID(); try { if (acuid.Query(sql, currentDir + "MyData\\dataset.accdb").Rows.Count > 0) { MainWindow workspace = new MainWindow(); workspace.UserName = tbUser.Text; workspace.CurrentDir = currentDir; workspace.Show(); this.Close(); } else { MessageBox.Show("用户名或密码错误!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { string sql = "select * from 客户公司 order by 简称 asc"; AccessCUID acuid = new AccessCUID(); cmbClientList.ItemsSource = acuid.Query(sql, "C:\\WORK\\MyData\\数据集.accdb").AsDataView(); cmbClientList.DisplayMemberPath = "简称"; lbClientName.Content = clientFullName; }
//把数据显示在自定义的listview中 private int ShowList(string sql, string path) { AccessCUID acuid = new AccessCUID(); System.Data.DataTable dt = new System.Data.DataTable(); dt = acuid.Query(sql, path); //lvw3.ItemsSource = DTtoAbstracts(dt); lvw3.ItemsSource = DTtoAbstracts1(dt); lvw3.View = lvw3.FindResource("tileView") as ViewBase; return(dt.Rows.Count); }
private void btnTest_Click(object sender, RoutedEventArgs e) { AccessCUID acuid = new AccessCUID(); string sql = "Select * from 案件任务,案件信息 where 案件任务.我方案号=案件信息.我方案号 and 案件任务.我方案号='" + CaseID + "' order by 初稿时限 asc"; DataTable dt = new DataTable(); dt = acuid.Query(sql, "C:\\WORK\\MyData\\数据集.accdb"); lvwCaseFlow.ItemsSource = DTtoTaskDetail(dt); lvwCaseFlow.View = lvwCaseFlow.FindResource("tileView") as ViewBase; }
//刷新案件历史 private void Button_Click(object sender, RoutedEventArgs e) { string sql = "Select * from 案件任务 where"; sql = sql + " (我方案号 like '%" + AttorneyNum + "%') order by 初稿时限 asc"; AccessCUID acuid = new AccessCUID(); System.Data.DataTable dt = new System.Data.DataTable(); dt = acuid.Query(sql, "C:\\WORK\\MyData\\dataset.accdb"); //MessageBox.Show(dt.Rows.Count.ToString()); lvwHistory.ItemsSource = dt.DefaultView; }
private void btnDelete_Click(object sender, RoutedEventArgs e) { if (lvwTransaction.SelectedIndex < 0) { MessageBox.Show("未选中任何项"); } else { DataRowView obj = (DataRowView)lvwTransaction.SelectedItem; DataRow dr = obj.Row; //DateTime sdate = (DateTime)dr["发起时间"]; string starter = dr["发起人"].ToString(); string tag = dr["标签"].ToString(); AccessCUID acuid = new AccessCUID(); string sql = "delete from 事务表 where (发起人= '" + starter + "'and 标签 ='" + tag + "')"; if (MessageBox.Show("是否删除选择的事务", "确认删除", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { acuid.Update(sql, "C:\\WORK\\MyData\\dataset.accdb"); lvwTransaction.ItemsSource = acuid.Query("select * from 事务表 order by 发起时间 desc", "C:\\WORK\\MyData\\dataset.accdb").DefaultView; } } }
private WeightData CalculateWeight2(DateTime startDate, DateTime endDate, string sql) { WeightData wtdt = new WeightData(); wtdt.Totalweight = 0; sql = sql + "between #" + startDate + "# and #" + endDate + "#)"; AccessCUID acuid = new AccessCUID(); System.Data.DataTable dt = acuid.Query(sql, CurrentDir + "MyData\\dataset.accdb"); dt.Columns.Add("权值", typeof(double)); foreach (DataRow dr in dt.Rows) { string taskType = dr["申请类型"].ToString() + dr["任务名称"].ToString() + dr["任务属性"].ToString() + dr["任务标识"].ToString(); double taskWeight = 0; switch (taskType) { case "PCT国际申请新申请": taskWeight = 1.2; break; case "PCT国际申请撰写": taskWeight = 1.2; break; case "PCT国际申请改写": taskWeight = 0.5; break; case "发明新申请": case "发明新申请撰写": taskWeight = 1; break; case "实用新型新申请": case "实用新型新申请撰写": taskWeight = 0.7; break; case "发明OA答复一通实质(S)": taskWeight = 0.4; break; case "发明OA答复二通实质(S)": case "实用新型OA答复一通实质(S)": taskWeight = 0.2; break; case "发明OA答复三通实质(S)": case "发明OA答复四通实质(S)": taskWeight = 0.1; break; case "发明OA答复一通形式-非本人失误(XN)": case "发明OA答复二通形式-非本人失误(XN)": case "发明OA答复三通形式-非本人失误(XN)": case "实用新型OA答复一通形式-非本人失误(XN)": case "实用新型OA答复二通形式-非本人失误(XN)": taskWeight = 0.1; break; default: taskWeight = 0; break; } dr["权值"] = taskWeight; wtdt.Totalweight = wtdt.Totalweight + taskWeight; } wtdt.ResultTable = dt; return(wtdt); }
private void Window_Loaded(object sender, RoutedEventArgs e) { AccessCUID acuid = new AccessCUID(); lvwTransaction.ItemsSource = acuid.Query("select * from 事务表 order by 发起时间 desc", "C:\\WORK\\MyData\\dataset.accdb").DefaultView; }
private void tbSearchContact_TextChanged(object sender, TextChangedEventArgs e) { AccessCUID acuid = new AccessCUID(); lvwContact.ItemsSource = acuid.Query("select * from 客户联系人 where 姓名 like '%" + tbSearchContact.Text + "%'", "C:\\WORK\\MyData\\数据集.accdb").DefaultView; }