protected void Page_Load(object sender, EventArgs e) { string id = Request.Params["id"]; string username = Session["username"].ToString(); //string id = "44"; DB db = new DB(); DataTable dt = new DataTable(); DataTable dd = new DataTable(); if (id != null && id != "") { string sql = "select PNAME,PNUMBER,PLANFLAG,DESICHIEF from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); } if (dt.Rows.Count > 0) { planDesigner.Value = dt.Rows[0]["DESICHIEF"].ToString(); PName.Value = dt.Rows[0]["PNAME"].ToString(); PNumber.Value = dt.Rows[0]["PNUMBER"].ToString(); planflag.Value = dt.Rows[0]["PLANFLAG"].ToString(); string sql_blue = "select FILES,BZ from T_CONSTRUCTION where SPECIALPERSON='" + username + "' and PNAME='" + dt.Rows[0]["PNAME"].ToString() + "'"; dd = db.GetDataTable(sql_blue); if (dd.Rows.Count > 0) { hd_BlueGraph.Value = dd.Rows[0]["FILES"].ToString(); B_BZ.Value = dd.Rows[0]["BZ"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.Params["id"]; hd_id.Value = id; string username = Session["username"].ToString(); DB db = new DB(); DataTable dt = new DataTable(); DataTable dd = new DataTable(); if (id != null && id != "") { string sql = "select MAJORDELEGATEDATE_R from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } if (dt.Rows.Count > 0) { commissionFlag.Value = dt.Rows[0]["MAJORDELEGATEDATE_R"].ToString() != "" ? "0" : ""; string sql_workload = "select * from T_WORKLOADSUBMIT where W_PID=" + id + " and W_NAME='" + username + "'"; dd = db.GetDataTable(sql_workload); //数据源 if (dd.Rows.Count > 0) { selfWorkload.Value = "1"; } else { selfWorkload.Value = "0"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; //string id = "44"; DB db = new DB(); DataTable dt = new DataTable(); DataTable t_dt = new DataTable(); if (id != null && id != "") { string sql = "select * from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 string t_sql = "select BUDGETADJUSTCYCLE from T_PLANTEMPLATE_C where TEMPNAME='" + dt.Rows[0]["BUDGETTEMPLATE"].ToString() + "'"; t_dt = db.GetDataTable(t_sql); //数据源 } hd_id.Value = id; if (dt.Rows.Count > 0) { PName.Value = dt.Rows[0]["PNAME"].ToString(); PNumber.Value = dt.Rows[0]["PNUMBER"].ToString(); Remark.Value = dt.Rows[0]["REMARK"].ToString(); planflag.Value = dt.Rows[0]["PLANFLAG"].ToString(); } if (t_dt.Rows.Count > 0) { BUDGETADJUSTDATE_P.Value = DateTime.Now.AddDays(int.Parse(t_dt.Rows[0]["BUDGETADJUSTCYCLE"].ToString())).ToShortDateString().Replace("/", "-"); } } }
public void InsertToQRD() { DB db = new DB(); DataTable dt = db.GetDataTable("select * from T_INSTRUMENT_QRD where 1=2"); DataTable dt2 = db.GetDataTable("select * from T_TABLE where FROMID='" + FROMID + "'"); for (int i = 0; i < dt2.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr["JLQJMC"] = dt2.Rows[i]["JLQJMC"].ToString(); dr["GGXH"] = dt2.Rows[i]["GGXH"].ToString(); dr["JLLB"] = dt2.Rows[i]["JLLB"].ToString(); dr["JDWCSL"] = dt2.Rows[i]["SL"].ToString(); dr["JDHGSL"] = dt2.Rows[i]["SL"].ToString(); dr["JLQJSYDW"] = dt2.Rows[i]["SYDW"].ToString(); dr["JLQJJDDW"] = dt2.Rows[i]["JDDW"].ToString(); dr["JDDJ"] = ""; dr["JDFYHJ"] = ""; dr["TSQKSM"] = dt2.Rows[i]["SM"].ToString(); dt.Rows.Add(dr); } for (int i = 0; i < dt.Rows.Count; i++) { string str_id = "select SEQ_Table.nextval from dual"; string id = db.GetDataTable(str_id).Rows[0][0].ToString(); string sql = "insert into T_INSTRUMENT_QRD (JLQJMC,GGXH,JLLB,JDWCSL,JDHGSL,JLQJSYDW,JLQJJDDW,JDDJ,JDFYHJ,TSQKSM,ID,FROMID) Values('" + dt.Rows[i]["JLQJMC"].ToString() + "','" + dt.Rows[i]["GGXH"].ToString() + "','" + dt.Rows[i]["JLLB"].ToString() + "','" + dt.Rows[i]["JDWCSL"].ToString() + "','" + dt.Rows[i]["JDHGSL"].ToString() + "','" + dt.Rows[i]["JLQJSYDW"].ToString() + "','" + dt.Rows[i]["JLQJJDDW"].ToString() + "','" + dt.Rows[i]["JDDJ"].ToString() + "','" + dt.Rows[i]["JDFYHJ"].ToString() + "','" + dt.Rows[i]["TSQKSM"].ToString() + "','" + id + "','" + FROMID + "')"; db.ExecuteNonQuery(sql); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; string username = Session["username"].ToString(); //string id = "44"; DB db = new DB(); DataTable dt = new DataTable(); DataTable dd = new DataTable(); if (id != null && id != "") { string sql = "select * from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } hd_id.Value = id; if (dt.Rows.Count > 0) { PName.Value = dt.Rows[0]["PNAME"].ToString(); PNumber.Value = dt.Rows[0]["PNUMBER"].ToString(); planflag.Value = dt.Rows[0]["PLANFLAG"].ToString(); string sql_workload = "select W_FILE from T_WORKLOADSUBMIT where W_PID=" + id + " and W_NAME='" + username + "'"; dd = db.GetDataTable(sql_workload); //数据源 if (dd.Rows.Count > 0) { hd_WorkloadFile.Value = dd.Rows[0]["W_FILE"].ToString(); } } } }
private void BrakUpdateForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable("call GetIncumbentName()"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox2.DataSource = dataBase.GetDataTable("select exampleProduct_id as ex from exampleProduct"); comboBox2.DisplayMember = "ex"; comboBox2.ValueMember = "ex"; }
public DataTable LayThongTinPhieuNhapHangTheoHangHoa(string tungay, string denngay) { string sql = string.Format("select pbh.MaPBH as[ChungTu], pbh.NgayLap as [Ngay], ctpbh.MaSanPham as [MaHang], ctpbh.TenSanPham as [TenHang], ctpbh.DonVi as[DonVi], " + "kh.TenKH as [KhoHang], ctpbh.SoLuong as[SoLuong], ctpbh.DonGia as [DonGia], ctpbh.ThanhTien as [ThanhTien], ctpbh.CK as [CK], khang.TenKH as[KhachHang] " + "from PhieuBanHang pbh, CT_Phieu_Ban_Hang ctpbh, KhoHang kh, KhachHang khang " + "where pbh.MaPBH = ctpbh.MaPhieuBanHang and pbh.MaKH = khang.MaKH and pbh.MaKho = kh.MaKH and NgayLap between '{0}' and '{1}'", tungay, denngay); return(db.GetDataTable(sql)); }
private void OperationsInsertForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable("call GetDetailName()"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox2.DataSource = dataBase.GetDataTable("call GetMachineName()"); comboBox2.DisplayMember = "name"; comboBox2.ValueMember = "id"; }
private void MachineInsertForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable("call GetWorckplaceName()"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox2.DataSource = dataBase.GetDataTable("call GetTypeName()"); comboBox2.DisplayMember = "name"; comboBox2.ValueMember = "id"; }
private void ProductInsertForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable("call GetOperationName()"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox3.DataSource = dataBase.GetDataTable("call GetIncumbentName()"); comboBox3.DisplayMember = "name"; comboBox3.ValueMember = "id"; comboBox2.DataSource = dataBase.GetDataTable("select ex.exampleProduct_id as id FROM exampleproduct"); }
private void ExProductUpdateForm_Load(object sender, EventArgs e) { comboBox3.DataSource = dataBase.GetDataTable("call GetIncumbentName()"); comboBox3.DisplayMember = "name"; comboBox3.ValueMember = "id"; comboBox1.DataSource = dataBase.GetDataTable("select d.detail_name as name,d.detail_id as id from detail as d"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; }
private void IncumbentInsertForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable( "select w.work_position_id as id, w.work_position_name as name from work_position as w"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox3.DataSource = dataBase.GetDataTable("select w.workplace_id as id,w.workplace_name as name from workplace as w"); comboBox3.DisplayMember = "name"; comboBox3.ValueMember = "id"; }
private void SetMachineForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable("call GetWorckplaceName()"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox1.Text = _wid; comboBox2.DataSource = dataBase.GetDataTable("call GetTypeName()"); comboBox2.DisplayMember = "name"; comboBox2.ValueMember = "id"; comboBox2.Text = _tid; textBox1.Text = _inv.ToString(); textBox2.Text = _name; label6.Text = id.ToString(); }
private void ProductUpdateForm_Load(object sender, EventArgs e) { comboBox1.DataSource = dataBase.GetDataTable("call GetOperationName()"); comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; comboBox3.DataSource = dataBase.GetDataTable("call GetIncumbentName()"); comboBox3.DisplayMember = "name"; comboBox3.ValueMember = "id"; comboBox2.DataSource = dataBase.GetDataTable("select exampleProduct_id as id FROM exampleproduct"); comboBox2.DisplayMember = "id"; comboBox2.ValueMember = "id"; textBox1.Text = _startDate; label6.Text = _id.ToString(); }
public void createTableExel1() { var excelApp = new Application(); Workbook workBook; Worksheet workSheet; var table = dB.GetDataTable("call GetRealProizvDetail()"); workBook = excelApp.Workbooks.Add(); workSheet = (Worksheet)workBook.Worksheets.get_Item(1); var rng2 = workSheet.Range[workSheet.Cells[1, 1], workSheet.Cells[table.Rows.Count + 1, table.Columns.Count]]; CreateExelTable(table, rng2, workSheet, excelApp); CreateChartObjectP(100, 100, 300, 300, rng2, workSheet, "Диаграмма заверш деталей"); }
protected void Page_Load(object sender, EventArgs e) { string index = Request.Params["index"]; hd_index.Value = index; string id = Request.Params["id"]; string userlevel = Convert.ToString(Session["userlevel"]); userLevel.Value = userlevel; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select GDGG from T_PIPECORROSION where id=" + id; dt = db.GetDataTable(sql); //数据源 if (dt.Rows.Count > 0) { string GDGG = dt.Rows[0]["GDGG"].ToString(); if (GDGG != "") { GDGG = GDGG.Remove(0, 1); string[] sArray1 = GDGG.Split('×'); GDGG1.Value = sArray1[0]; GDGG2.Value = sArray1[1]; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DW.Value = Session["KM"].ToString(); //初始化信息 string x = Context.Request.Params["ID"]; if (x != null) { int ID = Convert.ToInt32(x); DB db = new DB(); DataTable dt = db.GetDataTable("select * from T_INSTRUREPAIR where ID=" + ID); DW.Value = dt.Rows[0]["DW"].ToString(); WXLB.Value = dt.Rows[0]["WXLB"].ToString(); azwz1.Value = dt.Rows[0]["AZWZ"].ToString(); yqybmc1.Value = dt.Rows[0]["YQYBMC"].ToString(); ggxh1.Value = dt.Rows[0]["GGXH"].ToString(); RQ.Value = Convert.ToDateTime(dt.Rows[0]["RQ"].ToString()).ToShortDateString(); TextBox1.Text = dt.Rows[0]["GZXX"].ToString(); SHR.InnerText = "审核人:" + dt.Rows[0]["SHR"].ToString(); SPR.InnerText = "审批人:" + dt.Rows[0]["SPR"].ToString(); AllDisable(); Session["ID"] = ID; Session["DR"] = dt.Rows[0]; } else { int ID = -1; Session["ID"] = ID; } //判断身份 SetControls(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; //string id = "1"; string Name = ""; string Source = ""; string estiInvestment = ""; string checkopinion = ""; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select PNAME,PSOURCE,ESTIINVESTMENT,CHECKOPINION from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } if (dt.Rows.Count > 0) { Name = dt.Rows[0]["PNAME"].ToString(); Source = dt.Rows[0]["PSOURCE"].ToString(); estiInvestment = dt.Rows[0]["ESTIINVESTMENT"].ToString(); checkopinion = dt.Rows[0]["CHECKOPINION"].ToString(); } hd_id.Value = id; PName.Value = Name; PSource.Value = Source; EstiInvestment.Value = estiInvestment; CHECKOPINION.Value = checkopinion; } }
public override DataTable GetSymbolList(string Exchange, string ConditionId, string Key, string Sort, int StartRecords, int MaxRecords) { string Sql = "select distinct a.QuoteCode from StockData a " + GetWhere(Exchange, ConditionId, Key) + " order by a.QuoteCode"; DataTable dt = DB.GetDataTable(Sql, null, StartRecords, MaxRecords); return(dt); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; //string id = "44"; hd_id.Value = id; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select PNAME,PSOURCE,REMARK,DESICHIEF,MAJORPROOFREADER,TEMPLATE_B,to_char(INITIALDESISUBMITDATE_P,'yyyy-mm-dd'),to_char(WORKLOADSUBMITDATE_P,'yyyy-mm-dd'),to_char(MAJORDELEGATEDATE_P,'yyyy-mm-dd') from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } if (dt.Rows.Count > 0) { PName.Value = dt.Rows[0]["PNAME"].ToString(); PSource.Value = dt.Rows[0]["PSOURCE"].ToString(); Remark.Value = dt.Rows[0]["REMARK"].ToString(); DESICHIEF.Value = dt.Rows[0]["DESICHIEF"].ToString(); MAJORPROOFREADER.Value = dt.Rows[0]["MAJORPROOFREADER"].ToString(); MAJORDELEGATEDATE_P.Value = dt.Rows[0]["to_char(MAJORDELEGATEDATE_P,'yyyy-mm-dd')"].ToString(); WORKLOADSUBMITDATE_P.Value = dt.Rows[0]["to_char(WORKLOADSUBMITDATE_P,'yyyy-mm-dd')"].ToString(); INITIALDESISUBMITDATE_P.Value = dt.Rows[0]["to_char(INITIALDESISUBMITDATE_P,'yyyy-mm-dd')"].ToString(); PTemplate.Value = dt.Rows[0]["TEMPLATE_B"].ToString(); } } }
protected void GetActiveCustomers_Click(object sender, EventArgs e) { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; string NoActiveUsersList = Server.MapPath("../../") + @"\App_Data\NoActiveUsersList.txt"; string[] lines = File.ReadAllLines(NoActiveUsersList); Hashtable NoActiveUsersTable = new Hashtable(); foreach (string line in lines) { NoActiveUsersTable[line] = true; } Util util = new Util(); try { //Instantiate an instance of license and set the license file through its path string query = "SELECT * FROM customers WHERE last_use_date_time>SUBDATE(NOW(),INTERVAL " + ActiveUsersDaysLoggedIn.Text + " DAY) AND n_logins>=" + ActiveUsersMinNLogins.Text; DB db = new DB(); DataTable myDataTable = db.GetDataTable(query); Grid.DataSource = myDataTable; Grid.DataBind(); Grid.MasterTableView.ExportToExcel(); } catch (Exception ex) { util.ProcessMainExceptions(State, Response, ex); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; //string id = "44"; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select PNAME,PNUMBER,REMARK,PLANFLAG,DESIAPPROVALARRIVALFILENUMBER,DESIAPPRFILE,to_char(DESIAPPROVALARRIVALDATE,'yyyy-mm-dd') from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } hd_id.Value = id; if (dt.Rows.Count > 0) { PName.Value = dt.Rows[0]["PNAME"].ToString(); PNumber.Value = dt.Rows[0]["PNUMBER"].ToString(); Remark.Value = dt.Rows[0]["REMARK"].ToString(); hd_planflag.Value = dt.Rows[0]["PLANFLAG"].ToString(); DESIAPPROVALARRIVALFILENUMBER.Value = dt.Rows[0]["DESIAPPROVALARRIVALFILENUMBER"].ToString(); DESIAPPROVALARRIVALDATE.Value = dt.Rows[0]["to_char(DESIAPPROVALARRIVALDATE,'yyyy-mm-dd')"].ToString(); hd_DesiApprFile.Value = dt.Rows[0]["DESIAPPRFILE"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Session["username"] != null && Session["userpwd"] != null) { Label1.Visible = true; user.Visible = true; number.Visible = true; user.Text = Session["username"].ToString(); string dbj = "未读"; string sqlstr = "select * from b_message where jsf='" + Session["username"].ToString() + "'and dbj='" + dbj + "'"; DB db = new DB(); DataTable dt = new DataTable(); dt = db.GetDataTable(sqlstr); number.Text = dt.Rows.Count.ToString();//判断是否已经存在数据如果已经存在执行语句,并将结果回number } else { tuichu.Visible = false; ToMessage.Visible = false; Label1.Visible = true; user.Visible = false; number.Visible = false; } } //DB db1 = new DB(); //string sql_getGonggao = "select nr from (select rownum rn, t.* from B_gonggao t order by fsrq desc) t1 where t1.rn=1"; //System.Data.DataTable dt1 = db1.GetDataTable(sql_getGonggao); bind(); }
public DataTable LayThongTinTonKho() { string sql = "select hh.MaHH as[MaHang], kh.TenKH as [KhoHang], hh.TenHH as [TenHang], dv.TenDVT as[DonVi], hh.TonKhoHienTai as[SoLuong], nh.Ten_NH as[NhomHang], hh.ConQuanLy " + " from KhoHang kh, HangHoa hh, DonViTinh dv, NhomHang nh where kh.MaKH = hh.MaKho and hh.MaDV = dv.MaDVT and hh.MaNH = nh.Ma_NH "; return(db.GetDataTable(sql)); }
public static void ClearTimeOfHistoricalData(object Sender) { DataTable dt = DB.GetDataTable("select QuoteCode from stockdata"); DBDataManager ddm = new DBDataManager(); for (int j = 0; j < dt.Rows.Count; j++) { DataRow dr = dt.Rows[j]; string Code = dr["QuoteCode"].ToString(); try { CommonDataProvider cdp = (CommonDataProvider)ddm[Code]; cdp.TrimTime(); cdp.SaveBinary(DBDataManager.GetHisDataFile(Code)); Thread.Sleep(1); if ((j % 100) == 0) { Tools.Log("Clear time of historical data progress:" + j + "/" + dt.Rows.Count); } } catch (Exception e) { Tools.Log("Clear time of histoical data:" + Code + ";" + e); throw; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; string username = Session["username"].ToString(); //string id = "44"; string Name = ""; DB db = new DB(); DataTable dt = new DataTable(); DataTable dd = new DataTable(); if (id != null && id != "") { string sql = "select PNAME from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } if (dt.Rows.Count > 0) { Name = dt.Rows[0]["PNAME"].ToString(); } hd_id.Value = id; H_PName.Value = Name; userName.Value = username; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; //string id = "44"; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select * from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } hd_id.Value = id; if (dt.Rows.Count > 0) { PName.Value = dt.Rows[0]["PNAME"].ToString(); PNumber.Value = dt.Rows[0]["PNUMBER"].ToString(); DESIAPPRFILE.Value = dt.Rows[0]["DESIAPPRFILE"].ToString(); Remark.Value = dt.Rows[0]["REMARK"].ToString(); planflag.Value = dt.Rows[0]["PLANFLAG"].ToString(); hd_FinalBudgetFile.Value = dt.Rows[0]["FINALBUDGETFILE"].ToString(); } } }
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "hf") { if (Session["UserName"] != null && Session["Userpwd"] != null) { HFNAME.Visible = true; string userlevel = (string)Session["userlevel"].ToString(); string username = (string)Session["UserName"].ToString(); this.HFNAME.Text = username; ID.Text = Request["id"]; string index = Request.Params["index"]; if (index != "" && userlevel != "普通用户") { this.form1.Attributes.Add("ReadOnly", "true"); ID.Text = (Convert.ToInt32(index + 1)).ToString(); } string sql = "select BT from B_card where id='" + ID.Text + "'"; DB db = new DB(); DataTable dt = new DataTable(); dt = db.GetDataTable(sql); this.BT.Text = (string)dt.Rows[0]["BT"]; } else { Response.Write("<script> alert('请先进行登录!');</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { string username = Session["username"].ToString(); string userlevel = Session["userlevel"].ToString(); userLevel.Value = userlevel; km.Value = Session["km"].ToString(); if (userlevel != "3") { string pid = Request.Params["id"].ToString(); PID.Value = pid; string sql = "select * from T_PLANRUN_DTZ where PID=" + pid; DB db = new DB(); DataTable dt = db.GetDataTable(sql); if (dt.Rows[0]["SOLUCHIEF"].ToString() == username || dt.Rows[0]["DESICHIEF"].ToString() == username) { jurisdiction.Value = "1";//确定权限,如果为方案负责人或设计负责人可以进行添加删除修改操作 } else { jurisdiction.Value = "0"; } } else { PID.Value = ""; jurisdiction.Value = "0"; } }
protected void Page_Load(object sender, EventArgs e) { string index = Request.Params["index"]; string id = Request.Params["id"]; hd_index.Value = index; string userlevel = Convert.ToString(Session["userlevel"]); userLevel.Value = userlevel; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select GGXH from T_HEATER where id=" + id; dt = db.GetDataTable(sql); //数据源 } if (dt.Rows.Count > 0) { string GGXH = dt.Rows[0]["GGXH"].ToString(); if (GGXH != "") { GGXH = GGXH.Remove(0, 1); string[] sArray = GGXH.Split('×'); GGXH1.Value = sArray[0]; GGXH2.Value = sArray[1]; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["id"]; //string id = "44"; DB db = new DB(); DataTable dt = new DataTable(); if (id != null && id != "") { string sql = "select PNAME,PNUMBER,WORKLOADFILE,DRAFTBUDGETFILE,REMARK,PLANFLAG,to_char(INITIALDESISUBMITDATE_R,'yyyy-mm-dd') from T_PLANRUN_DTZ where PID=" + id; dt = db.GetDataTable(sql); //数据源 } hd_id.Value = id; if (dt.Rows.Count > 0) { PName.Value = dt.Rows[0]["PNAME"].ToString(); PNumber.Value = dt.Rows[0]["PNUMBER"].ToString(); DraftBudgetFile.Value = dt.Rows[0]["DRAFTBUDGETFILE"].ToString(); Remark.Value = dt.Rows[0]["REMARK"].ToString(); hd_planflag.Value = dt.Rows[0]["PLANFLAG"].ToString(); InitialDesiSubmitDate_R.Value = dt.Rows[0]["to_char(INITIALDESISUBMITDATE_R,'yyyy-mm-dd')"].ToString(); } } }
private void LoadData() { try { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; DB db = new DB(); DataTable myDataTable = db.GetDataTable("SELECT application_name, application_type, date_time_modified, production_date_time, status FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name"); if (myDataTable.Rows.Count == 0) { FirstView.Style.Value = "text-align:-moz-center"; NormalView.Style.Value = "display:none"; InfoTable.Style.Value = "display:none"; MySolutions.DataSourceID = String.Empty; MySolutions.DataBind(); return; } Util util = new Util(); foreach (DataColumn column in myDataTable.Columns) { if(column.ColumnName.StartsWith("application")) column.ColumnName = column.ColumnName.Replace("application", "app"); column.ColumnName = util.CapitalizeWords(column.ColumnName.Replace("_", " ")); } //modify status values foreach(DataRow row in myDataTable.Rows) { row[myDataTable.Columns.Count - 1] = row[myDataTable.Columns.Count - 1].ToString().Replace("/", " / "); } //add delete column with each row getting an event myDataTable.Columns.Add(new DataColumn("x")); MySolutions.DataSource = myDataTable; MySolutions.DataBind(); int index = 0; foreach (GridDataItem row in MySolutions.Items) { ImageButton delete_button = new ImageButton(); delete_button.ImageUrl = "~/images/delete_small.gif"; delete_button.ID = "delete." + index.ToString(); delete_button.ToolTip = "Delete this App"; index++; delete_button.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this app?');"); int delete_cell_index = row.Cells.Count - 1; row.Cells[delete_cell_index].Controls.Add(delete_button); } } catch (Exception ex) { throw new Exception(ex.Message + ": " + ex.StackTrace); } }
protected void ViewAllCustomers_Click(object sender, EventArgs e) { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; Util util = new Util(); try { //Instantiate an instance of license and set the license file through its path string query = "SELECT first_name, last_name, company, email, username, phone , registration_date_time FROM customers "; DB db = new DB(); DataTable myDataTable = db.GetDataTable(query); Grid.DataSource = myDataTable; Grid.DataBind(); Grid.MasterTableView.ExportToExcel(); } catch (Exception ex) { util.ProcessMainExceptions(State, Response, ex); } }
public static void Init() { Console.WindowWidth = Console.LargestWindowWidth - 25; Console.WindowHeight = Console.LargestWindowHeight - 25; Console.Title = "SkypeStats - Debug Console"; Out.WritePlain("SkypeStats by JariZ"); Out.WriteBlank(); AddStats(); Out.WriteLine("Searching for skype databases..."); string[] Accounts = GetAccounts(); TaskDialog chooser = new TaskDialog(); chooser.InstructionText = "The following accounts were found on this computer"; chooser.Text = "SkypeStats has found several accounts, which one do you want to analyse?"; chooser.FooterCheckBoxText = "Load entire DB into memory and max out cache"; string Account = ""; foreach (string account in Accounts) { TaskDialogCommandLink link = new TaskDialogCommandLink(Path.GetFileName(account), Path.GetFileName(account)); link.Click += delegate(object send, EventArgs args) { Account = ((TaskDialogCommandLink)send).Name; chooser.Close(); }; chooser.Controls.Add(link); } chooser.FooterText = "Loading everything into memory might be faster but requires a lot of RAM, only choose this if you know what you're doing"; chooser.FooterIcon = TaskDialogStandardIcon.Information; chooser.Show(); MaxedOutMode = chooser.FooterCheckBoxChecked; Core.Account = Account; DatabasePath = SkypeAppData + "\\" + Account + "\\main.db"; if (!File.Exists(DatabasePath)) Failure("Database file not found, restart SkypeStats"); Out.WriteDebug("DB path is " + DatabasePath + " and exists"); Out.WriteDebug("Connecting to DB..."); try { Database = new DB(DatabasePath); } catch(Exception z) { Out.WriteDebug("UNABLE TO CONNECT TO DB:"); Out.WriteError(z.ToString(), z); Failure("Unable to connect to database file: " + z.Message); } Out.WriteLine("Successfully connected to DB!"); ProgressDialog progress = null; if (ProgDiag) { Out.WriteDebug("Init progressdialog..."); progress = new ProgressDialog(IntPtr.Zero); progress.Title = "SkypeStats"; progress.Line1 = "Initializing..."; progress.Line2 = " "; progress.Line3 = " "; progress.ShowDialog(); //wait for progdiag to show up Thread.Sleep(1000); } else { Thread splash = new Thread(SplashThread); splash.SetApartmentState(ApartmentState.STA); splash.Start(); while (Splash == null) { } } Out.WriteDebug("Counting messages...."); if (ProgDiag) { progress.Line1 = "Counting messages..."; progress.Value = 1337; } else { Splash.Status = "Counting messages..."; Splash.Value = 1337; } MessageCount = Convert.ToInt32(Database.ExecuteScalar("SELECT COUNT(*) FROM Messages")); Out.WriteLine(MessageCount + " messages found!"); Out.WriteDebug("Counting conversations...."); if (ProgDiag) { progress.Line1 = "Counting conversations..."; progress.Value = 1337; } else { Splash.Status = "Counting conversations..."; Splash.Value = 1337; } ConvoCount = Convert.ToInt32(Database.ExecuteScalar("SELECT COUNT(*) FROM Conversations")); Out.WriteLine(ConvoCount + " conversations found!"); Out.WriteDebug("Counting contacts...."); if (ProgDiag) { progress.Line1 = "Counting contacts..."; progress.Value = 1337; } else { Splash.Status = "Counting contacts..."; Splash.Value = 1337; } ContactCount = Convert.ToInt32(Database.ExecuteScalar("SELECT COUNT(*) FROM Contacts")); Out.WriteLine(ContactCount + " contacts found!"); AnalysisStart = DateTime.Now; Out.WriteLine("Analysis started @ " + AnalysisStart.ToLongTimeString()); Out.WriteLine("Analysing contacts..."); if (ProgDiag) { progress.Line1 = "Analysing contacts..."; progress.Maximum = Convert.ToUInt32(ContactCount); progress.Value = 0; } else { Splash.Status = "Analysing contacts..."; Splash.Maximum = ContactCount; Splash.Value = 0; } int limit = 0; int step = 1000; if (MaxedOutMode == true) step = int.MaxValue; string columns = Columns(ColumnType.Contact); Out.WriteDebug("Using " + columns + " columns."); while (limit < ContactCount) { string query = string.Format("SELECT {0} FROM Contacts LIMIT {1},{2}", columns, limit, limit + step); DataTable dt = Database.GetDataTable(query); foreach (DataRow row in dt.Rows) { foreach (Stat stat in Stats) { stat.RunContactStep(row); } } limit += step; if (ProgDiag) progress.Value += Convert.ToUInt32(step); else Splash.AddValue(step); } Out.WriteLine("Analysing conversations..."); if (ProgDiag) { progress.Line1 = "Analysing conversations..."; progress.Maximum = Convert.ToUInt32(ConvoCount); progress.Value = 0; } else { Splash.Status = "Analysing conversations..."; Splash.Maximum = ConvoCount; Splash.Value = 0; } limit = 0; step = 1000; if (MaxedOutMode == true) step = int.MaxValue; columns = Columns(ColumnType.Convo); Out.WriteDebug("Using " + columns + " columns."); while (limit < ConvoCount) { string query = string.Format("SELECT {0} FROM Conversations WHERE type = 1 LIMIT {1},{2}", columns, limit, limit + step); DataTable dt = Database.GetDataTable(query); foreach (DataRow row in dt.Rows) { foreach (Stat stat in Stats) { stat.RunConversationStep(row); } } limit += step; if (ProgDiag) progress.Value += Convert.ToUInt32(step); else Splash.AddValue(step); } Out.WriteLine("Analysing messages..."); if (ProgDiag) { progress.Line1 = "Analysing messages..."; progress.Maximum = Convert.ToUInt32(MessageCount); progress.Value = 0; } else { Splash.Status = "Analysing messages..."; Splash.Maximum = MessageCount; Splash.Value = 0; } limit = 0; step = 10000; if (MaxedOutMode == true) step = int.MaxValue; columns = Columns(ColumnType.Message); Out.WriteDebug("Using " + columns + " columns."); while (limit < MessageCount) { string query = string.Format("SELECT {0} FROM Messages LIMIT {1},{2}", columns, limit, limit + step); DataTable dt = Database.GetDataTable(query); foreach (DataRow row in dt.Rows) { foreach (Stat stat in Stats) { stat.RunMessageStep(row); } } limit += step; if (ProgDiag) progress.Value += Convert.ToUInt32(step); else Splash.AddValue(step); } AnalysisFinish = DateTime.Now; DateTime difference = new DateTime(AnalysisFinish.Ticks - AnalysisStart.Ticks); Out.WriteLine(string.Format("Analysis finished in {0}s {1}ms", difference.Second, difference.Millisecond)); if (ProgDiag) progress.CloseDialog(); else Splash.Kill(); System.Windows.Forms.Application.Run(new SkypeStats()); }