|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Security;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DSWeb.Authority;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.ParameterSet
|
|
|
|
|
{
|
|
|
|
|
public partial class CrmKeyCodeSetGridSource : System.Web.UI.Page
|
|
|
|
|
{
|
|
|
|
|
private string strHandle = "";//读取xml串方式 "init"-初始化获取所有费用信息;"add"-添加新的费用信息;"delete"-删除费用信息;"exist"查看是否有与委托相关费用
|
|
|
|
|
private string strUserID;//用户GID
|
|
|
|
|
private string strCompanyID;//公司GID
|
|
|
|
|
private string strShowName;//用户显示名
|
|
|
|
|
private string strDeptName;//部门名称
|
|
|
|
|
|
|
|
|
|
private int iCurrentPage;
|
|
|
|
|
private int iShowPage;
|
|
|
|
|
public string strgids = "";
|
|
|
|
|
public string strkeytype = "";
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
#region 判断参数是否正确
|
|
|
|
|
if (Session["USERID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strUserID = Session["USERID"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (Request.QueryString["handle"] != null)
|
|
|
|
|
{
|
|
|
|
|
strHandle = Request.QueryString["handle"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["cur_page"] != null)
|
|
|
|
|
{
|
|
|
|
|
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["show_page"] != null)
|
|
|
|
|
{
|
|
|
|
|
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["gids"] != null && Request.QueryString["gids"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strgids = Request.QueryString["gids"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["keytype"] != null && Request.QueryString["keytype"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
|
|
strkeytype = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["keytype"].ToString().Trim())));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
string strJSON = "";
|
|
|
|
|
if (strHandle != null)
|
|
|
|
|
{
|
|
|
|
|
if (strHandle.Equals("delete"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(Getdelete());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (!strHandle.Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string strOutputXml = "";
|
|
|
|
|
//获取crm_quotation_detail费用信息,返回xml格式数据
|
|
|
|
|
strOutputXml = GetCells(strHandle);
|
|
|
|
|
//输出XML字符串
|
|
|
|
|
Response.ContentType = "text/xml";
|
|
|
|
|
strOutputXml.Replace("&", "&");
|
|
|
|
|
Response.Write(strOutputXml);
|
|
|
|
|
}
|
|
|
|
|
if (strHandle.Equals("list"))
|
|
|
|
|
{
|
|
|
|
|
if (iCurrentPage <= 0 && iShowPage < 0)
|
|
|
|
|
{
|
|
|
|
|
strJSON = "-2";//提交页数参数错误
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strJSON = "-1";//GET 参数错误
|
|
|
|
|
//访问参数不正确
|
|
|
|
|
Response.ContentType = "text/xml";
|
|
|
|
|
Response.Write("-2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int Getdelete()
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
strgids = "'" + strgids.Trim().Replace(",", "','") + "'";
|
|
|
|
|
CrmKeyCodeSetDA CrmKeyCodeSetDA = new CrmKeyCodeSetDA();
|
|
|
|
|
bool bl = CrmKeyCodeSetDA.DeleteList(strgids);
|
|
|
|
|
if(bl)
|
|
|
|
|
{
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取crm_quotation_detail费用信息,返回xml格式数据
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取crm_quotation_detail费用信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回xml格式数据</returns>
|
|
|
|
|
private string GetCells(string strHandle)
|
|
|
|
|
{
|
|
|
|
|
if (!strHandle.Equals("exist"))
|
|
|
|
|
{
|
|
|
|
|
//获取所有信息,用做Grid显示
|
|
|
|
|
CrmKeyCodeSetDA CrmKeyCodeSetDA = new CrmKeyCodeSetDA();
|
|
|
|
|
DataTable feeTable = new DataTable();
|
|
|
|
|
string strSql = "";
|
|
|
|
|
if (!strkeytype.Equals(""))
|
|
|
|
|
{
|
|
|
|
|
strSql = "SELECT ID,KEYVALUE FROM crm_key_code WHERE KEYTYPE='" + strkeytype + "' and KEYVALUE<>'' and KEYVALUE is not null";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql = "SELECT ID,KEYVALUE FROM crm_key_code WHERE 1< 0";
|
|
|
|
|
}
|
|
|
|
|
feeTable = CrmKeyCodeSetDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
|
|
|
|
//编排字符串 xml串
|
|
|
|
|
StringBuilder dataBuilder = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
dataBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
|
|
dataBuilder.Append("<rows>");
|
|
|
|
|
|
|
|
|
|
int iCount = feeTable.Rows.Count;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < iCount; i++)
|
|
|
|
|
{
|
|
|
|
|
int jCount = feeTable.Columns.Count;
|
|
|
|
|
dataBuilder.Append("<row id=\"" + feeTable.Rows[i]["ID"].ToString() + "\">");
|
|
|
|
|
dataBuilder.Append("<cell>0</cell>");
|
|
|
|
|
for (int j = 1; j < jCount; j++)
|
|
|
|
|
{
|
|
|
|
|
switch (j)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
dataBuilder.Append("<cell>" + feeTable.Rows[i][j].ToString() + "</cell>");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
dataBuilder.Append("</row>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataBuilder.Append("</rows>");
|
|
|
|
|
|
|
|
|
|
return dataBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
else if (strHandle.Equals("exist"))
|
|
|
|
|
{
|
|
|
|
|
return "1";//存在费用
|
|
|
|
|
}
|
|
|
|
|
else if (strHandle.Equals("add"))
|
|
|
|
|
{
|
|
|
|
|
StringBuilder dataBuilder = new StringBuilder();
|
|
|
|
|
dataBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
|
|
dataBuilder.Append("<rows>");
|
|
|
|
|
dataBuilder.Append("<row id=\"" + Guid.NewGuid().ToString() + "\">");
|
|
|
|
|
dataBuilder.Append("<cell></cell>");
|
|
|
|
|
dataBuilder.Append("</row>");
|
|
|
|
|
dataBuilder.Append("</rows>");
|
|
|
|
|
return dataBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "-3";//没有相关的费用
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
}
|