/// <summary> /// возвращает DataTable /// </summary> /// <param name="query"></param> /// <param name="name_t"></param> /// <returns></returns> public DataTable sql_dt(string query, string name_t) { Class_sql w = new Class_sql(); DataTable dt = w.ds_query(query, name_t).Tables[name_t]; return(dt); }
public DataTable load_worker_tocmb_box() { Class_sql sql = new Class_sql(); var comand = @"select tabel.id_tn, ttime,concat(Last_name,' ',First_name,' ',Second_name) FIO,position from tabel join worker on tabel.id_tn=worker.id_tn join Position on worker.id_Position=Position.id_position where (select id_Subunit from subunit where subunit='" + lUp_subunit.Text + "') =id_Subunit and" + " tdate between '" + dEdit_start.DateTime.ToString("yyyy-MM-01") + "' and '" + dEdit_start.DateTime.ToString("yyyy-MM-" + DateTime.DaysInMonth(dEdit_start.DateTime.Year, dEdit_start.DateTime.Month)) + "'"; return(sql.sql_dt(comand, "table")); }
private void comboBoxEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Tag.ToString() == "1") { if (cmb_ReportPrint.SelectedIndex == -1) { return; } var w = new Class_sql(); var rg = new ReportGenerating(); ReportGenerating.startDate = date_start; ReportGenerating.endDate = date_end; ReportGenerating.fio_for_report = dtWorker.Rows[0]["fio"].ToString(); ReportGenerating.subunit_for_report = dtWorker.Rows[0]["subunit"].ToString(); ReportGenerating.position = dtWorker.Rows[0]["position"].ToString().ToLower(); if (cmb_ReportPrint.Text.Equals("Текущая таблица")) { rg.Createreport(Convert.ToInt32(dtWorker.Rows[0]["id_subunit"].ToString()), dtTotal, cmb_ReportPrint.Text, formLogin.id_tn, ReportGenerating.fio_for_report); return; } rg.Createreport(Convert.ToInt32(dtWorker.Rows[0]["id_subunit"].ToString()), dtTotal, cmb_ReportPrint.Text, formLogin.id_tn, ReportGenerating.fio_for_report); } }