⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 com_systemmanagerresource.asmx.cs

📁 ASP.NET的一些开发实例,有论坛管理系统等
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.IO;
using System.Xml;

namespace ERPWebService.BdStudio
{
	/// <summary>
	/// COM_SystemManagerResource 的摘要说明。
	/// </summary>
	public class COM_SystemManagerResource : System.Web.Services.WebService
	{
		protected sysbase.COM_BASE COM_BASE = new sysbase.COM_BASE();
		protected sysbase.COMSoft COMSoft = new sysbase.COMSoft();
		protected BdStudioSoft.COM_DropDs COM_DropDs = new BdStudioSoft.COM_DropDs(); 
		protected SqlConnection SqlConn;

		public COM_SystemManagerResource()
		{
			//CODEGEN:该调用是 ASP.NET Web 服务设计器所必需的
			InitializeComponent();
		}

		#region Component Designer generated code
		
		//Web 服务设计器所必需的
		private IContainer components = null;
				
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.SqlConn = new SqlConnection((string)Application["db_connstring"]);
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if(disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(disposing);		
		}
		
		#endregion

		// WEB 服务示例
		// HelloWorld() 示例服务返回字符串 Hello World
		// 若要生成,请取消注释下列行,然后保存并生成项目
		// 若要测试此 Web 服务,请按 F5 键

//		[WebMethod]
//		public string HelloWorld()
//		{
//			return "Hello World";
//		}		

		[WebMethod]
		public DataSet DsProjectDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.project_res from system_manager_resource where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res =dsData.Tables[0].Rows[0]["project_res"].ToString();
				string[] project_res = dsData.Tables[0].Rows[0]["project_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in project_res)
					{
						sqlwhere = string.Format(" p_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);
				}				
				ds = this.COM_DropDs.DsProject(sqlwhere,"");
			}
			return ds;
		}

		[WebMethod]
		public DataSet DsProjectfileDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.pfile_res from system_manager_resource where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res =dsData.Tables[0].Rows[0]["pfile_res"].ToString();
				string[] project_res = dsData.Tables[0].Rows[0]["pfile_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in project_res)
					{
						sqlwhere = string.Format(" f_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);					
				}				
				ds = this.COM_DropDs.DsProjectfile(sqlwhere,"");
			}
			return ds;
		}
		

		[WebMethod]
		public DataSet DsAccountDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.acc_res from system_manager_resource  where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res =dsData.Tables[0].Rows[0]["acc_res"].ToString();
				string[] acc_res = dsData.Tables[0].Rows[0]["acc_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in acc_res)
					{
						sqlwhere = string.Format(" acc_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);
				}							
				ds = this.COM_DropDs.DsAccount(sqlwhere,"");
			}
			return ds;
		}		

		[WebMethod]
		public DataSet DsDdDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.dict_res from system_manager_resource  where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res =dsData.Tables[0].Rows[0]["dict_res"].ToString();
				string[] dict_res = dsData.Tables[0].Rows[0]["dict_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in dict_res)
					{
						sqlwhere = string.Format(" t_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);
				}
				else
				{
					sqlwhere = string.Format(" isnull(t_tablename,'null')='null' ");
				}			
				ds = this.COM_DropDs.DsDd(sqlwhere,"");
			}
			return ds;
		}	

		[WebMethod]
		public DataSet DsInfDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.info_res from system_manager_resource  where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res =dsData.Tables[0].Rows[0]["info_res"].ToString();
				string[] info_res = dsData.Tables[0].Rows[0]["info_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in info_res)
					{
						sqlwhere = string.Format(" i_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);
				}
				else
				{
					sqlwhere = string.Format(" isnull(i_up,0)=0 ");
				}
				ds = this.COM_DropDs.DsInfo(sqlwhere,"");
			}
			return ds;
		}
		

		[WebMethod]
		public DataSet DsUserddDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.inter_res from system_manager_resource  where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res =dsData.Tables[0].Rows[0]["inter_res"].ToString();
				string[] inter_res = dsData.Tables[0].Rows[0]["inter_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in inter_res)
					{
						sqlwhere = string.Format(" u_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);
				}
				else
				{
					sqlwhere = string.Format(" isnull(t_up,'null')='null' ");
				}
				ds = this.COM_DropDs.DsUserdd(sqlwhere,"");
			}
			return ds;
		}		

