public Uer(int Uid) { string cmd = "select * from uer where 1=1 and uer_id=" + Uid; Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled) { DataTable _dtuser = ds.DtOut; if (_dtuser.Rows.Count == 1) { _exist = true; _id = Convert.ToInt32(_dtuser.Rows[0]["uer_id"]); _lvl = Convert.ToInt32(_dtuser.Rows[0]["uer_lvl"]); _psw = _dtuser.Rows[0]["psw"].ToString(); _name = _dtuser.Rows[0]["uer_name"].ToString(); _no = _dtuser.Rows[0]["uer_no"].ToString(); _state = Convert.ToBoolean(_dtuser.Rows[0]["state"]); _dep_id = Convert.ToInt32(_dtuser.Rows[0]["dep_id"]); } } else { throw new Exception("err on creat uer by id"); } }
protected void no_list(string icmd = "") { this.No.Items.Clear(); try { this.Payfrom.Text = _dep.DeName; DataTable dt = new DataTable(); string cmd; if (icmd == "") { cmd = "select * from depno where state = 1 and dep_id = " + _dep.DeId; } else { cmd = "select * from depno where state = 1 and dep_id = " + _dep.DeId + "and ( no_name like '%" + icmd + "%' or no like '%" + icmd + "%')"; } publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd); if (ds.Sqled) { dt = ds.DtOut; foreach (DataRow r in dt.Rows) { ListItem lit = new ListItem(); lit.Text = r["no_name"].ToString() + "(" + r["no"].ToString() + ")"; lit.Value = r["no_id"].ToString(); No.Items.Add(lit); } } } catch { } }
protected void format_DropDownList(string _cmd, DropDownList _list, int[] _txt_index, int val_index, int select_key) { _list.Items.Clear(); _list.SelectedIndex = -1; publicClass.Dosql ds = new publicClass.Dosql(); DataTable temp = new DataTable(); ds.DoRe(_cmd); if (ds.Sqled) { temp = ds.DtOut; } ListItem it = new ListItem(); it.Text = "全部"; it.Value = 0.ToString(); _list.Items.Add(it); foreach (DataRow r in temp.Rows) { it = new ListItem(); foreach (int i in _txt_index) { it.Text += r[i] + ","; } it.Text = it.Text.Substring(0, it.Text.Length - 1); it.Value = r[val_index].ToString(); if (it.Value == select_key.ToString()) { it.Selected = true; } _list.Items.Add(it); } }
protected void Page_Load(object sender, EventArgs e) { try { _uer = new publicClass.Uer(Convert.ToInt32(Session["uer_id"])); _dep = new publicClass.Dep(_uer.Udep_id); string cmd_yj = "select top 1 m_date_word from m_state where 1=1 and m_dep_id= " + _uer.Udep_id + "order by m_s_id desc"; publicClass.MSE mse = new publicClass.MSE(DateTime.Now); string cmd_bysr = string.Format("select case when sum(amount) is null then 0 else sum(amount) end from bill where bill_type=1 and isfiled =1 and make_date between '{0}' and '{1}'", mse.S, mse.E); string cmd_byzc = string.Format("select case when sum(amount) is null then 0 else sum(amount) end from bill where bill_type=2 and isfiled =1 and make_date between '{0}' and '{1}'", mse.S, mse.E);; string cmd_zyzh = "select count(*) from depno where 1=1 and state=1"; string cmd_wldw = "select count(*) from exc_dep where 1=1 and state=1"; string cmd_dy = "select count(*) from bill where isfiled=1 and prnt=0"; string cmd_sp = "select count(*) from bill where op=" + _uer.Ulvl; string cmd_gd = "select count(*) from bill where op=5 and isfiled =0"; string str_where = " and dep_id= " + _uer.Udep_id; if (_uer.Ulvl <= 2) { cmd_bysr += " and payfrom = " + _uer.Udep_id; cmd_byzc += " and payfrom =" + _uer.Udep_id; cmd_zyzh += str_where; cmd_wldw += str_where;; cmd_dy += " and payfrom = " + _uer.Udep_id; cmd_sp += " and payfrom = " + _uer.Udep_id; cmd_gd += " and payfrom = " + _uer.Udep_id; } publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd_yj); yj_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_bysr); bysr_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_byzc); byzc_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_zyzh); zyzh_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_wldw); wldw_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_dy); dy_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_sp); sp_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_gd); gd_lab.Text = ds.DtOut.Rows[0][0].ToString(); dbsx_lal.Text = (Convert.ToInt32(sp_lab.Text) + Convert.ToInt32(dy_lab.Text) + Convert.ToInt32(gd_lab.Text)).ToString(); sz_lab.Text = (Convert.ToDecimal(bysr_lab.Text) - Convert.ToDecimal(byzc_lab.Text)).ToString(); sp_img.Text = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(sp_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString()); gd_img.Text = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(gd_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString()); dy_img.Text = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(dy_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString()); } catch (Exception ex) { } }
protected void creat_dep_list() { string cmd; if (Session["sigadmin_deplist_cmd"] == null) { cmd = "select * from dep"; } else { cmd = Session["sigadmin_deplist_cmd"].ToString(); } try { publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd); if (ds.Sqled) { foreach (DataRow r in ds.DtOut.Rows) { ListItem it = new ListItem(r["dep_name"].ToString(), r["dep_id"].ToString()); dep_list.Items.Add(it); } } } catch { } }
protected void creat_sig_list() { this.sig_list.Items.Clear(); if (Session["sigadmin_list"] == null) { list_str = "select * from sig"; } else { list_str = Session["sigadmin_list"].ToString(); } try { publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(list_str); if (ds.Sqled) { foreach (DataRow r in ds.DtOut.Rows) { ListItem it = new ListItem(r["sig_name"].ToString(), r["sig_id"].ToString()); sig_list.Items.Add(it); } } } catch (Exception ex) { } }
protected void payto_list(string cmd_str = "") { try { this.payto_saerch_list.Items.Clear(); DataTable dt = new DataTable(); string cmd; if (cmd_str == "") { cmd = "select * from exc_dep where state = 1 and dep_id = " + _dep.DeId; } else { cmd = "select * from exc_dep where state = 1 and dep_id = " + _dep.DeId + "and ( edep_name like '%" + cmd_str + "%' or edep_no like '%" + cmd_str + "%')"; } publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd); if (ds.Sqled) { dt = ds.DtOut; foreach (DataRow r in dt.Rows) { ListItem lit = new ListItem(); lit.Text = r["edep_name"].ToString() + "(" + r["edep_no"].ToString() + ")"; lit.Value = r["edep_id"].ToString(); payto_saerch_list.Items.Add(lit); } } } catch { publicClass.calljs.alert(this, "页面参数有误!"); } }
protected void creat_user_list() { this.user_list.Items.Clear(); if (Session["admin_user_list_str"] == null) { user_list_str = "select * from [uer]"; } else { user_list_str = Session["admin_user_list_str"].ToString(); } try { publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(user_list_str); if (ds.Sqled) { foreach (DataRow r in ds.DtOut.Rows) { ListItem it = new ListItem(r["uer_name"].ToString() + "(" + r["uer_no"].ToString() + ")", r["uer_id"].ToString()); this.user_list.Items.Add(it); } } } catch { } }
protected void creat_info_list() { try { string cmd_pde_no_list = "select * from depno where dep_id=" + _uer.Udep_id; string cmd_minfo = "select * from m_info where dep_id=" + _uer.Udep_id + "and m_date_word like '" + m_state + "'"; publicClass.Dosql ds = new publicClass.Dosql(); DataTable dt_dep_no_list, dt_out, dt_minfo; ds.DoRe(cmd_pde_no_list); dt_dep_no_list = ds.DtOut; ds = new publicClass.Dosql(); ds.DoRe(cmd_minfo); dt_minfo = ds.DtOut; dt_out = new DataTable(); dt_out.Columns.Add("no_id"); dt_out.Columns.Add("no"); dt_out.Columns.Add("state"); dt_out.Columns.Add("m_date_word"); dt_out.Columns.Add("qcye"); dt_out.Columns.Add("bqsr"); dt_out.Columns.Add("bqzc"); dt_out.Columns.Add("qmye"); foreach (DataRow dr in dt_dep_no_list.Rows) { DataRow in_dr = dt_out.NewRow(); in_dr["no_id"] = dr["no_id"]; in_dr["no"] = dr["no"]; in_dr["state"] = Convert.ToBoolean(dr["state"])?"启用":"停用"; in_dr["m_date_word"] = (temp[1] == 12 ? temp[0] + 1 : temp[0]).ToString() + "-" + (temp[1] == 12 ? 1 : temp[1] + 1).ToString(); DataRow[] r = dt_minfo.Select("no_id=" + dr["no_id"]); if (r.Length == 0) { in_dr["qcye"] = Convert.ToDecimal("0.00"); } else { in_dr["qcye"] = Convert.ToDecimal(r[0][8].ToString()); } publicClass.MSE mse = new publicClass.MSE(Convert.ToDateTime((temp[1] == 12 ? temp[0] + 1 : temp[0]).ToString() + "-" + (temp[1] == 12 ? 1 : temp[1] + 1).ToString() + "-25")); string cmd_bqsr = string.Format("select sum(amount) from bill where payfrom={0} and payto=-1 and isfiled =1 and make_date between '{1}' and '{2}' and payfrom_no = {3}", _uer.Udep_id, mse.S, mse.E, dr["no_id"]); string cmd_bqzc = string.Format("select sum(amount) from bill where payfrom={0} and payto<>-1 and isfiled =1 and make_date between '{1}' and '{2}' and payfrom_no = {3}", _uer.Udep_id, mse.S, mse.E, dr["no_id"]); ds = new publicClass.Dosql(); ds.DoRe(cmd_bqsr); in_dr["bqsr"] = Convert.ToDecimal(ds.DtOut.Rows[0][0].ToString() == ""? "0.00" : ds.DtOut.Rows[0][0].ToString()); ds = new publicClass.Dosql(); ds.DoRe(cmd_bqzc); in_dr["bqzc"] = Convert.ToDecimal(ds.DtOut.Rows[0][0].ToString() == "" ? "0.00" : ds.DtOut.Rows[0][0].ToString()); in_dr["qmye"] = Convert.ToDecimal(in_dr["bqsr"]) + Convert.ToDecimal(in_dr["qcye"]) - Convert.ToDecimal(in_dr["bqzc"]); dt_out.Rows.Add(in_dr); } this.m_info.DataSource = dt_out; this.m_info.DataBind(); } catch (Exception ex) { } }
private void list(string cmd) { string cmdstr = cmd == "" ? "select * from exc_dep where dep_id =" + this.headbar.Uer.Udep_id + "order by edep_id desc": cmd; DataTable listdata = new DataTable(); publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmdstr); if (ds.Sqled) { this.Repeater1.DataSource = ds.DtOut; this.Repeater1.DataBind(); } }
protected void oplist() { try { string list_str = string.Format("select a.* ,b.uer_name from (select * from op where 1=1 and bill_id={0} )a left join uer b on a.uer_id=b.uer_id order by a.op_id asc", _bill.Bill_id); publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(list_str); OP_list.DataSource = ds.DtOut; OP_list.DataBind(); } catch { } }
protected void Mstateinfo(int y) { try { string cmd = string.Format("select a.* ,b.no from(select * from m_info where dep_id={0} and ms_date between '{1}-1-01' and '{2}-12-31') a left join depno b on a.no_id =b.no_id order by a.no_id desc,a.ms_date asc ", _uer.Udep_id, y, y); publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd); this.m_info.DataSource = ds.DtOut; this.m_info.DataBind(); } catch { } }
public bill(int id) { string cmd = "select * from bill where 1=1 and bill_id=" + id; Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled) { DataTable _dtuser = ds.DtOut; if (_dtuser.Rows.Count == 1) { //int 9 _bill_id = Convert.ToInt32(_dtuser.Rows[0]["bill_id"]); _bill_id_body = Convert.ToInt32(_dtuser.Rows[0]["bill_id_body"]); _bill_type = Convert.ToInt32(_dtuser.Rows[0]["bill_type"]); _payfrom = Convert.ToInt32(_dtuser.Rows[0]["payfrom"]); _payto = Convert.ToInt32(_dtuser.Rows[0]["payto"]); _prnt = Convert.ToInt32(_dtuser.Rows[0]["prnt"]); _op = Convert.ToInt32(_dtuser.Rows[0]["op"]); //_dep_id = Convert.ToInt32(_dtuser.Rows[0]["dep_id"]); _payfrom_no = Convert.ToInt32(_dtuser.Rows[0]["payfrom_no"]); _payto_no = Convert.ToInt32(_dtuser.Rows[0]["payto_no"]); _maker = Convert.ToInt32(_dtuser.Rows[0]["maker"]); // decimal 1 _amount = Convert.ToDecimal(_dtuser.Rows[0]["amount"]); //string 3 _bill_id_head = _dtuser.Rows[0]["bill_id_head"].ToString(); _summary = _dtuser.Rows[0]["summary"].ToString(); _secret = _dtuser.Rows[0]["secret"].ToString(); //boolean 3 _isdel = Convert.ToBoolean(_dtuser.Rows[0]["isdel"]); _iscx = Convert.ToBoolean(_dtuser.Rows[0]["iscx"]); _isfiled = Convert.ToBoolean(_dtuser.Rows[0]["isfiled"]); //datetime 1 _make_date = Convert.ToDateTime(_dtuser.Rows[0]["make_date"]); _true_date = Convert.ToDateTime(_dtuser.Rows[0]["truedate"]); } } else { throw new Exception("err on creat sig by id"); } }
protected void OK_Click(object sender, EventArgs e) { try { string cmd_chk_date = "select top 1 * from m_state where m_dep_id =" + _uer.Udep_id + " order by m_s_id desc"; publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd_chk_date); DateTime m_date = Convert.ToDateTime(ds.DtOut.Rows[0]["m_date"]); if (Convert.ToDateTime(make_date_txt.Text) <= m_date) { publicClass.calljs.alert(this, "选择的填单日期已月结,请取消月结后在尝试填写票据!"); return; } publicClass.bill _bill = new publicClass.bill(); _bill.Bill_id_head = ""; _bill.Bill_id_body = 0; _bill.Bill_type = 1; _bill.Payfrom = _uer.Udep_id; _bill.Payto = -1; _bill.Amount = Convert.ToDecimal(this.Amount.Text); _bill.Summary = Summary.Text; _bill.Maker = _uer.Uid; _bill.Make_date = Convert.ToDateTime(make_date_txt.Text); _bill.Isdel = false; _bill.Iscx = false; _bill.Prnt = 0; _bill.Op = 1; //_bill.Dep_id = _uer.Udep_id; _bill.Secret = ""; _bill.Payfrom_no = Convert.ToInt32(this.No.SelectedValue); _bill.Payto_no = -1; _bill.Isfiled = false; _bill.Truedate = DateTime.Now; _bill.save(); publicClass.calljs.alert(this, "保存成功"); this.Amount.Text = ""; this.Summary.Text = ""; Response.Redirect("review.aspx"); } catch (Exception ex) { publicClass.calljs.alert(this, "填写项错误,单据保存失败!"); } }
protected void creat_siglist() { try { this.sigs.Items.Clear(); this.sigs.Items.Add(new ListItem("请选择", "-1")); string cmd_siglist = string.Format("select * from sig where state=1 and dep_id={0} and lvl={1}", _uer.Udep_id, _uer.Ulvl); publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd_siglist); foreach (DataRow r in ds.DtOut.Rows) { ListItem lt = new ListItem(r["sig_name"].ToString(), r["sig_id"].ToString()); sigs.Items.Add(lt); } } catch { } }
public dep_no(int id) { string cmd = "select * from depno where 1=1 and no_id=" + id; publicClass.Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled && ds.DtOut.Rows.Count >= 1) { _no = ds.DtOut.Rows[0][2].ToString(); _no_name = ds.DtOut.Rows[0][1].ToString(); _summary = ds.DtOut.Rows[0][5].ToString(); _status = Convert.ToBoolean(ds.DtOut.Rows[0][3].ToString()); _dep_id = Convert.ToInt32(ds.DtOut.Rows[0][4].ToString()); } else { throw new Exception("creat dep_no err!"); } }
public Note(int id) { string cmd = "select * from note where 1=1 and uer_id=" + id; Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled) { DataTable _dtuser = ds.DtOut; if (_dtuser.Rows.Count == 1) { _note_id = Convert.ToInt32(_dtuser.Rows[0]["note_id"]); _word = _dtuser.Rows[0]["word"].ToString(); } } else { throw new Exception("err on creat note by id"); } }
private void InsertImg(PdfContentByte cb, int b_id, AcroFields f1) { try { string cmd_op_list = "select * from op where bill_id=" + b_id; publicClass.Dosql ds = new publicClass.Dosql(); publicClass.sig sig = null; ds.DoRe(cmd_op_list); string oper = "审批人:\n"; foreach (DataRow r in ds.DtOut.Rows) { if (Convert.ToInt16(r["lvl"]) <= 2) { sig = new publicClass.sig(Convert.ToInt32(r["sig_id"])); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(publicClass.Sigformat.ToImage(sig.Sig_word), new BaseColor(255, 255, 255)); img.Transparency = new int[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; if (Convert.ToInt16(r["lvl"]) == 1) { img.SetAbsolutePosition(100, 80); img.ScaleToFit(100f, 100f); } else { img.SetAbsolutePosition(200, 100); img.ScaleToFit(50f, 50f); } cb.AddImage(img); cb.AddImage(img); } else { } oper += new publicClass.Uer(Convert.ToInt32(r["uer_id"])).Uname + "\n"; } f1.SetField("sp", oper); } catch { } }
protected void creat_summary() { try { string cmd = "select top 1 m_date_word from m_state where m_dep_id=" + _uer.Udep_id + "order by m_s_id desc"; publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd); string done = ""; if (ds.Sqled && ds.DtOut.Rows.Count == 1) { m_state = ds.DtOut.Rows[0][0].ToString(); temp = new int[] { Convert.ToInt16(m_state.Split('-')[0]), Convert.ToInt16(m_state.Split('-')[1]) }; done = string.Format("本部门已经月结至{0}年{1}月,当前操作账期为{2}年{3}月", temp[0], temp[1], temp[1] == 12 ? temp[0] + 1 : temp[0], temp[1] == 12 ? 1 : temp[1] + 1); } this.summary.Text = done; } catch { this.summary.Text = "调取日结状态出错!"; } }
protected void startup() { string cmd_u_list = "select * from uer"; string cmd_k_list = "select * from [key]"; publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd_k_list); KEY_list.Items.Clear(); u_list.Items.Clear(); foreach (DataRow r in ds.DtOut.Rows) { ListItem lt = new ListItem(r[4].ToString(), r[0].ToString()); this.KEY_list.Items.Add(lt); } ds = new publicClass.Dosql(); ds.DoRe(cmd_u_list); foreach (DataRow r in ds.DtOut.Rows) { ListItem lt = new ListItem(r[2].ToString(), r[0].ToString()); this.u_list.Items.Add(lt); } }
protected void startup() { try { string where_str = Session["countinfo_wherestr"].ToString(); where_str += " and isfiled =1"; string cds = "select count(*) from bill where bill_type=1 " + where_str; string cdhj = "select (case when sum(amount) is null then 0 else sum(amount) end) from bill where bill_type=1" + where_str; string zps = "select count(*) from bill where bill_type=2" + where_str; string zphj = "select (case when sum(amount) is null then 0 else sum(amount) end) from bill where bill_type=2" + where_str; int cds_int, zps_int; decimal ckhj_je, zphj_je; publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cds); cds_int = Convert.ToInt16(ds.DtOut.Rows[0][0].ToString()); ds = new publicClass.Dosql(); ds.DoRe(cdhj); ckhj_je = Convert.ToDecimal(ds.DtOut.Rows[0][0]); ds = new publicClass.Dosql(); ds.DoRe(zps); zps_int = Convert.ToInt16(ds.DtOut.Rows[0][0].ToString()); ds = new publicClass.Dosql(); ds.DoRe(zphj); zphj_je = Convert.ToDecimal(ds.DtOut.Rows[0][0]); info_table.Text = string.Format("当前汇总区间内包含:<br>存单{0}张,存款金额合计{1}元;<br>支票{2}张,支出金额合计{3}元;<br>收支合计余额{4}元。", cds_int, ckhj_je, zps_int, zphj_je, ckhj_je, ckhj_je - zphj_je); string cmd = "select * from bill where 1=1" + where_str; cmd = "select a.*, b.dep_name from (" + cmd + ") a left join dep b on a.payfrom=b.dep_id"; cmd = "select c.*, d.no from (" + cmd + ") c left join depno d on c.payfrom_no=d.no_id"; cmd = "select e.* ,f.edep_name,f.edep_no from (" + cmd + ") e left join exc_dep f on e.payto=f.edep_id order by e.bill_id asc"; ds = new publicClass.Dosql(); ds.DoRe(cmd); this.list.DataSource = ds.DtOut; this.list.DataBind(); } catch { } }
public Dep(int id) { string cmd = "select * from dep where 1=1 and dep_id=" + id; Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled) { DataTable _dtuser = ds.DtOut; if (_dtuser.Rows.Count == 1) { _dep_id = Convert.ToInt32(_dtuser.Rows[0]["dep_id"]); _dep_name = _dtuser.Rows[0]["dep_name"].ToString(); _dep_no = _dtuser.Rows[0]["dep_no"].ToString(); _dep_summary = _dtuser.Rows[0]["summary"].ToString(); _dep_short = _dtuser.Rows[0]["dep_short"].ToString(); } } else { throw new Exception("err on creat dep by id"); } }
public sig(int id) { string cmd = "select * from sig where 1=1 and sig_id=" + id; Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled) { DataTable _dtuser = ds.DtOut; if (_dtuser.Rows.Count == 1) { _sig_id = Convert.ToInt32(_dtuser.Rows[0]["sig_id"]); _dep_id = Convert.ToInt32(_dtuser.Rows[0]["dep_id"]); _sig_word = _dtuser.Rows[0]["sig_word"].ToString(); _type = Convert.ToInt32(_dtuser.Rows[0]["type"]); _lvl = Convert.ToInt32(_dtuser.Rows[0]["lvl"]); } } else { throw new Exception("err on creat sig by id"); } }
public key(int id, int flag = 0) { try { string cmd = ""; if (flag == 0) { cmd = "select * from [key] where 1=1 and uer_id=" + id; } else { cmd = "select * from [key] where 1=1 and key_id=" + id; } Dosql ds = new Dosql(); ds.DoRe(cmd); if (ds.Sqled) { DataTable _dt_key = ds.DtOut; if (_dt_key.Rows.Count == 1) { _uer_id = Convert.ToInt32(_dt_key.Rows[0]["uer_id"]); _key_word = _dt_key.Rows[0]["key_word"].ToString(); _key_id = Convert.ToInt32(_dt_key.Rows[0]["key_id"]); _state = Convert.ToBoolean(_dt_key.Rows[0]["state"]); _sn = _dt_key.Rows[0]["sn"].ToString(); } } else { throw new Exception("err on creat key by id"); } } catch { _state = false; } }
private void bill_list_creat(int _pageindex = 1, int _pagesize = 6, string wherestr = "") { int _pagecount = 0, _pages, _page_s, _page_e; string cmd, datatemp = ""; string[] dataarr; if (Session["review_list_where"] != null) { wherestr = Session["review_list_where"].ToString(); } else { wherestr = ""; } //设置查询条件 try { cmd = "select count(*) from bill where isfiled=0 " + wherestr; if (_uer.Ulvl <= 2) { cmd += " and payfrom = " + _uer.Udep_id; } publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd); if (ds.Sqled) { _pagecount = Convert.ToInt32(ds.DtOut.Rows[0][0]); } _pages = _pagecount % _pagesize == 0 ? _pagecount / _pagesize : (_pagecount / _pagesize) + 1; _pageindex = _pageindex > _pages ? _pages : _pageindex; _pageindex = _pageindex < 1 ? 1 : _pageindex; hide.Value = _pageindex.ToString();//控制分页按钮高亮 if (_pages <= 5) { _page_s = 1; _page_e = _pages; } else { _page_s = _pageindex - 2 < 1 ? 1 : _pageindex - 2; if (_pageindex <= 2) { _page_e = 5; } else { _page_e = _pageindex + 2 > _pages ? _pages : _pageindex + 2; } } if (_page_s == 1) { front.Visible = false; } else { front.Visible = true; } if (_pageindex + 2 < _pages) { back.Visible = true; } else { back.Visible = false; } this.end.CommandArgument = _pages.ToString(); for (int i = _page_s; i <= _page_e; i++) { datatemp += i.ToString() + ","; } if (datatemp.Length != 0) { dataarr = datatemp.Substring(0, datatemp.Length - 1).Split(','); } else { dataarr = new string[] { "1" }; } this.pagestr.DataSource = dataarr; this.pagestr.DataBind(); //cmd = string.Format("select e.* ,f.* from (select c.*,d.no_name,d.no from (select top({0}) a.*,b.dep_name from bill a,dep b where a.payfrom =b.dep_id and isfiled =0 and bill_id not in (select top({1})bill_id from bill where 1=1 {2} order by bill_id desc) {3}) c left join depno d on d.no_id = c.payfrom_no) e left join exc_dep f on e.payto=f.edep_id", _pagesize, _pagesize*(_pageindex-1),wherestr,wherestr); if (_uer.Ulvl <= 2) { wherestr += " and payfrom = " + _uer.Udep_id; } cmd = string.Format("select e.*,f.* from(select c.*,d.edep_name,d.edep_no from (select a.*,b.no_name,b.no from (select top {0} * from bill where 1=1 and isfiled=0 {1} and bill_id not in(select top {2} bill_id from bill where 1=1 and isfiled=0 {3} order by bill_id desc) order by bill_id desc) a left join depno b on a.payfrom_no=b.no_id) c left join exc_dep d on c.payto =d.edep_id) e left join dep f on e.payfrom= f.dep_id", _pagesize, wherestr, _pagesize * (_pageindex - 1), wherestr); //cmd += " order by bill_id desc"; ds = null; ds = new publicClass.Dosql(); ds.DoRe(cmd); if (ds.Sqled) { this.Repeater1.DataSource = ds.DtOut; this.Repeater1.DataBind(); } } catch (Exception ex) { } }
protected void ok_Click(object sender, EventArgs e) { string usbstr = this.usb_sn.Value; string[] usbs = usbstr.Length > 0? usbstr.Substring(1, usbstr.Length - 1).Split(','):new string[] { }; Boolean hasusb = false; try { if (this.valcode_input.Text != Session["valcode"].ToString()) { this.warning.Text = "验证码输入错误,请重试!"; } else { this.warning.Text = ""; DataTable temp = new DataTable(); string cmdstr = "select uer_id from uer where 1=1 and uer_no like '" + this.uer_no.Text + "'"; try { publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmdstr); if (ds.Sqled) { temp = ds.DtOut; publicClass.Uer _uer = new publicClass.Uer(Convert.ToInt32(temp.Rows[0][0])); publicClass.key _key = new publicClass.key(_uer.Uid); foreach (string str in usbs) { if (_key.Key_word == publicClass.str2base64.to64(str) && _key.State) { hasusb = true; } } //if (!hasusb) { throw new Exception("USBKEY"); } if (this.uer_psw.Text.Equals(_uer.Upsw)) { Session["uer_id"] = _uer.Uid; Session["login"] = "******"; Response.Redirect("index.aspx"); } else { throw new Exception("PSSWORD"); } } else { throw new Exception("USER"); } } catch (Exception ex) { this.warning.Text = "登录信息有误,请核对!——" + ex.Message; } } } catch { } }