/// <summary> /// 用户登录(检查密码是否正确 是否已经在另一台机器登录等) /// </summary> /// <param name="strHost"></param> /// <param name="strPort"></param> /// <param name="strUser"></param> /// <param name="strPwd"></param> /// <param name="strLoginMethod"></param> /// <param name="strClientMachineName"></param> /// <returns></returns> public static OperationDataArgs UserLogin(string strHost, string strPort, string strUser, string strPwd, string strLoginMethod, string strClientMachineName) { OperationDataArgs result = new OperationDataArgs(); BasicHttpBinding binding = Common.CreateBasicHttpBinding(60); EndpointAddress adress = Common.CreateEndPoint("HTTP", strHost, strPort, "WcfServices", "Service00000"); Service00000Client client = new Service00000Client(binding, adress); try { List <string> lstParams = new List <string>(); string LStrVerificationCode004 = Common.CreateVerificationCode(PFShareClassesC.EncryptionAndDecryption.UMPKeyAndIVType.M004); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(strUser, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(strPwd, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(strLoginMethod, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(strClientMachineName, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); result = client.OperationMethodA(11, lstParams); } catch (Exception ex) { result.BoolReturn = false; result.StringReturn = ex.Message; } finally { if (client.State == CommunicationState.Opened) { client.Close(); } } return(result); }
private void IBackgroundWorkerObtainNeededData_DoWork(object sender, DoWorkEventArgs e) { List <string> LListStrWcfArgs = new List <string>(); Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; IDataTableMAMTSupportL = new DataTable(); LListStrWcfArgs.Add(App.GClassSessionInfo.LangTypeInfo.LangID.ToString()); LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LWCFOperationReturn = LService00000Client.OperationMethodA(31, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTableMAMTSupportL = LWCFOperationReturn.DataSetReturn.Tables[0]; } else { IDataTableMAMTSupportL = null; } LService00000Client.Close(); LService00000Client = null; }
public static OperationDataArgs UserLogOff() { OperationDataArgs result = new OperationDataArgs(); BasicHttpBinding binding = Common.CreateBasicHttpBinding(60); EndpointAddress adress = Common.CreateEndPoint("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, "WcfServices", "Service00000"); Service00000Client client = new Service00000Client(binding, adress); try { List <string> lstParams = new List <string>(); string LStrVerificationCode004 = Common.CreateVerificationCode(PFShareClassesC.EncryptionAndDecryption.UMPKeyAndIVType.M004); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(App.GCurrentUser.TenantID, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(App.GCurrentUser.UserID, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); lstParams.Add(EncryptionAndDecryption.EncryptDecryptString(App.GCurrentUser.SessionID, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004)); result = client.OperationMethodA(12, lstParams); } catch (Exception ex) { result.BoolReturn = false; result.StringReturn = ex.Message; } finally { if (client.State == CommunicationState.Opened) { client.Close(); } } return(result); }
/// <summary> /// 加载语言包 /// </summary> public static void LoadApplicationLanguages() { Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); IDataTableLanguage = new DataTable(); LListStrWcfArgs.Add(GClassSessionInfo.LangTypeInfo.LangID.ToString()); LWCFOperationReturn = LService00000Client.OperationMethodA(33, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTableLanguage = LWCFOperationReturn.DataSetReturn.Tables[0]; } } catch { } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); } } } }
/// <summary> /// 根据ObjectID和Page获得对应的语言 /// </summary> /// <param name="strUmpServerPort"></param> /// <param name="strUmpServerHost"></param> /// <param name="strDBHost"></param> /// <param name="strDBPort"></param> /// <param name="strMessageID"></param> /// <returns></returns> public static string GetLanguageItemInDBByObjectIDAndPage(ServerInfomation UmpServer, DBInfo dbInfo, string strObjectID, string strLanCode, string strPage) { string strConnString = string.Empty; switch (dbInfo.DbType) { case (int)Enums.DBType.MSSQL: strConnString = App.CreateMSSqlConnString(dbInfo); break; case (int)Enums.DBType.Oracle: strConnString = App.CreateOracleConnString(dbInfo); break; } string strMessageContent = string.Empty; OperationDataArgs result = new OperationDataArgs(); BasicHttpBinding binding = Common.CreateBasicHttpBinding(60); EndpointAddress adress = Common.CreateEndPoint("HTTP", UmpServer.Host, UmpServer.Port, "WcfServices", "Service00000"); Service00000Client client = new Service00000Client(binding, adress); try { List <string> lstParams = new List <string>(); lstParams.Add(dbInfo.DbType.ToString()); lstParams.Add(strConnString); lstParams.Add(strLanCode); lstParams.Add("M21"); lstParams.Add("0"); lstParams.Add(strPage); result = client.OperationMethodA(8, lstParams); } catch (Exception ex) { result.BoolReturn = false; result.StringReturn = ex.Message; } finally { if (client.State == CommunicationState.Opened) { client.Close(); } } if (result.BoolReturn) { if (result.DataSetReturn.Tables.Count > 0) { List <DataRow> lstRows = result.DataSetReturn.Tables[0].Select("C012 = '" + strObjectID + "'").ToList(); if (lstRows.Count > 0) { strMessageContent = lstRows[0]["C005"].ToString(); } } } return(strMessageContent); }
private void IBWSaveData_DoWork(object sender, DoWorkEventArgs e) { Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { LListStrWcfArgs = e.Argument as List <string>; LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LWCFOperationReturn = LService00000Client.OperationMethodA(27, LListStrWcfArgs); IStrCallReturn = LWCFOperationReturn.StringReturn; IBoolCallReturn = LWCFOperationReturn.BoolReturn; IListStrAfterSave.Clear(); if (IBoolCallReturn) { foreach (string LStrSingleArgs in LListStrWcfArgs) { IListStrAfterSave.Add(LStrSingleArgs); } IListStrAfterSave[5] = IStrCallReturn; App.LoadAboutAgentData(); } } catch (Exception ex) { IBoolCallReturn = false; IStrCallReturn = ex.ToString(); } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); LService00000Client = null; } } } }
public static List <DBInfo> GetAllDBs(string strHost, string strPort) { List <DBInfo> lstResult = new List <DBInfo>(); BasicHttpBinding binding = Common.CreateBasicHttpBinding(60); EndpointAddress adress = Common.CreateEndPoint("HTTP", strHost, strPort, "WcfServices", "Service00000"); Service00000Client client = new Service00000Client(binding, adress); try { OperationDataArgs resultArgs = client.OperationMethodA(5, null); if (resultArgs.BoolReturn) { DBInfo dbInfo; DataRow row; int iDBtype = 0; string LStrVerificationCode = Common.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104); for (int i = 0; i < resultArgs.DataSetReturn.Tables[0].Rows.Count; i++) { row = resultArgs.DataSetReturn.Tables[0].Rows[i]; dbInfo = new DBInfo(); int.TryParse(row["DBType"].ToString(), out iDBtype); dbInfo.DbType = iDBtype; dbInfo.Host = EncryptionAndDecryption.EncryptDecryptString(row["ServerHost"].ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104); dbInfo.Port = EncryptionAndDecryption.EncryptDecryptString(row["ServerPort"].ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104); dbInfo.ServiceName = EncryptionAndDecryption.EncryptDecryptString(row["NameService"].ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104); dbInfo.LoginName = EncryptionAndDecryption.EncryptDecryptString(row["LoginID"].ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104); dbInfo.Password = EncryptionAndDecryption.EncryptDecryptString(row["LoginPwd"].ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104); lstResult.Add(dbInfo); } } } catch { } finally { if (client.State == CommunicationState.Opened) { client.Close(); } } return(lstResult); }
public void Load11009Data() { Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { IDataTable11009 = new DataTable(); LListStrWcfArgs.Add(Session.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(Session.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(Session.RentInfo.Token); LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(Session); LEndpointAddress = WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LWCFOperationReturn = LService00000Client.OperationMethodA(18, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTable11009 = LWCFOperationReturn.DataSetReturn.Tables[0]; //全部翻译 foreach (DataRow dr in IDataTable11009.Rows) { dr["C006"] = DecryptString(dr["C006"].ToString()); } } } catch (Exception ex) { ShowExceptionMessage(ex.Message); } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); } } } }
protected override void InitLanguageInfos() { base.InitLanguageInfos(); Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { IDataTableLanguage = new DataTable(); LListStrWcfArgs.Add(Session.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(Session.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(Session.LangTypeInfo.LangID.ToString()); LListStrWcfArgs.Add("M22"); LListStrWcfArgs.Add("11"); LListStrWcfArgs.Add("1106"); LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(Session); LEndpointAddress = WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LWCFOperationReturn = LService00000Client.OperationMethodA(8, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTableLanguage = LWCFOperationReturn.DataSetReturn.Tables[0]; } } catch { } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); } } } }
/// <summary> /// 加载本应用程序的权限列表 /// </summary> public static void LoadThidModuleOperation() { Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { IDataTableOperation = new DataTable(); LBasicHttpBinding = WebHelper.CreateBasicHttpBingding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(GClassSessionInfo.RentInfo.Token); LListStrWcfArgs.Add(GClassSessionInfo.UserInfo.UserID.ToString()); LListStrWcfArgs.Add(GClassSessionInfo.RoleInfo.ID.ToString()); LListStrWcfArgs.Add("11"); LWCFOperationReturn = LService00000Client.OperationMethodA(16, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTableOperation = LWCFOperationReturn.DataSetReturn.Tables[0]; } } catch { } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); } } } }
//加载所有的参数的内容(从T_11_001里面获取) public void LoadSecurityPlicy() { Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { GDataTable11001 = new DataTable(); LListStrWcfArgs.Add(Session.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(Session.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(Session.RentInfo.Token); LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(Session); LEndpointAddress = WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LWCFOperationReturn = LService00000Client.OperationMethodA(17, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { GDataTable11001 = LWCFOperationReturn.DataSetReturn.Tables[0]; GDataTable00003 = LWCFOperationReturn.ListDataSetReturn[0].Tables[0]; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); } } } }
void BtnConfirm_Click(object sender, RoutedEventArgs e) { if (!CheckInput()) { return; } try { string strOldPass = TxtOldPassword.Password.Trim(); string strNewPass = TxtNewPassword.Password.Trim(); List <string> listArgs = new List <string>(); listArgs.Add(CurrentApp.Session.RentInfo.Token); listArgs.Add(CurrentApp.Session.UserID.ToString()); listArgs.Add(strOldPass); listArgs.Add(strNewPass); listArgs.Add(S1202App.LoginSessionID); for (int i = 0; i < listArgs.Count; i++) { listArgs[i] = S1202App.EncryptString(listArgs[i]); } Service00000Client client = new Service00000Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service00000")); OperationDataArgs retArgs = client.OperationMethodA(14, listArgs); client.Close(); string strReturn = retArgs.StringReturn; CurrentApp.WriteLog("ChangePassword", string.Format("Change password return: {0}", strReturn)); if (!retArgs.BoolReturn) { ShowException(CurrentApp.GetLanguageInfo("S0000039", "Change password fail.")); return; } strReturn = S1202App.DecryptString(strReturn); if (strReturn != "S01A01") { #region 错误消息 //ShowException(CurrentApp.GetLanguageInfo("S0000039", "Change password fail.")); switch (strReturn) { case "W000E02": ShowException(CurrentApp.GetLanguageInfo("S0000060", "")); break; case "W000E03": ShowException(CurrentApp.GetLanguageInfo("S0000061", "")); break; case "W000E04": ShowException(CurrentApp.GetLanguageInfo("S0000062", "")); break; case "W000E05": ShowException(CurrentApp.GetLanguageInfo("S0000063", "")); break; case "W000E06": ShowException(CurrentApp.GetLanguageInfo("S0000064", "")); break; case "W000E08": ShowException(CurrentApp.GetLanguageInfo("S0000078", "Get password history fail.")); break; case "W000E09": ShowException(CurrentApp.GetLanguageInfo("S0000079", "Get security settings fail.")); break; case "W000E10": ShowException(CurrentApp.GetLanguageInfo("S0000080", "Save password to database fail.")); break; case "W000E11": ShowException(CurrentApp.GetLanguageInfo("S0000081", "")); break; case "W000E12": ShowException(CurrentApp.GetLanguageInfo("S0000082", "")); break; } #endregion return; } MessageBox.Show(CurrentApp.GetLanguageInfo("S0000040", "Change password successful"), CurrentApp.AppTitle, MessageBoxButton.OK, MessageBoxImage.Information); CurrentApp.Session.UserInfo.Password = S1202App.EncryptString(strNewPass); #region 通知密码修改 try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.SCGlobalSettingChanged; webRequest.ListData.Add(ConstValue.GS_KEY_PARAM_PASSWORD); webRequest.ListData.Add(CurrentApp.Session.UserInfo.Password); webRequest.ListData.Add(string.Empty); CurrentApp.PublishEvent(webRequest); } catch (Exception ex) { CurrentApp.WriteLog("ChangePassword", string.Format("Send change password notification fail.\t{0}", ex.Message)); } #endregion mOptResult = RESULT_SUCC; if (PageParent != null) { PageParent.OnChangePasswordResult(mOptResult); } } catch (Exception ex) { ShowException(ex.Message); } }
public static void LoadAboutAgentData() { Service00000Client LService00000Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); string LStrVerificationCode104 = string.Empty; try { LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104); IDataTable11005 = new DataTable(); IDataTable11006 = new DataTable(); IDataTable11101 = new DataTable(); IDataTable11009 = new DataTable(); IDataTable11201SA = new DataTable(); IDataTable11201UA = new DataTable(); IDataTable11201UO = new DataTable(); IDataTable11201UU = new DataTable(); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(GClassSessionInfo.RentInfo.Token); LListStrWcfArgs.Add(GClassSessionInfo.UserInfo.UserID.ToString()); LBasicHttpBinding = WebHelper.CreateBasicHttpBinding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service00000"); OperationDataArgs LWCFOperationReturn = new OperationDataArgs(); LService00000Client = new Service00000Client(LBasicHttpBinding, LEndpointAddress); LWCFOperationReturn = LService00000Client.OperationMethodA(26, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTable11005 = LWCFOperationReturn.ListDataSetReturn[0].Tables[0]; IDataTable11006 = LWCFOperationReturn.ListDataSetReturn[1].Tables[0]; IDataTable11101 = LWCFOperationReturn.ListDataSetReturn[2].Tables[0]; IDataTable11009 = LWCFOperationReturn.ListDataSetReturn[3].Tables[0]; IDataTable11201SA = LWCFOperationReturn.ListDataSetReturn[4].Tables[0]; IDataTable11201UA = LWCFOperationReturn.ListDataSetReturn[5].Tables[0]; IDataTable11201UO = LWCFOperationReturn.ListDataSetReturn[6].Tables[0]; IDataTable11201UU = LWCFOperationReturn.ListDataSetReturn[7].Tables[0]; foreach (DataRow LDataRowSingleAgent in IDataTable11101.Rows) { if (LDataRowSingleAgent["C002"].ToString() != "1") { continue; } LDataRowSingleAgent["C017"] = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleAgent["C017"].ToString(), LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { if (LService00000Client != null) { if (LService00000Client.State == CommunicationState.Opened) { LService00000Client.Close(); } } } }