		[WebMethod]
		public DataSet DsModuleDisplay(string acc_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select system_manager_resource.module_res from system_manager_resource  where acc_num = '{0}'",acc_num);
			DataSet dsData = this.COM_BASE.CreateDataSetFromSql(strSql);
			string sqlwhere = string.Empty;
			if (dsData.Tables.Count > 0)
			{
				string res = dsData.Tables[0].Rows[0]["module_res"].ToString();
				string[] module_res = dsData.Tables[0].Rows[0]["module_res"].ToString().Split(new char[]{','});
				if (res != "All")
				{
					foreach (string str in module_res)
					{
						sqlwhere = string.Format(" m_num = {0} or {1}",str,sqlwhere);
					}
					sqlwhere = sqlwhere.Remove(sqlwhere.Length-3,3);
				}
				else
				{
					sqlwhere = string.Format(" m_type < 3 ");
				}
				ds = this.COM_DropDs.DsModule(sqlwhere,"");
			}
			return ds;
		}

		[WebMethod]
		public DataSet DsProjectInfoDisplay(string p_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select i_num,i_name,i_title from system_information where p_num = '{0}' and isnull(i_up,0)=0 ",p_num);
			ds = this.COM_BASE.CreateDataSetFromSql(strSql);
			return ds;
		}

		[WebMethod]
		public DataSet DsProjectDdDisplay(string p_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select t_num,t_name,t_title from system_dd where p_num = '{0}'and isnull(t_tablename,'null')='null' ",p_num);
			ds = this.COM_BASE.CreateDataSetFromSql(strSql);
			return ds;
		}

		[WebMethod]
		public DataSet DsProjectModuleDisplay(string p_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select m_num,m_name from system_module where p_num = '{0}' and m_type < 3 ",p_num);
			ds = this.COM_BASE.CreateDataSetFromSql(strSql);
			return ds;
		}

		[WebMethod]
		public DataSet DsProjectUserddDisplay(string p_num)
		{
			DataSet ds = new DataSet();
			string strSql = string.Format("select u_num,t_name,t_title from system_userdd where p_num = '{0}' and isnull(t_up,'null')='null'  ",p_num);
			ds = this.COM_BASE.CreateDataSetFromSql(strSql);
			return ds;
		}

		[WebMethod]
		public void UpdateRes(string acc_num,string as_type,string res ,ref string sReturn)
		{
			SqlCommand mySqlCommand = new SqlCommand();
			SqlTransaction myTrans;
			string SqlString = string.Empty;
			string str_TableName = "system_manager_resource";
			string s_pk = "acc_num";
			string resfield = string.Empty;

			this.SqlConn.Open();//启动连接
			myTrans = this.SqlConn.BeginTransaction();//建立事务
			mySqlCommand.Connection = this.SqlConn;//建立sql命令连接
			mySqlCommand.Transaction = myTrans;//绑定事务

			switch(as_type)
			{
				case "project":
					resfield = "project_res";
					break;
				case "acc":
					resfield = "acc_res";
					break;
				case "sysdd":
					resfield = "dict_res";
					break;
				case "sysinfo":
					resfield = "info_res";
					break;
				case "userdd":
					resfield = "inter_res";
					break;
				case "sysmod":
					resfield = "module_res";
					break;
				case "pfile":
					resfield = "pfile_res";
					break;
			}
			DataTable dt = new DataTable();
			dt.Columns.Add(new DataColumn(s_pk,typeof(string)));
			dt.Columns.Add(new DataColumn(resfield,typeof(string)));
			DataRow dr = dt.NewRow();
			if (acc_num != string.Empty)
			{
				dr[s_pk] = acc_num;
				dr[resfield] = res;
			}
			dt.Rows.Add(dr);

			string str_r_num = string.Empty;
			int nErr;
			try
			{
				str_r_num = dt.Rows[0]["acc_num"].ToString();
				//dt.Columns.Remove(s_pk);
				nErr = this.COM_BASE.UpdateTableBase(ref mySqlCommand,ref SqlConn,ref myTrans,str_TableName,dt,ref SqlString,ref s_pk);				
			}
			catch (Exception e)
			{
				nErr = 1;
			}			
			if (nErr == 1)
			{
				sReturn = "修改失败";
			}
			else 
			{
				sReturn = "修改成功";				
			}
			if(nErr != 1)
			{
				myTrans.Commit();
				this.SqlConn.Close();
			}
			
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -