private static RTXSAPIRootObj RootObj; //声明一个根对象 #endregion Fields #region Constructors static RtxHelper() { RootObj = new RTXSAPIRootObj(); RootObj.ServerIP = RtxServerIp; RootObj.ServerPort = RtxSdkApiPort; }
private static RTXSAPIRootObj RootObj; //声明一个根对象 #region 构造函数 static RtxHelper() { RootObj = new RTXSAPIRootObj(); RootObj.ServerIP = RtxServerIp; RootObj.ServerPort = RtxSdkApiPort; }
//private static RTXSAPILib.RTXSAPIRootObj RootObj; public static bool IsUserExisted(string username) { RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj(); RTXSAPILib.RTXSAPIUserManager UserManagerObj = RootObj.UserManager; bool bRet = false; try { bRet = UserManagerObj.IsUserExist(username); } catch (COMException ex) { } return bRet; }
public string RTX_SendIM(string sSender, string sPwd, string sMsg, string sReceiver) { string sErr = ""; try { RTXSAPIRootObj RootObj = new RTXSAPIRootObj(); //创建根对象 RootObj.ServerIP = "192.168.1.3"; RootObj.ServerPort = 8006; string sSessionID = "{f1b15e85-2542-4220-90b8-8be3661eaa38}"; RootObj.SendIM(sSender, sPwd, sReceiver, sMsg, sSessionID); } catch (Exception ex) { sErr = ex.Message; } return(sErr); }
//服务器端代码 public static string GetSessionKey(string Account) { string SessionKey = ""; RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj(); //创建一个根对象 RTXSAPILib.RTXSAPIUserAuthObj UserAuthObj = RootObj.UserAuthObj; //创建一个用户认证对象 RootObj.ServerIP = ConfigurationManager.AppSettings["rtxServerIP"]; //设置服务器IP,"127.0.0.1" RootObj.ServerPort = Convert.ToInt16(ConfigurationManager.AppSettings["rtxServerAppPort"]); //设置Appserver端口,8006 try { SessionKey = UserAuthObj.GetSessionKey(Account); //通过用户认证对象获取SessionKey,貌似正确的帐号才能正确获取SessionKey } catch (COMException ex) { //Response.Write("<script language='javascript'>alert('ex.Message')</script>"); } return SessionKey; //返回SessionKey }
protected void Page_Load(object sender, EventArgs e) { string strName =Request.Form["txtName"]; string strSign = Request.Form["txtSign"]; if(!string.IsNullOrEmpty(strName)&&!string.IsNullOrEmpty(strSign)) { RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj(); //创建一个根对象 RTXSAPILib.IRTXSAPIUserAuthObj2 AuthObj2 = (RTXSAPILib.IRTXSAPIUserAuthObj2)RootObj.UserAuthObj; Response.Write(strName); Response.Write(strSign); bool bOK = AuthObj2.SignatureAuth(strName, strSign); if (bOK) { Response.Redirect("OA.html"); } else { Response.Redirect("error.html"); } } }
public FormMain() { InitializeComponent(); try { // Control.CheckForIllegalCrossThreadCalls = false; DbHelperSQLite.connectionString = _sqlitstr; string sqlstr = "SELECT * FROM CONFIG WHERE ID=1"; DataSet ds = DbHelperSQLite.Query(sqlstr); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows != null) { tboxRIP.Text = ds.Tables[0].Rows[0]["RIP"].ToString(); tboxRPort.Text = ds.Tables[0].Rows[0]["RPORT"].ToString(); tboxRUser.Text = ds.Tables[0].Rows[0]["RUSER"].ToString(); tboxRPSW.Text = ds.Tables[0].Rows[0]["RPSW"].ToString(); textBoxConnStr.Text = ds.Tables[0].Rows[0]["TCONN"].ToString(); textBoxTFSUser.Text = ds.Tables[0].Rows[0]["TUSER"].ToString(); textBoxTFSPsw.Text = ds.Tables[0].Rows[0]["TPSW"].ToString(); tboxMailIP.Text = ds.Tables[0].Rows[0]["TMAIL"].ToString(); tboxMailPort.Text = ds.Tables[0].Rows[0]["TMAILPORT"].ToString(); radioButtonGroup.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["TQUN"]); radioButtonOne.Checked = !radioButtonGroup.Checked; checkBoxSys.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["TSYS"]); tboxSysAlertTime.Text = ds.Tables[0].Rows[0]["TSYSTIME"].ToString(); checkBoxIM.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["TIM"]); jbtxno = ds.Tables[0].Rows[0]["JBTXN"].ToString(); textBoxTFSDetailURL.Text = ds.Tables[0].Rows[0]["TFSDETAILURL"].ToString(); WriteLog("参数设置读取成功!"); } else { WriteLog("参数设置读取失败!"); } RootObj = new RTXSAPIRootObj(); //创建根对象 AObj = RootObj.CreateAPIObj(); AObj.OnRecvMessage += new _IRTXSAPIObjEvents_OnRecvMessageEventHandler(RecvMessageEvent); this.SMTP_Server = new LumiSoft.Net.SMTP.Server.SMTP_Server(this.components); // // SMTP_Server // SMTP_Server.Enabled = false; this.SMTP_Server.CommandIdleTimeOut = 60000; this.SMTP_Server.LogCommands = false; this.SMTP_Server.MaxBadCommands = 8; this.SMTP_Server.MaxMessageSize = 1000000; this.SMTP_Server.MaxRecipients = 100; this.SMTP_Server.SessionIdleTimeOut = 80000; this.SMTP_Server.AuthUser += new LumiSoft.Net.SMTP.Server.AuthUserEventHandler(this.Server_AuthenticateUser); this.SMTP_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.SMTP_Server_SessionLog); this.SMTP_Server.ValidateMailFrom += new LumiSoft.Net.SMTP.Server.ValidateMailFromHandler(this.smtp_Server_ValidateSender); this.SMTP_Server.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError); this.SMTP_Server.StoreMessage += new LumiSoft.Net.SMTP.Server.NewMailEventHandler(this.smtp_Server_NewMailEvent); this.SMTP_Server.ValidateMailTo += new LumiSoft.Net.SMTP.Server.ValidateMailToHandler(this.smtp_Server_ValidateRecipient); this.SMTP_Server.ValidateMailboxSize += new LumiSoft.Net.SMTP.Server.ValidateMailboxSize(this.SMTP_Server_ValidateMailBoxSize); this.SMTP_Server.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.SMTP_Server_ValidateIPAddress); //------- SMTP Settings ---------------------------------------------// SMTP_Server.IpAddress = tboxMailIP.Text; SMTP_Server.Port = Convert.ToInt32(tboxMailPort.Text); SMTP_Server.Threads = 200; SMTP_Server.SessionIdleTimeOut = 300 * 1000; // 毫秒 SMTP_Server.CommandIdleTimeOut = 120 * 1000; // 毫秒 SMTP_Server.MaxMessageSize = 10 * 1000000; // 字节 SMTP_Server.MaxRecipients = 100; SMTP_Server.MaxBadCommands = 8; SMTP_Server.LogCommands = false; WriteLog("系统初始化成功!"); } catch (System.Exception ex) { WriteLog("系统初始化失败!" + ex.Message); } }
//删除员工部门职位 public string DeleteDepPos(int id) { string retStr = "Succeed"; try { EmpDepPosition oriObj = ctx.EmpDepPositions.Single(r => r.Id == id); #region 获得原职位最高的部门名称,没有部门为null string oriDept = null; Depts dept; EmpDepPosition minEmpDepPosition = ctx.EmpDepPositions.OrderBy(r => r.PosId).First(r => r.EmpId ==oriObj.EmpId); dept = ctx.Depts.Single(r => r.Id == minEmpDepPosition.DeptId); oriDept = dept.Text; #endregion ctx.EmpDepPositions.DeleteOnSubmit(oriObj); ctx.SubmitChanges(); #region 获得原职位最高的部门名称,没有部门为null minEmpDepPosition = ctx.EmpDepPositions.OrderBy(r => r.PosId).FirstOrDefault(r => r.EmpId == oriObj.EmpId); Employee employee = ctx.Employees.Single(r => r.Id == oriObj.EmpId); RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj(); //创建根对象 RTXSAPILib.RTXSAPIDeptManager DeptManagerObj = RootObj.DeptManager; //通过根对象创建部门管理对象 if (minEmpDepPosition != null) { dept = ctx.Depts.Single(r => r.Id == minEmpDepPosition.DeptId); if (oriDept != dept.Text) { DeptManagerObj.AddUserToDept(employee.JobNo, oriDept, dept.Text, false); //添加用户进某个部门,如果用户没有所属部门,源部门名为null即可。 } } else { DeptManagerObj.AddUserToDept(employee.JobNo, oriDept,null, false); //添加用户进某个部门,如果用户没有所属部门,源部门名为null即可。 } #endregion } catch (Exception ex) { retStr =ex.Message; } return retStr; }