public void UDB() { DataSet ds = dbs.GetSqlDataSet("select id,UserID,UserName from GroupUsers where gid=" + Request.QueryString["id"].ToString()); TXTStation.Text = dbs.ExeSqlScalar("select station from GroupType where id=" + Request.QueryString["id"].ToString()); BDUser.DataSource = ds.Tables[0]; BDUser.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserID"] == null) { X.AddScript("loginWindow.show();Panel1.disable();"); return; } else { ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Session["UserName"].ToString() + "');", true); X.AddScript("loginWindow.hide();Panel1.enable();"); DataSet ds = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(Session["UserID"].ToString()); if (ds.Tables[0].Rows.Count > 0) { LBUserID.Text = ds.Tables[0].Rows[0]["userID"].ToString(); LBUserName.Text = ds.Tables[0].Rows[0]["fullName"].ToString(); LBStation.Text = ds.Tables[0].Rows[0]["StationCode"].ToString(); LBMail.Text = ds.Tables[0].Rows[0]["eMail"].ToString(); LBMail.Text = ds.Tables[0].Rows[0]["email"].ToString(); LBTel.Text = ds.Tables[0].Rows[0]["Tel"].ToString(); LBMobile.Text = ds.Tables[0].Rows[0]["Mobilephone"].ToString(); LBDepartmentCode.Text = ds.Tables[0].Rows[0]["CRPDepartmentName"].ToString(); Coststation.Text = ds.Tables[0].Rows[0]["CostCenter"].ToString(); int sct = int.Parse(dbs.ExeSqlScalar("select count(*) from StationRole where UserID='" + Session["UserID"].ToString() + "' and admin='1'")); if (sct > 0) { LBStations.Text = "Administrator"; } else { LBStations.Text = dbs.ExeSqlScalar("select Stations from StationRole where UserID='" + Session["UserID"].ToString() + "'"); } string moduleids = dbs.ExeSqlScalar("select ModuleID from StationRole where UserID='" + Session["UserID"].ToString() + "'"); if (moduleids == "") { LBModules.Text = "报销申请,报销审批,影音管理"; } else { string ModuleNames = "报销申请,报销审批,影音管理,"; DataSet dsss = dbs.GetSqlDataSet("select ModuleName from ModuleManage where id in(0" + moduleids + "0)"); for (int i = 0; i < dsss.Tables[0].Rows.Count; i++) { ModuleNames = ModuleNames + dsss.Tables[0].Rows[i]["ModuleName"].ToString() + ","; } LBModules.Text = ModuleNames; } } } } }
public void DDB() { DataTable TTB; string TTstations = dbs.ExeSqlScalar("select stations from StationRole where UserID='" + Request.QueryString["Uid"].ToString() + "'"); string Nct = dbs.ExeSqlScalar("select top 1 admin from StationRole where UserID='" + Session["UserID"].ToString() + "'").ToString(); if (Nct == "1") { DataSet ds = DIMERCO.SDK.Utilities.LSDK.getStationHierarchy(); //SqlConnection cn = new SqlConnection("Data Source=10.130.40.20;Initial Catalog=ReSM;User ID=sa;Password=dim1rc0@"); //SqlDataAdapter da = new SqlDataAdapter("select distinct StationCode from SMStation order by StationCode", cn); //DataSet ds = new DataSet(); //da.Fill(ds); TTB = ds.Tables[0]; } else { string Tstations = dbs.ExeSqlScalar("select stations from StationRole where UserID='" + Session["UserID"] + "'"); DataTable Dt = new DataTable(); Dt.Columns.Add("StationCode"); string[] Sp = Tstations.Split(','); for (int i = 0; i < Sp.Length; i++) { if (Sp[i].ToString().Trim() != "") { DataRow newDr = Dt.NewRow(); newDr["StationCode"] = Sp[i].ToString(); Dt.Rows.Add(newDr); } } TTB = Dt; } DataTable drnw = new DataTable(); TTB.DefaultView.Sort = "StationCode ASC"; drnw = TTB.DefaultView.ToTable(); for (int i = 0; i < drnw.Rows.Count; i++) { Ext.Net.Checkbox C1 = new Ext.Net.Checkbox(); C1.ID = drnw.Rows[i]["StationCode"].ToString(); C1.BoxLabel = drnw.Rows[i]["StationCode"].ToString(); if (TTstations.Contains(drnw.Rows[i]["StationCode"].ToString() + ",")) { C1.Checked = true; } ChkGrp.Items.Add(C1); } }
public void StationDB() { string Nct = dbs.ExeSqlScalar("select top 1 admin from StationRole where UserID='" + Session["UserID"].ToString() + "'").ToString(); if (Nct == "1") { DataSet ds = DIMERCO.SDK.Utilities.LSDK.getStationHierarchy(); //SqlConnection cn = new SqlConnection("Data Source=10.130.40.20;Initial Catalog=ReSM;User ID=sa;Password=dim1rc0@"); //SqlDataAdapter da = new SqlDataAdapter("select distinct StationCode from SMStation order by StationCode", cn); //DataSet ds = new DataSet(); //da.Fill(ds); DataTable tb = ds.Tables[0]; DataTable drnw = new DataTable(); tb.DefaultView.Sort = "StationCode ASC"; drnw = tb.DefaultView.ToTable(); SStation.DataSource = drnw; SStation.DataBind(); ds.Dispose(); DLStation.SelectedIndex = 300; } else { string Tstations = dbs.ExeSqlScalar("select Stations from StationRole where UserID='" + Session["UserID"].ToString() + "'"); DataTable Dt = new DataTable(); Dt.Columns.Add("StationCode"); string[] Sp = Tstations.Split(','); for (int i = 0; i < Sp.Length; i++) { if (Sp[i].ToString().Trim() != "") { DataRow newDr = Dt.NewRow(); newDr["StationCode"] = Sp[i].ToString(); Dt.Rows.Add(newDr); } } DataTable tb = Dt; DataTable drnw = new DataTable(); Dt.DefaultView.Sort = "StationCode ASC"; drnw = Dt.DefaultView.ToTable(); SStation.DataSource = drnw; SStation.DataBind(); DLStation.SelectedIndex = 300; } }
public void DDB() { DataSet Mds = dbs.GetSqlDataSet("select id,ModuleName from ModuleManage"); for (int i = 0; i < Mds.Tables[0].Rows.Count; i++) { Ext.Net.Checkbox C1 = new Ext.Net.Checkbox(); C1.ID = Mds.Tables[0].Rows[i]["ID"].ToString(); C1.BoxLabel = Mds.Tables[0].Rows[i]["ModuleName"].ToString(); int Tct = int.Parse(dbs.ExeSqlScalar("select count(*) from StationRole where UserID='" + Request.QueryString["Uid"].ToString() + "' and charindex('," + Mds.Tables[0].Rows[i]["id"].ToString() + ",',ModuleID)>0")); if (Tct > 0) { C1.Checked = true; } ChkGrp.Items.Add(C1); } }
protected void BTN_AddUser(object sender, DirectEventArgs e) { int cc = int.Parse(dbs.ExeSqlScalar("select count(*) from GroupFlow where type='" + Request.QueryString["M"].ToString() + "' and Gid=" + Request.QueryString["id"].ToString() + " and FlowNo=" + DLStep.Value)); if (cc <= 0) { if (DLUser.Text.Trim() != "") { string uid = DLUser.Value.ToString(); if (DLUser.SelectedItem.Text.ToString() == "Paul Lee") { uid = "A0104"; } dbs.ExeSql("insert into GroupFlow(Gid,FlowNo,FlowUser,FlowUserID,Type,Fn) values(" + Request.QueryString["id"].ToString() + "," + DLStep.Value + ",'" + DLUser.SelectedItem.Text + "','" + uid + "','" + Request.QueryString["M"].ToString() + "','" + ff.Value + "')"); } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "Please input Approver ID", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "The flow No. is exist", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } DB(); }
protected void button1_Search(object sender, DirectEventArgs e) { DataTable tbb; string stationsss = ""; string Nct = dbs.ExeSqlScalar("select top 1 admin from StationRole where UserID='" + Session["UserID"].ToString() + "'").ToString(); if (Nct == "1") { DataSet ds = DIMERCO.SDK.Utilities.LSDK.getStationHierarchy(); //SqlConnection cn = new SqlConnection("Data Source=10.130.40.20;Initial Catalog=ReSM;User ID=sa;Password=dim1rc0@"); //SqlDataAdapter da = new SqlDataAdapter("select distinct StationCode from SMStation order by StationCode", cn); //DataSet ds = new DataSet(); //da.Fill(ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { stationsss = stationsss + "'" + ds.Tables[0].Rows[i]["StationCode"].ToString() + "',"; } } else { string Tstations = dbs.ExeSqlScalar("select Stations from StationRole where UserID='" + Session["UserID"].ToString() + "'"); DataTable Dt = new DataTable(); Dt.Columns.Add("StationCode"); string[] Sp = Tstations.Split(','); for (int i = 0; i < Sp.Length; i++) { if (Sp[i].ToString().Trim() != "") { stationsss = stationsss + "'" + Sp[i].ToString() + "',"; } } } DataSet dss = dbs.GetSqlDataSet("select * from ESUser where station in (" + stationsss + "'0')"); Store1.DataSource = dss.Tables[0]; Store1.DataBind(); }
public static int JdRole(string page) { string pname = page.Substring(page.LastIndexOf("/") + 1); if (HttpContext.Current.Session["UserID"] == null) { return(0); } else { if (dbs == null) { dbs = new DBAdapter(); } string querylist = dbs.ExeSqlScalar("select ModuleID from StationRole where UserID='" + HttpContext.Current.Session["UserID"] + "'").ToString(); if (querylist == "") { return(0); } else { return(int.Parse(dbs.ExeSqlScalar("select count(*) from ModuleManage where charindex('" + pname + "',page)>0 and id in (0" + querylist + "0)"))); } } }
public void LoadBudget() { int ct = int.Parse(dbs.ExeSqlScalar("select count(*) from BudgetMain where Station='" + DLStation.Text + "' and Years='" + DLYears.Text + "'")); if (ct <= 0) { if (DLStation.Text.ToString().Trim() != "") { string WebServiceUrl = System.Configuration.ConfigurationManager.AppSettings["WebserviceURL"].ToString(); ServiceReference1.BudgetApplicationSoapClient objService = new ServiceReference1.BudgetApplicationSoapClient("BudgetApplicationSoap", WebServiceUrl); DataSet Budgetds = objService.GetBudgetPackage(DLStation.Text.ToString(), int.Parse(DLYears.Text.ToString()), "BudgetPackageToken"); string sql = "set xact_abort on BEGIN TRAN "; for (int i = 0; i < Budgetds.Tables[0].Rows.Count; i++) { DataRow dr = Budgetds.Tables[0].Rows[i]; string baccountcode = dbs.ExeSqlScalar("select BAccountCode from AccoundCode where SAccountCode='" + dr["AccountCode"].ToString() + "'"); sql = sql + " insert into BudgetMain(BaacountCode,Station,Years,AccountCode,AccountDes,M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12,type)"; sql = sql + "Values ('" + baccountcode + "','" + DLStation.Text.ToString() + "'," + DLYears.Text.ToString() + ",'" + dr["AccountCode"].ToString() + "','" + dr["AccountDesc"].ToString() + "'," + JDnull(dr["bJAN"].ToString()) + "," + JDnull(dr["bFEB"].ToString()) + "," + JDnull(dr["bMAR"].ToString()) + "," + JDnull(dr["bAPR"].ToString()) + "," + JDnull(dr["bMAY"].ToString()) + "," + JDnull(dr["bJUN"].ToString()) + "," + JDnull(dr["bJUN1"].ToString()) + "," + JDnull(dr["bAUG"].ToString()) + "," + JDnull(dr["bSEP"].ToString()) + "," + JDnull(dr["bOCT"].ToString()) + "," + JDnull(dr["bNOV"].ToString()) + "," + JDnull(dr["bDEC"].ToString()) + ",0)"; } sql += " COMMIT TRAN"; int r = dbs.ExeSql(sql); if (r < 0) { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "载入失败", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { LoadData.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "载入成功", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); DBB(); } } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "请选择站点", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "预算已载入", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } }
protected void copy(object sender, DirectEventArgs e) { int nm = int.Parse(LBMonths.Text) + 1; if (nm > 12) { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "已经超过12月,不能拷贝", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { string nnamount = dbs.ExeSqlScalar("select sum(amount) from BudgetDetail where fid=" + Request.QueryString["id"].ToString() + " and months=" + LBMonths.Text); if (nnamount == "") { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "要拷贝的月份数据为空,不能拷贝", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { double ctt = double.Parse(nnamount); string nmonthtt = dbs.ExeSqlScalar("select m" + nm.ToString() + " from BudgetMain where id=" + Request.QueryString["id"].ToString()); if (nmonthtt == "") { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "下个月预算为空,不能拷贝", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { if (double.Parse(nmonthtt) < double.Parse(nnamount)) { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "下个月预算小于要拷贝的数据,不能拷贝", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { int ii = dbs.ExeSql("INSERT INTO [BudgetDetail]([FID],[Months],[Name],[Amount],[Type] ,[SAccoundcode],[SAccoundName],[Deptment],[Station],[UserID],BaccountCode)select [FID],'" + nm.ToString() + "' as [Months],[Name],[Amount],[Type] ,[SAccoundcode],[SAccoundName],[Deptment],[Station],[UserID],BaccountCode from [BudgetDetail] where fid=" + Request.QueryString["id"].ToString() + " and months=" + LBMonths.Text); if (ii > 0) { LBMonths.Value = nm.ToString(); DBDetail(); X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "拷贝成功", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "拷贝失败", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } } } } } }
protected void Save(object sender, DirectEventArgs e) { int cc = int.Parse(dbs.ExeSqlScalar("select count(*) from EmailTo where station='" + DLStation.Value + "'")); if (cc == 0) { int r = dbs.ExeSql("insert into EmailTo(Station,Email,CreatedDate,CreatedBy) values('" + DLStation.Value + "','" + TXTEmail.Text + "','" + DateTime.Now.ToString() + "','" + Session["UserName"].ToString() + "')"); if (r > 0) { DLStation.Value = null; TXTEmail.Text = ""; DBB(); X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "Save success", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "Save Faile", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } } else { int r = dbs.ExeSql("update EmailTo set email='" + TXTEmail.Text + "',createddate='" + DateTime.Now.ToString() + "',createdby='" + Session["UserName"].ToString() + "' where station='" + DLStation.Value + "'"); if (r > 0) { DLStation.Value = null; TXTEmail.Text = ""; DBB(); X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "Save success", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } else { X.Msg.Show(new MessageBoxConfig { Title = "Message", Message = "Save Faile", Buttons = MessageBox.Button.OK, Width = 320, Icon = MessageBox.Icon.INFO }); } } }