📄 usercontrolbase.cs
字号:
#region 加载系统日志列表
/// <summary>
/// 加载系统日志列表
/// </summary>
/// <returns></returns>
public StringBuilder InitSysLogList(string userid,string funcid,Parameter parms)
{
DataTable table1 = null;
System.Data.DataRow[] funcRows=null;
StringBuilder builder1=new StringBuilder();
try
{
table1 =BLL.SysLog.GetAllSysLog();
if (userid != null && funcid !=null)
{funcRows = table1.Select("UserId='"+userid+"' and FuncId='"+funcid+"'");}
foreach( System.Data.DataRow funcRow in funcRows )
{
builder1.Append("<tr><td class='tr_center'>");
builder1.Append(funcRow["LogId"]);
builder1.Append("</td><td class='tr_left'><span class='spacing'></span><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Read&itemid=");
builder1.Append(funcRow["LogId"]);
builder1.Append("' target='right'>");
builder1.Append(BLL.SysUser.GetSysUserById(funcRow["UserId"].ToString().Trim()).TrueName);
builder1.Append("</a></td><td class='tr_left'><font color=blue>");
builder1.Append(funcRow["BZ"]);
builder1.Append("</font></td><td class='tr_center'>");
builder1.Append(funcRow["OptTime"]);
builder1.Append("</td><td class='tr_center'><span class=red>");
builder1.Append(funcRow["OptState"].ToString().Trim() == "1" ? "成功" : "失败");//操作模块
builder1.Append("</span></td><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Delete&itemid=");
builder1.Append(funcRow["LogId"]);
builder1.Append("' target='right'>删除</a></td></tr>");
}
}
catch
{}
return builder1;
}
#endregion
#region 加载树型商品类别列表
public StringBuilder InitCustomerTypeList(Parameter parms)
{
int count=1;//计数器
string space=" ";//间隔
string temp=null;
StringBuilder builder1=new StringBuilder();
try
{
DataTable table1 = BLL.CustomerType.GetAllType();
InitCustomerTypeTree(ref builder1,table1,"",2,parms,ref count,temp,space);
}
catch
{}
return builder1;
}
private void InitCustomerTypeTree(ref StringBuilder builder1,DataTable table1, string id, int length,Parameter parms,ref int count,string temp,string space)
{
System.Data.DataRow[] funcRows;
try
{
if (id=="")
{funcRows = table1.Select(String.Format("LEN(TRIM(TypeId))={0}",length));}
else
{ funcRows = table1.Select(String.Format("TypeId LIKE '{0}%' AND LEN(TRIM(TypeId))={1}",id,length));}
if (funcRows.Length > 0)
{
temp += space;//进入递归后增加前面的空格
foreach( System.Data.DataRow funcRow in funcRows )
{
builder1.Append("<tr><td class='tr_left'>");
builder1.Append(count);
builder1.Append("</td><td class='tr_left'>");
builder1.Append(temp);//加载间隔
if (this.HaveChildNode(table1,"TypeId",funcRow["TypeId"].ToString().Trim(),length+2))
{builder1.Append("<img src='skin/close.gif' alt='+'>");}
else
{builder1.Append("<img src='skin/open.gif' alt='-'>");}
builder1.Append("<a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Read&classid=");
builder1.Append(funcRow["TypeId"]);
builder1.Append("' target='right'>");
builder1.Append(funcRow["TypeName"]);
builder1.Append("</a></td><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Add&classid=");
builder1.Append(funcRow["TypeId"]);
builder1.Append("' target='right'>添加子类</a><span class='spacing'></span><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Update&classid=");
builder1.Append(funcRow["TypeId"]);
builder1.Append("' target='right'>修改分类</a><span class='spacing'></span><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Delete&classid=");
builder1.Append(funcRow["TypeId"]);
builder1.Append("' target='right'");
builder1.Append(DeleteConfirm);
builder1.Append(">删除分类</a></td></tr>");
count++;
InitCustomerTypeTree(ref builder1,table1,funcRow["TypeId"].ToString().Trim(),length+2,parms,ref count,temp,space);
}
}
}
catch
{}
}
#endregion
#region 加载客户信息列表
public StringBuilder InitCustomerList(string userpower,string type,Parameter parms)
{
StringBuilder builder1=new StringBuilder();
DataTable table1 = null;
System.Data.DataRow[] funcRows=null;
try
{
switch(userpower)
{
case "0":
{table1 =(DataTable) BLL.Customer.GetAllCustomer();break;}
case "1":
{table1 = (DataTable)BLL.SysUser.GetCustomerByUserId(((SysUserInfo)Session["userinfo"]).UserId);break;}
}
funcRows = table1.Select("TypeId ="+type);
foreach( System.Data.DataRow funcRow in funcRows )
{
builder1.Append("<tr><td class='tr_center'>");
builder1.Append(funcRow["CustomerId"]);
builder1.Append("</td><td class='tr_center'><span class='spacing'></span>");
builder1.Append("<a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Read&itemid=");
builder1.Append(funcRow["CustomerId"]);
builder1.Append("' target='right'>");
builder1.Append(funcRow["CustomerName"]);
builder1.Append("</a></td><td class='tr_center'><span class='spacing'></span>");
builder1.Append("<a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=DeputyUpdate&itemid=");
builder1.Append(funcRow["DeputyId"]);
builder1.Append("' target='right'>");
builder1.Append(BLL.Deputy.GetDeputyById(funcRow["DeputyId"].ToString()).TrueName);
builder1.Append("</a></td><td class='tr_center'>");
builder1.Append(BLL.Customer.GetSysUserByCustomerId(funcRow["CustomerId"].ToString()).TrueName);
builder1.Append("</td><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Update&itemid=");
builder1.Append(funcRow["CustomerId"]);
builder1.Append("' target='right'>修改</a><span class='spacing'></span><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Delete&itemid=");
builder1.Append(funcRow["CustomerId"]);
builder1.Append("' target='right'");
builder1.Append(DeleteConfirm);
builder1.Append(">删除</a></td></tr>");
}
}
catch
{}
return builder1;
}
#endregion
#region 加载合同列表
public StringBuilder InitBargainList(Parameter parms)
{
StringBuilder builder1=new StringBuilder();
System.Data.DataRow[] funcRows=null;
DataTable table1 = null;
try
{
if (((SysUserInfo)base.Session["userinfo"]).UserId=="0000000001")
{table1 =(DataTable) BLL.Bargain.GetAllBargain();}
else
{table1 =(DataTable) BLL.Bargain.GetBargainByUserId(((SysUserInfo)base.Session["userinfo"]).UserId);}
funcRows = table1.Select();
foreach( System.Data.DataRow funcRow in funcRows )
{
builder1.Append("<tr><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Read&itemid=");
builder1.Append(funcRow["BargainId"]);
builder1.Append("' target='right'>");
builder1.Append(funcRow["BargainId"]);
builder1.Append("</a></td><td class='tr_left'><span class='blue'>");
builder1.Append(BLL.Customer.GetCustomerById(funcRow["CustomerId"].ToString()).CustomerName);
builder1.Append("<span></td><td class='tr_center'><span class='red'>");
builder1.Append(funcRow["SubmitDate"].ToString());
builder1.Append("</span></td><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Delete&itemid=");
builder1.Append(funcRow["BargainId"].ToString());
builder1.Append("' target='right'>删除</a></td></tr>");
}
}
catch
{}
return builder1;
}
#endregion
#region 加载历史列表
/*public StringBuilder InitHistoryList(Parameter parms)
{
StringBuilder builder1=new StringBuilder();
System.Data.DataRow[] funcRows=null;
try
{
DataTable table1 =(DataTable) BLL.Order.GetAllOrder();
funcRows = table1.Select();
foreach( System.Data.DataRow funcRow in funcRows )
{
builder1.Append("<tr><td class='tr_center'>");
builder1.Append(funcRow["HId"]);
builder1.Append("</td><td class='tr_left'><span class='spacing'></span><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Read&itemid=");
builder1.Append(funcRow["HId"]);
builder1.Append("' target='right'>");
builder1.Append("</a></td><td class='tr_center'><span class='red'>");
builder1.Append(BLL.Order.GetOrderById(BLL.History.GetHistoryById(funcRow["HId"].ToString()).HId).BZ);
builder1.Append("</span></td><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append(funcRow["BZ"]);
builder1.Append("</font></td><td class='tr_center'>");
builder1.Append(funcRow["MDate"]);
builder1.Append("</td><td class='tr_center'><span class=red>");
builder1.Append(funcRow["OptState"].ToString().Trim() == "1" ? "成功" : "失败");//操作模块
builder1.Append("</span></td><td class='tr_center'><a href='Default_right.aspx?u=");
builder1.Append(parms.UserControl);
builder1.Append("&action=Delete&itemid=");
builder1.Append(funcRow["LogId"]);
builder1.Append("' target='right'>删除</a></td></tr>");
}
}
catch
{}
return builder1;
}*/
#endregion
//
#region 系统用户操作
public string SysUserOption(string option , Model.SysUserInfo user,string roleid,Parameter parms)
{
UserPower power = this.GetUserPower(parms);
if (option == "Add" && power.Add == true)
{
try
{BLL.SysUser.Insert(user,roleid);this.WirteSysLog(parms.UserControl,"添加系统用户","1",null);return this.AddSucceed;}
catch
{this.WirteSysLog(parms.UserControl,"添加系统用户","0",null);return this.AddFailed;}
}
else if(option == "Update" && power.Update == true )
{
try
{BLL.SysUser.Update(user,roleid);this.WirteSysLog(parms.UserControl,"修改系统用户信息","1",null);return this.UpdateSucceed;}
catch
{this.WirteSysLog(parms.UserControl,"修改系统用户信息","0",null);return this.UpdateFailed;}
}
return this.PowerPoor;
}
#endregion
#region 客户分类操作
public string CustomerTypeOption(string option, Model.CustomerTypeInfo type,Parameter parms)
{
UserPower power = this.GetUserPower(parms);
if (option == "Add" && power.Add == true)
{
try
{BLL.CustomerType.Insert(type);this.WirteSysLog(parms.UserControl,"添加客户分类信息","1",null);}
catch
{this.WirteSysLog(parms.UserControl,"添加客户分类信息","0",null);return this.AddFailed;}
return this.AddSucceed;
}
else if(option == "Update" && power.Update == true )
{
try
{BLL.CustomerType.Update(type);this.WirteSysLog(parms.UserControl,"修改客户分类信息","1",null);}
catch
{this.WirteSysLog(parms.UserControl,"修改客户分类信息","0",null);return this.UpdateFailed;}
return this.UpdateSucceed;
}
return this.PowerPoor;
}
#endregion
#region 客户信息操作
public string CustomerInfoOption(string option ,Model.CustomerInfo customer,Parameter parms)
{
UserPower power = this.GetUserPower(parms);
if (option == "Add" && power.Add == true)
{
try
{
BLL.Customer.Insert((SysUserInfo)Session["userinfo"],customer);
this.WirteSysLog(parms.UserControl,"添加客户信息","1",null);}
catch
{this.WirteSysLog(parms.UserControl,"添加客户信息","0",null);return this.AddFailed;}
return this.AddSucceed;
}
else if(option == "Update" && power.Update == true )
{
try
{BLL.Customer.Update(customer);this.WirteSysLog(parms.UserControl,"修改客户信息","1",null);}
catch
{this.WirteSysLog(parms.UserControl,"修改客户信息","0",null);return this.UpdateFailed;}
return this.UpdateSucceed;
}
return this.PowerPoor;
}
#endregion
#region 联系人信息操作
public string DeputyOption(string option ,Model.DeputyInfo deputy,Parameter parms)
{
UserPower power = this.GetUserPower(parms);
if (option == "Add" && power.Add == true)
{
try
{
BLL.Deputy.Insert(deputy);
this.WirteSysLog(parms.UserControl,"添加联系人信息","1",null);
}
catch
{this.WirteSysLog(parms.UserControl,"添加联系人信息","0",null);return this.AddFailed;}
return this.AddSucceed;
}
else if(option == "Update" && power.Update == true )
{
try
{BLL.Deputy.Update(deputy);this.WirteSysLog(parms.UserControl,"修改联系人信息","1",null);}
catch
{this.WirteSysLog(parms.UserControl,"修改联系人信息","0",null);return this.UpdateFailed;}
return this.UpdateSucceed;
}
return this.PowerPoor;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -