private void BindDDL() { DataSet temp = server.GetDataSet("select * from bill_dataDic where dicType='03' order by dicCode"); ddlType.DataTextField = "dicName"; ddlType.DataValueField = "dicCode"; ddlType.DataSource = temp; ddlType.DataBind(); }
private string GetDept() { DataSet ds = server.GetDataSet("select '['+deptCode+']'+deptName as deptName from bill_departments where deptStatus='1' "); StringBuilder arry = new StringBuilder(); foreach (DataRow dr in ds.Tables[0].Rows) { arry.Append("'"); arry.Append(Convert.ToString(dr["deptName"])); arry.Append("',"); } string script = arry.ToString().Substring(0, arry.Length - 1); return(script); }
/// <summary> /// 获取人员权限内的全部单位编号信息 /// </summary> /// <param name="userCode"></param> /// <param name="deptStatus"></param> /// <returns></returns> public string GetUserRightDepartments(string userCode, string deptStatus) { string deptStatusTj = ""; if (deptStatus == "") { } else { deptStatusTj = " and deptStatus in (" + deptStatus + ")"; } string sql = "select * from bill_departments where 1=1 " + deptStatusTj; if (userCode == "admin") { sql += " and isnull(sjDeptCode,'')=''"; } else { if (server.GetDataSet("select * from bill_userRight where rightType='2' and userCode='" + userCode + "'").Tables[0].Rows.Count == 0)//未分配权限 { sql += " and deptCode=(select userDept from bill_users where userCode='" + userCode + "')"; } else { sql += " and deptCode in (select objectID from bill_userRight where rightType='2' and userCode='" + userCode + "')"; } } string returnStr = ""; DataSet temp = server.GetDataSet(sql); for (int i = 0; i <= temp.Tables[0].Rows.Count - 1; i++) { returnStr += temp.Tables[0].Rows[i]["deptCode"].ToString().Trim() + ","; this.GetNextLevelDepartments2(ref returnStr, temp.Tables[0].Rows[i]["deptCode"].ToString().Trim(), deptStatus); } if (returnStr != "") { returnStr = returnStr.Substring(0, returnStr.Length - 1); } return(returnStr); }
//V_HuiKuanLeiBie public DataSet getall() { string sql = "select * from dbo.V_HuiKuanLeiBie "; return(server.GetDataSet(sql)); }
/// <summary> /// 获取新增预算过程编号 /// </summary> /// <returns>年月日+四位流水</returns> public string getYsgcCode() { string date = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString().PadLeft(2, '0') + System.DateTime.Now.Day.ToString().PadLeft(2, '0'); string sql = "select gcbh from bill_ysgc where left(gcbh,8)='" + date + "'"; DataSet temp = server.GetDataSet(sql); if (temp.Tables[0].Rows.Count == 0) { return(date + "0001"); } else { int index = 1; for (int i = 0; i <= temp.Tables[0].Rows.Count - 1; i++) { string gcbh = temp.Tables[0].Rows[i]["gcbh"].ToString().Trim(); if (gcbh.Length == 12)//固定12位编码 { gcbh = gcbh.Substring(8, 4); try { if (int.Parse(gcbh) > index) { index = int.Parse(gcbh); } } catch { } } } index += 1; return(date + index.ToString().PadLeft(4, '0')); } }