public DataSet GetData(string logicName, DataSet request) { DataSet set = null; DataSet set2; try { string assemblyString = logicName.Substring(0, logicName.LastIndexOf(".")); object obj2 = null; if (Type.GetType(logicName) != null) { obj2 = Activator.CreateInstance(Type.GetType(logicName)); } else { obj2 = Activator.CreateInstance(Assembly.Load(assemblyString).GetType(logicName)); } if (obj2 is LogicBase) { LogicBase base2 = (LogicBase) obj2; if (base2.SessionCheck) { this.hzyMessage = HZY.COM.Common.Common.CheckUser(this.hzyMessage.Session_ID); } base2.hzyMessage = this.hzyMessage; base2.RequestBak = this.RequestBak; if (obj2 is HZYLogicBase) { HZYLogicBase base3 = (HZYLogicBase) obj2; base3.Request = request; } else { base2.Request = request; } if (base2 is ILogicGetData) { ILogicGetData data = (ILogicGetData) base2; set = data.GetData(); data = null; } base2 = null; } set2 = set; } catch (Exception exception) { Log.WirteLog(exception, "4"); throw exception; } return set2; }
public string Login(string pAppName, string pCompany, string pEnv, string pLoginEnv, string pUserName, string pPassword) { hzyMessage = new HZYmessage(); try { WS ws = new WS(); return ws.Login(pEnv, pLoginEnv, pUserName, pPassword); } catch (Exception ex) { hzyMessage.ErrorMessage = ex.Message; HZY.COM.Common.Log.WirteLogWS(ex,""); return ""; } }
public bool Excute(string logicName, DataSet request) { bool flag2; bool flag = false; try { string assemblyString = logicName.Substring(0, logicName.LastIndexOf(".")); object obj2 = null; if (Type.GetType(logicName) != null) { obj2 = Activator.CreateInstance(Type.GetType(logicName)); } else { obj2 = Activator.CreateInstance(Assembly.Load(assemblyString).GetType(logicName)); } if (obj2 is LogicBase) { LogicBase base2 = (LogicBase) obj2; if (base2 is ILogicExecute) { base2.Request = request; if (base2.SessionCheck) { this.hzyMessage = HZY.COM.Common.Common.CheckUser(this.hzyMessage.Session_ID); } base2.hzyMessage = this.hzyMessage; base2.RequestBak = this.RequestBak; ILogicExecute execute = (ILogicExecute) base2; flag = execute.Execute(); execute = null; } base2 = null; } flag2 = flag; } catch (Exception exception) { Log.WirteLog(exception, "3"); throw exception; } return flag2; }
public static HZYmessage CheckUser(string SessionID,bool pUpdateLastReustTime) { HZYmessage message = new HZYmessage(); if (SessionID == null || SessionID == "") { throw new Exception("身份验证错误"); } Dbconn conn = new Dbconn("WSRR"); string strSQL = @" SELECT [LoginSessionID] ,[LoginUser] ,[LoginTime] FROM F01_Cert.Login where LoginSessionID=@param0 and LogoutTime is null "; DataTable dt = conn.GetDataTable(strSQL, new string[] { SessionID }); if (dt.Rows.Count == 1) { message.Session_ID = dt.Rows[0]["LoginSessionID"].ToString(); //message.Employee_ID = dt.Rows[0]["LoginUser"].ToString(); message.User_ID = dt.Rows[0]["LoginUser"].ToString(); message.User_Name = dt.Rows[0]["LoginUser"].ToString(); message.User_Name_CN = dt.Rows[0]["LoginUser"].ToString(); if (pUpdateLastReustTime) { //需要更新用户的最后访问日期 conn.BeginTransaction(); conn.ExcuteQuerryByTran("update F01_Cert.Login set LastVisitTime=getdate() where LoginSessionID=@param0", new string[] { message.Session_ID }); conn.CommitTransaction(); } return message; } else { throw new Exception("身份验证错误"); } }
/// <summary> /// 帐户绑定 /// </summary> private void Bind() { DataTable dtList = ds.Tables["List"]; DataTable dtVexSSO = new MDM.VEXSSOUserDataTable(); VexSSOAccreditatio clsVexSSOAccreditatio = new VexSSOAccreditatio(); string strSQL = ""; string strVexSSOLoginUser = dtList.Rows[0]["LoginUser"].ToString(); string strVexSSOPassWord = ""; if (dtList.Columns.Contains("PassWord")) { strVexSSOPassWord = dtList.Rows[0]["PassWord"].ToString(); } string strBindUser = dtList.Rows[0]["BindUser"].ToString(); string strBindPassWord = dtList.Rows[0]["BindPassWord"].ToString(); string strAccreditationType = dtList.Rows[0]["AccreditationType"].ToString().ToUpper(); string strResult = ""; try { if (strVexSSOLoginUser == "") { strResult = "SSO用户名不能为空。"; throw new Exception(strResult); } if (strAccreditationType.ToUpper() == "VEXSSO") { strResult = "VEXSSOSSO不能绑定。"; throw new Exception(strResult); } //POS导购人员 if (strAccreditationType.ToUpper() == "POSEmployee".ToUpper()) { //查询EHR的姓名 strSQL = @" SELECT App_UserName FROM dbo.MDM_System_User t1 WHERE ISNULL(checked,0) =1 AND EXISTS ( SELECT 1 FROM dbo.MDM_System_Env t2 WHERE Env_SN = 'EHRCARD' AND t1.Env_ID = t2.Env_ID ) AND EXISTS ( SELECT 1 FROM B01_MDM.VEXSSOUser t3 WHERE t1.VexSSONewID = t3.VexSSONewID AND ISNULL(Disabled,0)=0 AND t3.VexSSOLoginUser =@Param0 ) "; string strEhrName = m_conn.GetDataTableFirstValue(strSQL, new string[] { strVexSSOLoginUser }).ToString(); if (strEhrName == "") { strResult = "请先绑定EHR帐户。"; throw new Exception(strResult); } strBindPassWord = strEhrName; } //进行绑定账户认证 clsVexSSOAccreditatio.PassWord = strBindPassWord; clsVexSSOAccreditatio.UserName = strBindUser; clsVexSSOAccreditatio.AccreditatioType = strAccreditationType; clsVexSSOAccreditatio.Execute(); //进行认证。 m_BindsysInfo = clsVexSSOAccreditatio.AccreditatioSystemHZYMessage; //进行VEXSSO认证 if (m_SSOCheck) { clsVexSSOAccreditatio.PassWord = strVexSSOPassWord; clsVexSSOAccreditatio.UserName = strVexSSOLoginUser; clsVexSSOAccreditatio.AccreditatioType = "VEXSSO"; clsVexSSOAccreditatio.Execute(); //进行认证。 } //开始进行绑定 string strEnvID = m_conn.GetDataTableFirstValue("SELECT Env_ID FROM dbo.MDM_System_env WHERE Env_SN=@param0", new string[] { strAccreditationType }).ToString(); if (strEnvID == "") { strResult = "系统错误:待绑定的系统不存在!"; throw new Exception(strResult); } string strVexSSONewID = m_conn.GetDataTableFirstValue("SELECT [VexSSONewID] FROM B01_MDM.[VEXSSOUser] WHERE VexSSOLoginUser=@Param0 AND ISNULL(Disabled,0)=0", new string[] { strVexSSOLoginUser }).ToString(); ; //检查VEXSSO账户是否已经被其他用户绑定 strSQL = @" SELECT VexSSONewID,t1.app_userName,t1.Env_ID FROM dbo.MDM_System_User t1 LEFT JOIN dbo.MDM_System_env t2 ON t2.Env_ID = t1.Env_ID WHERE t2.Env_SN=@Param0 and isnull(Checked,0)=1 AND (t1.VexSSONewID=@Param1) "; DataTable dtBindInfo = m_conn.GetDataTable(strSQL, new string[] { strAccreditationType, strVexSSONewID }); if (dtBindInfo.Rows.Count > 0) { if (dtBindInfo.Rows[0]["app_userName"].ToString() != strBindUser) { strResult = "该手机号已与帐户:" + dtBindInfo.Rows[0]["app_userName"].ToString() + "绑定"; throw new Exception(strResult); } else //更新成绑定的最新数据。2014-10-07添加,主要避免有用户修改身份证号或者更新密码的问题 { string strEnvIDTemp = dtBindInfo.Rows[0]["Env_ID"].ToString(); DataTable dt = new DataTable(); dt.Columns.Add("App_PasswordSrc"); dt.Columns.Add("App_Password"); dt.Rows.Add(new object[] { strBindPassWord.ToUpper(), Common.Common.GetMD5(strBindPassWord.ToUpper()) }); string strWHERE = "Env_ID='" + strEnvIDTemp + "' and isnull(Checked,0)=1 AND VexSSONewID='" + strVexSSONewID + "'"; m_conn.Update("MDM_System_User", dt, strWHERE); } } else { //检查系统用户是否被其他的VEXSSO帐户绑定 if (strAccreditationType.ToUpper() == "EHRCARD") { strSQL = @" SELECT VexSSONewID,t1.app_userName FROM dbo.MDM_System_User t1 LEFT JOIN dbo.MDM_System_env t2 ON t2.Env_ID = t1.Env_ID WHERE t2.Env_SN=@Param0 and isnull(Checked,0)=1 AND (t1.App_PasswordSrc=@Param2) "; } else { strSQL = @" SELECT VexSSONewID,t1.app_userName FROM dbo.MDM_System_User t1 LEFT JOIN dbo.MDM_System_env t2 ON t2.Env_ID = t1.Env_ID WHERE t2.Env_SN=@Param0 and isnull(Checked,0)=1 AND (t1.App_UserName=@Param1) "; } dtBindInfo = m_conn.GetDataTable(strSQL, new string[] { strAccreditationType, strBindUser, strBindPassWord }); //说明MDM_System_User不存在该数据,需要插入 if (dtBindInfo.Rows.Count == 0) { DataTable dtSystemUser = new MDM.MDM_System_UserDataTable(); DataRow dr = dtSystemUser.NewRow(); dr["Env_ID"] = strEnvID; dr["VexSSONewID"] = strVexSSONewID; dr["App_UserName"] = strBindUser; dr["App_PasswordSrc"] = strBindPassWord.ToUpper(); dr["App_Password"] = Common.Common.GetMD5(strBindPassWord.ToUpper()); dr["Checked"] = "1"; dr["Check_User"] = "******"; dtSystemUser.Rows.Add(dr); m_conn.Insert("MDM_System_User", dtSystemUser); } else { //说明没有绑定,需要更新数据 if (dtBindInfo.Rows[0][0].ToString() == "") { DataTable dt = new DataTable(); dt.Columns.Add("VexSSONewID"); dt.Rows.Add(new object[] { strVexSSONewID }); string strWHERE = "Env_ID='" + strEnvID + "' AND App_UserName='******'"; m_conn.Update("MDM_System_User", dt, strWHERE); } else//说明已经绑定 { string strVexSSONewIDExist = dtBindInfo.Rows[0]["VexSSONewID"].ToString(); if (strVexSSONewIDExist != "") { strSQL = @"SELECT VexSSOLoginUser FROM B01_MDM.VEXSSOUser WHERE VexSSONewID=@PARAM0 and ISNULL(Disabled, 0) = 0"; string strBindedUser = m_conn.GetDataTableFirstValue(strSQL, new string[] { strVexSSONewIDExist }).ToString(); //如果是小翅膀,并且是以8开头的数据,说明是默认数据,需要刷新数据 if (strAccreditationType == "AM" && strBindedUser.StartsWith("88")) { //将VEXSSOUser的用户销户,并将小翅膀的绑定变成这个ID strSQL = @"UPDATE B01_MDM.VEXSSOUser SET Disabled=1,DisabledTime=Getdate() WHERE VexSSONewID=@Param0; UPDATE MDM_System_User SET VexSSONewID=@Param1 WHERE VexSSONewID=@Param0; UPDATE MDM_System_User_Authorization SET VexSSONewID=@Param1 WHERE VexSSONewID=@Param0 "; m_conn.ExcuteQuerryByTran(strSQL, new string[] { strVexSSONewIDExist, strVexSSONewID, strEnvID }); } else if (strBindedUser == strBindUser) { //throw new Exception("待绑定的用户已经被手机号:" + strBindedUser + "绑定"); } else { strResult = "待绑定的用户已经被手机号:" + strBindedUser + "绑定"; throw new Exception(strResult); } } } } } strResult = "绑定成功!"; dt_EditResult.Rows.Add(new object[] { true, "绑定成功!" }); m_dsRequturn.Tables.Add(dt_EditResult); } catch (Exception ex) { strResult = ex.Message; throw ex; } finally { WriteBindLog(strVexSSOLoginUser, strVexSSOPassWord, strAccreditationType, strBindUser, strBindPassWord, strResult); } }
public DataSet GetData(string logicName, System.Data.DataSet request) { DataSet response = null; try { string strAssemblyName = logicName.Substring(0, logicName.LastIndexOf(".")); object objInstance = null; //objInstance = Activator.CreateInstance(Type.GetType(logicName)); if (Type.GetType(logicName) != null) { objInstance = Activator.CreateInstance(Type.GetType(logicName)); } else { objInstance = Activator.CreateInstance(Assembly.Load(strAssemblyName).GetType(logicName)); } if (objInstance is LogicBase) { LogicBase logic = (LogicBase)objInstance; if (logic.SessionCheck) { //用户认证 hzyMessage = WSRR.CheckUser(hzyMessage.Session_ID, false); } logic.hzyMessage = this.hzyMessage; if (objInstance is HZYLogicBase) { HZYLogicBase hzyLogic = (HZYLogicBase)objInstance; hzyLogic.Request = request; } else { logic.Request = request; } if (logic is ILogicGetData) { ILogicGetData iLogic = (ILogicGetData)logic; response = iLogic.GetData(); iLogic = null; } logic = null; } else { } return response; } catch (Exception ex) { HZY.COM.Common.Log.WirteLog(ex, "4"); throw ex; } }
public bool Excute(string logicName, System.Data.DataSet request) { bool returnValue = false; try { string strAssemblyName = logicName.Substring(0, logicName.LastIndexOf(".")); object objInstance = null; //objInstance = Activator.CreateInstance(Type.GetType(logicName)); if (Type.GetType(logicName) != null) { objInstance = Activator.CreateInstance(Type.GetType(logicName)); } else { objInstance = Activator.CreateInstance(Assembly.Load(strAssemblyName).GetType(logicName)); } if (objInstance is LogicBase) { LogicBase logic = (LogicBase)objInstance; if (logic is ILogicExecute) { logic.Request = request; if (logic.SessionCheck) { //用户认证 this.hzyMessage = WSRR.CheckUser(hzyMessage.Session_ID,false); } logic.hzyMessage = this.hzyMessage; ILogicExecute iLogic = (ILogicExecute)logic; returnValue = iLogic.Execute(); iLogic = null; } else { } logic = null; } else { } return returnValue; } catch (Exception ex) { HZY.COM.Common.Log.WirteLog(ex,"3"); throw ex; } }