📄 agentwork.cs
字号:
//公告板的组显示
public static void DDL_Group(DropDownList c,string text,string val)
{
DataTable dt=Group;
if(dt.Rows.Count==0)
{
c.Enabled=false;
return;
}
c.Items.Clear();
ListItem itf=new ListItem(text,val);
c.Items.Add(itf);
for(int i=0;i<dt.Rows.Count ;i++)
{
ListItem it=new ListItem(dt.Rows[i]["grpname"].ToString(),dt.Rows[i]["grpid"].ToString());
c.Items.Add(it);
}
}
public static bool IsCanDoCase(string id,string usr)
{
OLEDB mydb=Agentwork.db;
int i=mydb.ExecuteCommand("update t_case set next_user='"+usr+"' where next_user is null and caseid='"+id+"'");
if(i==1)
return true;
else
return false;
}
//******************************************************************
// public static Env Env
// {
// get
// {
// return _env;
// }
// }
// public static void BuildEnv(string IniFile)
// {
// _env=new Env();
//
// XmlDocument xDoc=new XmlDocument();
// xDoc.Load(IniFile);
// XmlNode root=xDoc.DocumentElement;
// for(int i=0;i<root.ChildNodes.Count;i++)
// {
// XmlElement xe=(XmlElement)root.ChildNodes[i];
// XmlText xt=(XmlText)xe.FirstChild;
// if(xt!=null)
// {
// string name=xe.Name;
// string val=xt.Value;
// _env[name]=val;
// }
// }
//
// xDoc=null;
// }
// //生成sql语句中的翻译项目
// public static string CreateSql(OLEDB od,string sql,string casefield,string field,string text,string asField)
// {
// string s="";
// DataTable dt=new DataTable();
// od.FillTable(dt,sql);
// for(int i=0;i<dt.Rows.Count;i++)
// {
// if ((dt.Rows[i][field].ToString().Trim()!="")&&
// (dt.Rows[i][text].ToString().Trim()!=""))
// s +=" when '" + dt.Rows[i][field].ToString().Trim() + "' then '" +dt.Rows[i][text].ToString().Trim() + "' " ;
// }
// if (s!="")
// {
// s="case " + casefield + s ;
// s+= " else '' end ";
// }
// else
// s=" '' ";
// s+=" as " + asField ;
// return s;
// }
// public static DataTable GetDDLValue()
// {
// OLEDB od=new OLEDB();
// od.Init(1);
//
// string ls_sql="select * from t_value order by value_type,value_id";
// DataTable dt=new DataTable();
// od.FillTable(dt,ls_sql);
//
// return dt;
// }
// public static void DDL_Init(DataTable dtValue,DropDownList c,string value_type)
// {
// DataRow[] drs=dtValue.Select("value_type='" + value_type +"'");
// DataTable dt=dtValue.Clone();
// for(int i=0;i<drs.Length;i++)
// {
// DataRow dr=dt.NewRow();
// dr.ItemArray=drs[i].ItemArray;
// dt.Rows.Add(dr);
// }
//
// c.DataSource=dt;
// c.DataTextField="value_dsc";
// c.DataValueField="value_id";
// c.DataBind();
// }
// public static void DDL_Init(DataTable dtValue,DropDownList c,bool emptyLine,string value_type)
// {
// DataRow[] drs=dtValue.Select("value_type='" + value_type +"'");
// DataTable dt=dtValue.Clone();
// for(int i=0;i<drs.Length;i++)
// {
// DataRow dr=dt.NewRow();
// dr.ItemArray=drs[i].ItemArray;
// dt.Rows.Add(dr);
// }
//
// if (emptyLine )
// {
// DataRow dr=dt.NewRow();
// dr["value_dsc"]="";
// dr["value_id"]="0";
// dt.Rows.InsertAt(dr,0);
// }
//
// c.DataSource=dt;
// c.DataTextField="value_dsc";
// c.DataValueField="value_id";
// c.DataBind();
// }
// public static void DDL_Init(DropDownList c,string value_type)
// {
// string ls_sql;
//
// //OLEDB od=db;
// //测试
// OLEDB od=new OLEDB();
// od.Init(1);
//
// ls_sql="select * from t_value where value_type='"+value_type+"'";
// DataTable dt=new DataTable();
// od.FillTable(dt,ls_sql);
//
// c.DataSource=dt;
// c.DataTextField="value_dsc";
// c.DataValueField="value_id";
// c.DataBind();
// }
// public static void DDL_Init(DropDownList c,bool emptyLine,string value_type)
// {
// string ls_sql;
//
// //OLEDB od=db;
// //测试
// OLEDB od=new OLEDB();
// od.Init(1);
//
// ls_sql="select * from t_value where value_type='"+value_type+"'";
// DataTable dt=new DataTable();
// od.FillTable(dt,ls_sql);
//
// if (emptyLine )
// {
// DataRow dr=dt.NewRow();
// dr["value_dsc"]="";
// dr["value_id"]="0";
// dt.Rows.InsertAt(dr,0);
// }
//
// c.DataSource=dt;
// c.DataTextField="value_dsc";
// c.DataValueField="value_id";
// c.DataBind();
// }
//
// public static void DDL_Init(DropDownList c,string value_type,bool topSpacingLine)
// {
// string ls_sql;
//
// //OLEDB od=db;
// //测试
// OLEDB od=new OLEDB();
// od.Init(1);
//
// ls_sql="select * from t_value where value_type='"+value_type+"'";
// od.AddTable("t_value");
// od.FillTable("t_value",ls_sql);
// c.DataSource=od.ds.Tables["t_value"];
// c.DataTextField="value_dsc";
// c.DataValueField="value_id";
// c.DataBind();
//
// if( topSpacingLine )
// {
// c.Items.Insert(0,"");
// }
// }
// public static void DDL_Init_child(DropDownList c,string value_type,string parentid)
// {
// string ls_sql;
//
// //OLEDB od=db;
// //测试
// OLEDB od=new OLEDB();
// od.Init(1);
//
// ls_sql="select * from t_value where value_type='"+value_type
// +"' and parent_id="+parentid;
// od.AddTable("t_value");
// od.FillTable("t_value",ls_sql);
// c.DataSource=od.ds.Tables["t_value"];
// c.DataTextField="value_dsc";
// c.DataValueField="value_id";
// c.DataBind();
// }
// static public void BuildAgentWorkArea()
// {
// // try
// // {
// // Directory.CreateDirectory(WorkArea);
// // }
// // catch{}
// // try
// // {
// // Directory.CreateDirectory(TechLink);
// // }
// // catch{}
// // try
// // {
// // Directory.CreateDirectory(PictureLink);
// // }
// // catch{}
// try
// {
// Directory.CreateDirectory(ProfilePath);
// }
// catch{}
// }
//
// public static string GetProfile(string host)
// {
// return ProfilePath+"/"+host+".xml";
// }
// static private void ClearWarkArea()
// {
// HttpSessionState sess=HttpContext.Current.Session;
// string agentid=(string)sess["agent_id"];
// string path=WorkArea+"/"+agentid+"/";
// String[] Files;
// Files=Directory.GetFileSystemEntries(path);
// foreach(string Element in Files)
// {
// try
// {
// File.Delete(Element);
// }
// catch
// {
// }
// }
// }
public static string TheSessionId()
{
HttpSessionState cursession = HttpContext.Current.Session;
string sessionid =
System.Convert.ToString(HttpContext.Current.Session["sessionid"]).Trim();
if(sessionid.Length < 1)
{
sessionid = cursession.SessionID.Trim() ;
HttpContext.Current.Session["sessionid"] = sessionid;
}
return sessionid;
}
// static public string GetOutputXml(string prefix)
// {
// HttpSessionState sess=HttpContext.Current.Session;
// string s=DateTime.Now.ToString("yyyyMMddhhmmss");
// string agentid=(string)sess["agent_id"];
// string ret=WorkArea+"/"+agentid+"/"+prefix+"_"+s+".xml";
// return ret;
// }
// static public string GetTechLinkFile(string f)
// {
// return TechLink+"/"+f;
// }
//
// static public string GetPictureLinkFile(string f)
// {
// return PictureLink+"/"+f;
// }
//
// static public string GetScriptLinkFile(string f)
// {
// return ScriptLink+"/"+f;
// }
//
// static public string GetTempletLinkFile(string f)
// {
// return TempletLink+"/"+f;
// }
//
// static public string GetCaseAttachFile(string f)
// {
// return CaseAttach+"/"+f;
// }
//
// static public string GetXmlLinkFile(string f)
// {
// return XmlLink + "/" + f;
// }
//
// static public string GetPromotionLinkFile(string f)
// {
// return PromotionLink + "/" + f;
// }
static public void BuildForConfirm(Button b,string msg)
{
b.Attributes["confirmmsg"]=msg;
b.Attributes["onclick"]="javascript:"
+"if(!confirm(this.getAttribute('confirmmsg'))){"
+"event.returnValue=false;"
+"event.cancelBubble=true;"
+"}";
}
static public HttpResponse Response
{
get
{
HttpContext sess=HttpContext.Current;
return sess.Response;
}
}
static public OLEDB db
{
get
{
HttpSessionState sess=HttpContext.Current.Session;
if( sess["ole_db"] == null )
{
InitDB();
}
return (OLEDB)sess["ole_db"];
}
set
{
HttpSessionState sess=HttpContext.Current.Session;
sess["ole_db"]=value;
}
}
private static void InitDB()
{
OLEDB newDB = new OLEDB();
newDB.Init(1);
Agentwork.db = newDB;
}
// static public string PhoneID
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (string)sess["phone_id"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// sess["phone_id"]=value;
// }
// }
// static public Priv MyPriv
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Priv)sess["my_priv"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// sess["my_priv"]=value;
// }
// }
// static public Task MyTask
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Task)sess["my_task"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("my_task");
// }
// else
// {
// sess["my_task"]=value;
// }
// }
// }
// static public Task CaseTask
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Task)sess["case_task"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("case_task");
// }
// else
// {
// sess["case_task"]=value;
// }
// }
// }
//dlb:2004-08-06修改-删除了类Org的定义
// static public Org MyOrg
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Org)sess["my_org"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("my_org");
// }
// else
// {
// sess["my_org"]=value;
// }
// }
// }
//dlb:2004-08-06修改-添加了类Contact的定义
// static public Contact MyContact
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Contact)sess["my_contact"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("my_contact");
// }
// else
// {
// sess["my_contact"]=value;
// }
// }
// }
//
//
// static public Case MyCase
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Case)sess["my_case"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("my_case");
// }
// else
// {
// sess["my_case"]=value;
// }
// }
// }
//
// static public Contact PrintContact
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Contact)sess["PrintContact"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("PrintContact");
// }
// else
// {
// sess["PrintContact"]=value;
// }
// }
// }
//
//
// static public Case PrintCase
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (Case)sess["PrintCase"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("PrintCase");
// }
// else
// {
// sess["PrintCase"]=value;
// }
// }
// }
//
// static public string CallType
// {
// get
// {
// HttpSessionState sess=HttpContext.Current.Session;
// return (string)sess["my_calltype"];
// }
// set
// {
// HttpSessionState sess=HttpContext.Current.Session;
// if(value==null)
// {
// sess.Remove("my_calltype");
// }
// else
// {
// sess["my_calltype"]=value;
// }
// }
// }
static public string sql_todate(string val)
{
return "to_date('"+val+"','yyyy-mm-dd hh24:mi:ss')";
}
}
// public class Env : SortedList
// {
// private SortedList _env=new SortedList();
//
// public Env()
// {
// }
//
// public string this[string name]
// {
// get
// {
// return (string)_env[(string)name];
// }
//
// set
// {
// _env.Add(name,value);
// }
// }
// }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -