com_numtochina.asmx.cs
来自「ASP.NET的一些开发实例,有论坛管理系统等」· CS 代码 · 共 156 行
CS
156 行
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
namespace ERPWebService.BdStudioSoft
{
/// <summary>
/// COM_NumToChina 的摘要说明。
/// </summary>
public class COM_NumToChina : System.Web.Services.WebService
{
protected sysbase.COM_BASE COM_BASE = new sysbase.COM_BASE();
public COM_NumToChina()
{
//CODEGEN:该调用是 ASP.NET Web 服务设计器所必需的
InitializeComponent();
}
#region Component Designer generated code
//Web 服务设计器所必需的
private IContainer components = null;
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
/// <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 void DataSetReSet(ref DataSet ds)
{
string sEmp="acc_name,start_emp";//人员名称
string sPlanStutas="work_status";//计划状态
DataColumnCollection myCols=ds.Tables[0].Columns;
foreach(DataRow row in ds.Tables[0].Rows)
{
foreach(DataColumn col in myCols)
{
if (sEmp.IndexOf(col.ColumnName.ToString())>=0)
{
row[col.ColumnName]=this.GetAccountEmp(row[col.ColumnName].ToString());
}
if (sPlanStutas.IndexOf(col.ColumnName.ToString())>=0)
{
row[col.ColumnName]=this.GetInformation("PlanStatus",row[col.ColumnName].ToString());
}
}
}
}
[WebMethod]
public string GetClientName(string ClientNum)
{
string strClientName = this.COM_BASE.GetFieldValue("c_num",ClientNum,"system_client","c_name");
return strClientName;
}
[WebMethod]
public string GetProjectName(string ProjectNum)
{
string strClientName = this.COM_BASE.GetFieldValue("p_num",ProjectNum,"system_project","p_name");
return strClientName;
}
[WebMethod]
public string GetAccountName(string AccountNum)
{
string strClientName = this.COM_BASE.GetFieldValue("acc_num",AccountNum,"system_account","acc_name");
return strClientName;
}
[WebMethod]
public string GetAccountEmp(string AccountNum)
{
string strClientName = this.COM_BASE.GetFieldValue("acc_name",AccountNum,"system_account","acc_emp");
return strClientName;
}
[WebMethod]
public string GetInformation(string InfoType,string InfoValue)
{
DataSet ds=this.COM_BASE.CreateDataSetFromSql("select * from system_information where i_name='"+InfoType+"' and i_value='"+InfoValue+"'");
string strClientName = InfoValue;
foreach(DataRow row in ds.Tables[0].Rows)
{
strClientName=row["i_title"].ToString();
}
return strClientName;
}
[WebMethod]
public string GetSchemaName(string schema_num)
{
string[] schemaNum=schema_num.Split(new char[] {','});
string result="";
for(int i=0;i<schemaNum.Length;i++)
{
schemaNum[i]=schemaNum[i].Remove(0,1);
schemaNum[i]=schemaNum[i].Remove(schemaNum[i].Length-1,1);
DataSet ds=this.COM_BASE.CreateDataSetFromSql("select schema_name from system_schema where schema_num='"+schemaNum[i]+"'");
result+=ds.Tables[0].Rows[0][0].ToString()+",";
}
return result=result.Remove(result.Length-1,1);
}
[WebMethod]
public string GetdepName(string dep_num)
{
string[] depNum=dep_num.Split(new char[] {','});
string result="";
for(int i=0;i<depNum.Length;i++)
{
depNum[i]=depNum[i].Remove(0,1);
depNum[i]=depNum[i].Remove(depNum[i].Length-1,1);
DataSet ds=this.COM_BASE.CreateDataSetFromSql("select dep_name from system_department where dep_num='"+depNum[i]+"'");
result+=ds.Tables[0].Rows[0][0].ToString()+",";
}
return result=result.Remove(result.Length-1,1);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?