You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

847 lines
33 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
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 System.Xml.Linq;
using DSWeb.EntityDA;
using DSWeb.Models;
using JsonHelper;
using System.Xml;
namespace DSWeb.ParameterSet
{
public partial class CodeSourceSet : System.Web.UI.Page
{
TopSeaeBillmanageDA TopSeaeBillmanageDA = new TopSeaeBillmanageDA();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
RangeDA RangeDA = new RangeDA();
//grid
private string strColumnVal;
public string strUserID = "";//"04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
private string strType = "44";//Grid模块号
private string strType2 = "45";//Grid模块号
//gridEnd
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
this.hid_userid.Value = strUserID;
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
//this.hid_userid.Value = strUserID;
}
//
//权限可视范围
//this.hdRangeV.Value = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modCodeSourceSetlist");
//this.hdRangeO.Value = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modCodeSourceSetlist");
//this.hdRange.Value = "";
////if (this.hdRangeV.Value.Trim() != this.hdRangeO.Value.Trim())
////{
//this.hdRange.Value = "";
//if (this.hdRangeO.Value.Trim().Equals("4"))//无
//{
// this.imgAdd.Disabled = true;
// this.imgSave.Disabled = true;
// this.imgDel.Disabled = true;
// this.imgPrint.Disabled = true;
//}
//}
//grid
if (!IsPostBack)
{
if (Request.QueryString["handle"] != null)
{
this.hid_handle.Value = Request.QueryString["handle"].ToString().Trim();
Session["handle"] = this.hid_handle.Value;
}
else
{
Session["handle"] = "";
this.hid_handle.Value = "";
}
//
if (Request.QueryString["SOURCEID"] != null)
{
this.hid_SOURCEID.Value = Request.QueryString["SOURCEID"].ToString().Trim();
Session["SOURCEID"] = this.hid_SOURCEID.Value;
}
else
{
Session["SOURCEID"] = "";
this.hid_SOURCEID.Value = "";
}
}
//
if (hid_setting.Value.Trim() != "")
{
strColumnVal = hid_setting.Value.Trim();
SaveColumnSetting(strColumnVal);
hid_setting.Value = "";
}
if (hid_header.Value.Trim() != "")
{
strColumnVal = hid_header.Value.Trim();
SaveColumnSetting(strColumnVal);
hid_header.Value = "";
}
//
if (hid_setting2.Value.Trim() != "")
{
strColumnVal = hid_setting2.Value.Trim();
SaveColumnSetting2(strColumnVal);
hid_setting2.Value = "";
}
if (hid_header2.Value.Trim() != "")
{
strColumnVal = hid_header2.Value.Trim();
SaveColumnSetting2(strColumnVal);
hid_header2.Value = "";
}
//gridEnd
}
protected void btAdd_Click(object sender, EventArgs e)
{
string altSOURCEID = "";
string strSOURCEID = this.hid_SOURCEID.Value.Trim();
string[] items = this.hid_SOURCEID.Value.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
if (items.Length > 0)
{
for (int i = 0; i < items.Length; i++)
{
string alt = T_ALL_DA.GetOpBlissueInsert(this.hid_userid.Value, strSOURCEID, items[i].Trim());
if (alt == "1")
{
Response.Write("<script>alert('市场来源大类市场来源细类管理表code_source_detail插入(删除回复)操作出错!');history.back();</script>");
return;
}
else if (alt == "2")
{
Response.Write("<script>alert('市场来源大类市场来源细类管理表code_source_detail插入操作出错');history.back();</script>");
return;
}
else if (alt != "" && alt != "1" && alt != "2")
{
altSOURCEID += alt + ",";
}
}
//
if (altSOURCEID != "")
{
altSOURCEID = altSOURCEID.Substring(0, altSOURCEID.Length - 1).Trim();
Response.Write("<script>alert('数据成功生成,其中提单“" + altSOURCEID + "”已经生成,因此不再重复生成!');history.back();</script>");
return;
}
else
{
//Response.Write("<script>alert('数据成功生成!');history.back();</script>");
return;
}
}
else
{
Response.Write("<script>alert('请先选中要生成的数据!');history.back();</script>");
return;
}
}
protected void btDel_Click(object sender, EventArgs e)
{
if (this.hid_id.Value.Trim() != "")
{
string snum = T_ALL_DA.GetStrSQL("snum", "select count(*) as snum from code_source_detail where SOURCEID='" + this.hid_id.Value.Trim() + "'");
if (snum.Trim() != "0")
{
Response.Write("<script>alert('请先删除相关的航线信息!');history.back();</script>");
return;
}
else
{
bool bl = T_ALL_DA.GetExecuteSqlCommand("delete from code_source where SOURCEID='" + this.hid_id.Value.Trim() + "'");
if (bl)
{
//Response.Write("<script>alert('删除成功!');history.back();</script>");
return;
}
else
{
Response.Write("<script>alert('操作失败!');history.back();</script>");
return;
}
}
}
else
{
Response.Write("<script>alert('请先选中要删除的数据!');history.back();</script>");
return;
}
}
protected void btDel2_Click(object sender, EventArgs e)
{
if (this.hid_id2.Value.Trim() != "")
{
string strItems = "";
string[] items = this.hid_id2.Value.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
if (items.Length > 0)
{
for (int i = 0; i < items.Length; i++)
{
strItems += " SOURCEDETAILID='" + items[i].Trim() + "' or";
}
if (strItems != "")
{
strItems = strItems.Trim().Substring(0, strItems.Length - 3);
bool bl = T_ALL_DA.GetExecuteSqlCommand("delete from code_source_detail where " + strItems.Trim());
if (bl)
{
//Response.Write("<script>alert('删除成功!');history.back();</script>");
return;
}
else
{
Response.Write("<script>alert('操作失败!');history.back();</script>");
return;
}
}
}
else
{
Response.Write("<script>alert('请先选中要删除的数据!');history.back();</script>");
return;
}
}
}
protected void btBLORDERNO_Click(object sender, EventArgs e)
{
//提单编号
string alt = "";
if (this.hid_strSel.Value.Trim() != "")
{
alt = T_ALL_DA.GetOpBlissueUpdate(this.hid_strSel.Value.Trim(), strUserID.Trim());
if (alt != "")
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
protected void btISSUETYPE_Click(object sender, EventArgs e)
{
//签单方式
string alt = "";
if (this.hid_strSel.Value.Trim() != "")
{
alt = T_ALL_DA.GetOpBlissueUpdate(this.hid_strSel.Value.Trim() + " and SOURCEID='" + this.hid_SOURCEID.Value + "' and BLSTATUS='申请提单'", strUserID.Trim());
if (alt == "")
{
alt = T_ALL_DA.GetOpSeaeUpdate(this.hid_strSel.Value.Trim(), strUserID.Trim());
if (alt != "")
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
else
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
protected void btREMARK_Click(object sender, EventArgs e)
{
//备注
string alt = "";
if (this.hid_strSel.Value.Trim() != "")
{
alt = T_ALL_DA.GetOpBlissueUpdate(this.hid_strSel.Value.Trim(), strUserID.Trim());
if (alt != "")
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
#region Grid参数
private void SaveColumnSetting(string tempColumnVal)
{
JsonColumnGroupEntity jsonColumnGroupEntity = GetPostEntity(tempColumnVal);
List<JsonColumnEntity> jsonColumnEntities = new List<JsonColumnEntity>();
UserSettingDA userSettingDA = new UserSettingDA();
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType);
if (userSettingEntity.GID != null)
{
userSettingEntity.ModifiedUser = strUserID;
GridEntity gridEntity = null;
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
gridEntity = GetSettingXml(userSettingEntity.Xml);
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
foreach (JsonColumnEntity jColumn in jsonColumnGroupEntity.JsonColumnEntities)
{
foreach (GridColumnEntity gColumn in gridEntity.Columns)
{
if (gColumn.Description.Equals(jColumn.col3))
{
gColumn.Description = jColumn.col3;
gColumn.Width = jColumn.col5;
gColumn.Index = jColumn.col4;
if (jColumn.col6 != -1)
{
gColumn.VisibleState = jColumn.col6;
}
//gridColumnEntities.Add(gColumn);
break;
}
}
}
//Columns
//gridEntity.Columns = gridColumnEntities;
userSettingEntity.Xml = SaveUserSetting(gridEntity).OuterXml;
int iResult = userSettingDA.UpdateUserSetting(userSettingEntity);
}
else
{
if (jsonColumnGroupEntity != null)
{
userSettingEntity = new UserSettingEntity();
userSettingEntity.GID = Guid.NewGuid().ToString();
userSettingEntity.Name = "CodeSourceSetGridSetting";
userSettingEntity.Description = "市场来源大类管理Grid设置";
userSettingEntity.UserID = strUserID;
userSettingEntity.Type = 1;//type值为1表示Grid
string strRequestUrl = Request.Url.ToString();
string strUrl = strRequestUrl.Substring(0, strRequestUrl.LastIndexOf("/"));
string strPage = strRequestUrl.Substring(strRequestUrl.LastIndexOf("/") + 1, strRequestUrl.Length - strRequestUrl.LastIndexOf("/") - 1);
userSettingEntity.Url = strUrl;
userSettingEntity.Page = strPage;
userSettingEntity.CreateUser = strUserID;
GridEntity gridEntity = new GridEntity();
gridEntity.GID = userSettingEntity.GID;
gridEntity.UserID = strUserID;
gridEntity.GroupBy = "";
gridEntity.DefaultPrePageCount = 15;
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
foreach (JsonColumnEntity column in jsonColumnGroupEntity.JsonColumnEntities)
{
GridColumnEntity gridColumnEntity = new GridColumnEntity();
if (column.col6 != -1)
{
gridColumnEntity.Name = column.col2;
gridColumnEntity.VisibleState = column.col6;
}
else
{
switch (column.col3.Trim())
{
case "市场来源大类":
gridColumnEntity.Name = "SOURCENAME";
break;
case "中文名称":
gridColumnEntity.Name = "CNAME";
break;
case "船公司":
gridColumnEntity.Name = "CARRIER";
break;
case "EDICODE":
gridColumnEntity.Name = "EDI船舶呼号";
break;
}
gridColumnEntity.VisibleState = 0;
}
gridColumnEntity.Description = column.col3;
gridColumnEntity.Index = column.col4;
gridColumnEntity.Width = column.col5;
gridColumnEntities.Add(gridColumnEntity);
}
//Columns
gridEntity.Columns = gridColumnEntities;
userSettingEntity.Xml = SaveUserSetting(gridEntity).OuterXml;
int iResult = userSettingDA.InsertUserSetting(userSettingEntity);
dvSaveState.InnerHtml = iResult.ToString();
}
}
}
#region 获取列信息
/// <summary>
/// 获取列信息
/// </summary>
/// <param name="tempValue"></param>
/// <returns></returns>
private JsonColumnGroupEntity GetPostEntity(string tempValue)
{
JsonColumnGroupEntity tempColumnGroupEntity = new JsonColumnGroupEntity();
try
{
tempColumnGroupEntity = (JsonColumnGroupEntity)JSON.Instance.ToObject(tempValue);
}
catch (Exception error)
{
throw error;
}
return tempColumnGroupEntity;
}
#endregion
private XmlDocument SaveUserSetting(GridEntity gridEntity)
{
XmlDocument xmlDoc = new XmlDocument();
XmlElement root = xmlDoc.CreateElement("user-settings");
//xmlDoc.AppendChild(root);
XmlElement xGid = xmlDoc.CreateElement("gid");
xGid.InnerText = gridEntity.GID;
root.AppendChild(xGid);
XmlElement xUserID = xmlDoc.CreateElement("userid");
xUserID.InnerText = gridEntity.UserID;
root.AppendChild(xUserID);
XmlElement xCreateTime = xmlDoc.CreateElement("create-time");
xCreateTime.InnerText = gridEntity.CreateTime.ToString();
root.AppendChild(xCreateTime);
XmlElement xColumns = xmlDoc.CreateElement("columns");
foreach (GridColumnEntity column in gridEntity.Columns)
{
XmlElement xColumn = xmlDoc.CreateElement("column");
XmlElement nName = xmlDoc.CreateElement("name");
nName.InnerText = column.Name;
xColumn.AppendChild(nName);
XmlElement nDescription = xmlDoc.CreateElement("description");
nDescription.InnerText = column.Description;
xColumn.AppendChild(nDescription);
XmlElement nIndex = xmlDoc.CreateElement("index");
nIndex.InnerText = column.Index.ToString();
xColumn.AppendChild(nIndex);
XmlElement nWidth = xmlDoc.CreateElement("width");
nWidth.InnerText = column.Width.ToString();
xColumn.AppendChild(nWidth);
XmlElement nVisible = xmlDoc.CreateElement("visible");
nVisible.InnerText = column.VisibleState.ToString();
xColumn.AppendChild(nVisible);
xColumns.AppendChild(xColumn);
}
root.AppendChild(xColumns);
XmlElement xGroupBy = xmlDoc.CreateElement("group-by");
xGroupBy.InnerText = gridEntity.GroupBy;
root.AppendChild(xGroupBy);
XmlElement xPage = xmlDoc.CreateElement("page");
XmlElement nPageDefault = xmlDoc.CreateElement("page-default");
nPageDefault.InnerText = gridEntity.DefaultPrePageCount.ToString();
xPage.AppendChild(nPageDefault);
XmlElement nPagePre = xmlDoc.CreateElement("page-pre");
nPagePre.InnerText = gridEntity.PagePreCount.ToString();
xPage.AppendChild(nPagePre);
root.AppendChild(xPage);
xmlDoc.AppendChild(root);
return xmlDoc;
}
private GridEntity GetSettingXml(string strXml)
{
XmlDocument xmlSettingDoc = new XmlDocument();
GridEntity gridEntity = new GridEntity();
try
{
xmlSettingDoc.LoadXml(strXml);
gridEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[0].InnerText.Trim();
gridEntity.UserID = xmlSettingDoc.ChildNodes[0].ChildNodes[1].InnerText.Trim();
gridEntity.CreateTime = DateTime.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[2].InnerText.Trim());
IList<GridColumnEntity> columnsEntities = new List<GridColumnEntity>();
int iColCount = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes.Count;
for (int i = 0; i < iColCount; i++)
{
GridColumnEntity columnEntity = new GridColumnEntity();
//columnEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[0].ToString();
columnEntity.Name = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[0].InnerText.Trim();
columnEntity.Description = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[1].InnerText.Trim();
columnEntity.Index = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[2].InnerText.Trim());
columnEntity.Width = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[3].InnerText.Trim());
columnsEntities.Add(columnEntity);
}
gridEntity.Columns = columnsEntities;
gridEntity.GroupBy = xmlSettingDoc.ChildNodes[0].ChildNodes[4].InnerText.Trim();
gridEntity.DefaultPrePageCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[0].InnerText.Trim());
gridEntity.PagePreCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[1].InnerText.Trim());
}
catch (Exception error)
{
throw (error);
}
return gridEntity;
}
public enum SqlName
{
NAME = 0,
LOGTYPE = 1,
LOGTIME = 2,
LOGCONTENT = 3,
USERNAME = 4
}
#endregion
#region Grid参数2
private void SaveColumnSetting2(string tempColumnVal)
{
JsonColumnGroupEntity jsonColumnGroupEntity = GetPostEntity2(tempColumnVal);
List<JsonColumnEntity> jsonColumnEntities = new List<JsonColumnEntity>();
UserSettingDA userSettingDA = new UserSettingDA();
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType2);
if (userSettingEntity.GID != null)
{
userSettingEntity.ModifiedUser = strUserID;
GridEntity gridEntity = null;
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
gridEntity = GetSettingXml2(userSettingEntity.Xml);
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
foreach (JsonColumnEntity jColumn in jsonColumnGroupEntity.JsonColumnEntities)
{
foreach (GridColumnEntity gColumn in gridEntity.Columns)
{
if (gColumn.Description.Equals(jColumn.col3))
{
gColumn.Description = jColumn.col3;
gColumn.Width = jColumn.col5;
gColumn.Index = jColumn.col4;
if (jColumn.col6 != -1)
{
gColumn.VisibleState = jColumn.col6;
}
//gridColumnEntities.Add(gColumn);
break;
}
}
}
//Columns
//gridEntity.Columns = gridColumnEntities;
userSettingEntity.Xml = SaveUserSetting2(gridEntity).OuterXml;
int iResult = userSettingDA.UpdateUserSetting(userSettingEntity);
}
else
{
if (jsonColumnGroupEntity != null)
{
userSettingEntity = new UserSettingEntity();
userSettingEntity.GID = Guid.NewGuid().ToString();
userSettingEntity.Name = "CodeSourceSetGridSetting_2";
userSettingEntity.Description = "市场来源细类管理_2Grid设置";
userSettingEntity.UserID = strUserID;
userSettingEntity.Type = 1;//type值为1表示Grid
string strRequestUrl = Request.Url.ToString();
string strUrl = strRequestUrl.Substring(0, strRequestUrl.LastIndexOf("/"));
string strPage = strRequestUrl.Substring(strRequestUrl.LastIndexOf("/") + 1, strRequestUrl.Length - strRequestUrl.LastIndexOf("/") - 1);
userSettingEntity.Url = strUrl;
userSettingEntity.Page = strPage;
userSettingEntity.CreateUser = strUserID;
GridEntity gridEntity = new GridEntity();
gridEntity.GID = userSettingEntity.GID;
gridEntity.UserID = strUserID;
gridEntity.GroupBy = "";
gridEntity.DefaultPrePageCount = 15;
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
foreach (JsonColumnEntity column in jsonColumnGroupEntity.JsonColumnEntities)
{
GridColumnEntity gridColumnEntity = new GridColumnEntity();
if (column.col6 != -1)
{
gridColumnEntity.Name = column.col2;
gridColumnEntity.VisibleState = column.col6;
}
else
{
switch (column.col3.Trim())
{
case "市场来源大类":
gridColumnEntity.Name = "SOURCEID";
break;
case "市场来源细类":
gridColumnEntity.Name = "SOURCEDETAIL";
break;
case "装货港":
gridColumnEntity.Name = "PORTLOAD";
break;
case "中转港":
gridColumnEntity.Name = "ENTREPORT";
break;
case "卸货港":
gridColumnEntity.Name = "PORTDISCHARGE";
break;
case "开船日期":
gridColumnEntity.Name = "ETD";
break;
case "截港日期":
gridColumnEntity.Name = "CLOSINGDATE";
break;
case "预抵日期":
gridColumnEntity.Name = "ETA";
break;
case "默认场站(码头)":
gridColumnEntity.Name = "YARDID";
break;
}
gridColumnEntity.VisibleState = 0;
}
gridColumnEntity.Description = column.col3;
gridColumnEntity.Index = column.col4;
gridColumnEntity.Width = column.col5;
gridColumnEntities.Add(gridColumnEntity);
}
//Columns
gridEntity.Columns = gridColumnEntities;
userSettingEntity.Xml = SaveUserSetting2(gridEntity).OuterXml;
int iResult = userSettingDA.InsertUserSetting(userSettingEntity);
dvSaveState.InnerHtml = iResult.ToString();
}
}
}
#region 获取列信息
/// <summary>
/// 获取列信息
/// </summary>
/// <param name="tempValue"></param>
/// <returns></returns>
private JsonColumnGroupEntity GetPostEntity2(string tempValue)
{
JsonColumnGroupEntity tempColumnGroupEntity = new JsonColumnGroupEntity();
try
{
tempColumnGroupEntity = (JsonColumnGroupEntity)JSON.Instance.ToObject(tempValue);
}
catch (Exception error)
{
throw error;
}
return tempColumnGroupEntity;
}
#endregion
private XmlDocument SaveUserSetting2(GridEntity gridEntity)
{
XmlDocument xmlDoc = new XmlDocument();
XmlElement root = xmlDoc.CreateElement("user-settings");
//xmlDoc.AppendChild(root);
XmlElement xGid = xmlDoc.CreateElement("gid");
xGid.InnerText = gridEntity.GID;
root.AppendChild(xGid);
XmlElement xUserID = xmlDoc.CreateElement("userid");
xUserID.InnerText = gridEntity.UserID;
root.AppendChild(xUserID);
XmlElement xCreateTime = xmlDoc.CreateElement("create-time");
xCreateTime.InnerText = gridEntity.CreateTime.ToString();
root.AppendChild(xCreateTime);
XmlElement xColumns = xmlDoc.CreateElement("columns");
foreach (GridColumnEntity column in gridEntity.Columns)
{
XmlElement xColumn = xmlDoc.CreateElement("column");
XmlElement nName = xmlDoc.CreateElement("name");
nName.InnerText = column.Name;
xColumn.AppendChild(nName);
XmlElement nDescription = xmlDoc.CreateElement("description");
nDescription.InnerText = column.Description;
xColumn.AppendChild(nDescription);
XmlElement nIndex = xmlDoc.CreateElement("index");
nIndex.InnerText = column.Index.ToString();
xColumn.AppendChild(nIndex);
XmlElement nWidth = xmlDoc.CreateElement("width");
nWidth.InnerText = column.Width.ToString();
xColumn.AppendChild(nWidth);
XmlElement nVisible = xmlDoc.CreateElement("visible");
nVisible.InnerText = column.VisibleState.ToString();
xColumn.AppendChild(nVisible);
xColumns.AppendChild(xColumn);
}
root.AppendChild(xColumns);
XmlElement xGroupBy = xmlDoc.CreateElement("group-by");
xGroupBy.InnerText = gridEntity.GroupBy;
root.AppendChild(xGroupBy);
XmlElement xPage = xmlDoc.CreateElement("page");
XmlElement nPageDefault = xmlDoc.CreateElement("page-default");
nPageDefault.InnerText = gridEntity.DefaultPrePageCount.ToString();
xPage.AppendChild(nPageDefault);
XmlElement nPagePre = xmlDoc.CreateElement("page-pre");
nPagePre.InnerText = gridEntity.PagePreCount.ToString();
xPage.AppendChild(nPagePre);
root.AppendChild(xPage);
xmlDoc.AppendChild(root);
return xmlDoc;
}
private GridEntity GetSettingXml2(string strXml)
{
XmlDocument xmlSettingDoc = new XmlDocument();
GridEntity gridEntity = new GridEntity();
try
{
xmlSettingDoc.LoadXml(strXml);
gridEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[0].InnerText.Trim();
gridEntity.UserID = xmlSettingDoc.ChildNodes[0].ChildNodes[1].InnerText.Trim();
gridEntity.CreateTime = DateTime.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[2].InnerText.Trim());
IList<GridColumnEntity> columnsEntities = new List<GridColumnEntity>();
int iColCount = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes.Count;
for (int i = 0; i < iColCount; i++)
{
GridColumnEntity columnEntity = new GridColumnEntity();
//columnEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[0].ToString();
columnEntity.Name = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[0].InnerText.Trim();
columnEntity.Description = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[1].InnerText.Trim();
columnEntity.Index = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[2].InnerText.Trim());
columnEntity.Width = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[3].InnerText.Trim());
columnsEntities.Add(columnEntity);
}
gridEntity.Columns = columnsEntities;
gridEntity.GroupBy = xmlSettingDoc.ChildNodes[0].ChildNodes[4].InnerText.Trim();
gridEntity.DefaultPrePageCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[0].InnerText.Trim());
gridEntity.PagePreCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[1].InnerText.Trim());
}
catch (Exception error)
{
throw (error);
}
return gridEntity;
}
public enum SqlName2
{
NAME = 0,
LOGTYPE = 1,
LOGTIME = 2,
LOGCONTENT = 3,
USERNAME = 4
}
#endregion
}
}