using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class productSortModify : System.Web.UI.Page
{
public ArrayList errorStrList = new ArrayList(20);
public string[] errorStr;
public ArrayList errorObjList = new ArrayList();
public int i = 0;
public sortTitle.productSort st = new sortTitle.productSort();
public string Stitle = "";
public long Psid; //地址栏参数
public string act = "";
public long Rc;
public string[] Pic = new string[1];
public List<Model.productSort> l_level;
struct errorData
{
public int errorI;
public string errorObj;
}
protected void Page_Load(object sender, EventArgs errorStrct)
{
Bll.Cookie.checkSession();
Model.Pages p;
Model.productSort m;
#region ==接收地址栏==
Psid = Common.Functions.ConvertInt64(Request.QueryString["id"], 0);
#endregion
#region ==赋初值==
m = new Model.productSort();
m.d_Psid = Psid;
m = Bll.productSort.Select_Detail(m);
Stitle = m.Stitle;
#endregion
errorStr = new string[0];
#region ==处理表单提交==
act = Request.Form["act"];
if (act == "modify")
{
#region==接收表单==
Stitle = Common.Functions.convers(Request.Form["Stitle"].ToString().Trim());
#endregion
#region ==验证表单==
i = 0;
if (string.IsNullOrEmpty(Stitle))
{
errorData errorStruct = new errorData();
errorStruct.errorI = 1;
errorStruct.errorObj = "Stitle";
errorObjList.Add(errorStruct);
errorStrList.Add("产品分类不能为空");
i++;
}else if (Common.Functions.strLength(Stitle) > 100)
{
errorData errorStruct = new errorData();
errorStruct.errorI = 1;
errorStruct.errorObj = "Stitle";
errorObjList.Add(errorStruct);
errorStrList.Add("产品分类不能多于50个汉字(100个字符),现在是" + Common.Functions.strLength(Stitle) + "个字符");
i++;
}
else
{
Model.productSort m2 = new Model.productSort();
m2.s_Keywords = Stitle;
p = new Model.Pages();
l_level = Bll.productSort.Select_List(m2, ref p, ref Rc);
if (l_level.Count> 0)
{
errorData errorStruct = new errorData();
errorStruct.errorI = 1;
errorStruct.errorObj = "Stitle";
errorObjList.Add(errorStruct);
errorStrList.Add("此分类已存在");
i++;
}
}
errorStrList.TrimToSize();
errorStr = new string[errorStrList.Count];
errorStrList.CopyTo(errorStr);
#endregion
#region ==通过验证==
if (errorStr.Length == 0)
{
#region ==修改数据==
m = new Model.productSort();
m.d_Psid = Psid;
m.Stitle = Stitle;
Bll.productSort.Modify(m);
#endregion
#region ==页面转向==
Common.Functions.Alert("修改成功!", "productSortList.aspx?" + Common.Functions.transParameters("id"), true);
#endregion
}
else
{
errorObjList.TrimToSize();
}
#endregion
}
#endregion
}
public string showErrorObj()
{
string str;
str = "<script language=\"javascript\">";
for (i = 0; i < errorObjList.Count; i++)
{
errorData t = (errorData)errorObjList[i];
str += "markObj(form1." + t.errorObj + "," + t.errorI + "," + i + ");\n";
}
str += "</script>";
return str;
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class productSortModify : System.Web.UI.Page
{
public ArrayList errorStrList = new ArrayList(20);
public string[] errorStr;
public ArrayList errorObjList = new ArrayList();
public int i = 0;
public sortTitle.productSort st = new sortTitle.productSort();
public string Stitle = "";
public long Psid; //地址栏参数
public string act = "";
public long Rc;
public string[] Pic = new string[1];
public List<Model.productSort> l_level;
struct errorData
{
public int errorI;
public string errorObj;
}
protected void Page_Load(object sender, EventArgs errorStrct)
{
Bll.Cookie.checkSession();
Model.Pages p;
Model.productSort m;
#region ==接收地址栏==
Psid = Common.Functions.ConvertInt64(Request.QueryString["id"], 0);
#endregion
#region ==赋初值==
m = new Model.productSort();
m.d_Psid = Psid;
m = Bll.productSort.Select_Detail(m);
Stitle = m.Stitle;
#endregion
errorStr = new string[0];
#region ==处理表单提交==
act = Request.Form["act"];
if (act == "modify")
{
#region==接收表单==
Stitle = Common.Functions.convers(Request.Form["Stitle"].ToString().Trim());
#endregion
#region ==验证表单==
i = 0;
if (string.IsNullOrEmpty(Stitle))
{
errorData errorStruct = new errorData();
errorStruct.errorI = 1;
errorStruct.errorObj = "Stitle";
errorObjList.Add(errorStruct);
errorStrList.Add("产品分类不能为空");
i++;
}else if (Common.Functions.strLength(Stitle) > 100)
{
errorData errorStruct = new errorData();
errorStruct.errorI = 1;
errorStruct.errorObj = "Stitle";
errorObjList.Add(errorStruct);
errorStrList.Add("产品分类不能多于50个汉字(100个字符),现在是" + Common.Functions.strLength(Stitle) + "个字符");
i++;
}
else
{
Model.productSort m2 = new Model.productSort();
m2.s_Keywords = Stitle;
p = new Model.Pages();
l_level = Bll.productSort.Select_List(m2, ref p, ref Rc);
if (l_level.Count> 0)
{
errorData errorStruct = new errorData();
errorStruct.errorI = 1;
errorStruct.errorObj = "Stitle";
errorObjList.Add(errorStruct);
errorStrList.Add("此分类已存在");
i++;
}
}
errorStrList.TrimToSize();
errorStr = new string[errorStrList.Count];
errorStrList.CopyTo(errorStr);
#endregion
#region ==通过验证==
if (errorStr.Length == 0)
{
#region ==修改数据==
m = new Model.productSort();
m.d_Psid = Psid;
m.Stitle = Stitle;
Bll.productSort.Modify(m);
#endregion
#region ==页面转向==
Common.Functions.Alert("修改成功!", "productSortList.aspx?" + Common.Functions.transParameters("id"), true);
#endregion
}
else
{
errorObjList.TrimToSize();
}
#endregion
}
#endregion
}
public string showErrorObj()
{
string str;
str = "<script language=\"javascript\">";
for (i = 0; i < errorObjList.Count; i++)
{
errorData t = (errorData)errorObjList[i];
str += "markObj(form1." + t.errorObj + "," + t.errorI + "," + i + ");\n";
}
str += "</script>";
return str;
}
}