/// <summary> /// US:840 US:1882 US:836 US:866 /// login to the checklist tool /// </summary> /// <param name="strUID"></param> /// <param name="strPWD"></param> /// <returns></returns> public CStatus Login(string strUID, string strPWD, long lSiteID) { //status CStatus status = new CStatus(); long lUserID = 0; LoggedIn = false; //login to mdws if we are connecting to mdws if (MDWSTransfer) { EmrSvcSoapClient mdwsSOAPClient = null; CMDWSOps ops = new CMDWSOps(this); status = ops.MDWSLogin( strUID, strPWD, lSiteID, out lUserID, out mdwsSOAPClient); if (status.Status) { //create the session record UserID = lUserID; CUserData ud = new CUserData(this); string strFXSessionID = String.Empty; status = ud.CreateFXSession(out strFXSessionID); if (!status.Status) { return(status); } //load the rest of the user data status = LoadUserData(lUserID); if (!status.Status) { return(status); } //we are loged in at this point LoggedIn = true; //cache the encrypted login credentials so that we can re-login if //we timeout from MDWS. MDWSUID = strUID; MDWSPWD = strPWD; SiteID = lSiteID; } return(status); } //simple login long lRoleID = 0; DataSet ds = null; CUserData cud = new CUserData(this); status = cud.GetLoginUserDS( strUID, strPWD, out ds, out lUserID, out lRoleID); if (status.Status) { //create the session record UserID = lUserID; CUserData ud = new CUserData(this); string strFXSessionID = String.Empty; status = ud.CreateFXSession(out strFXSessionID); if (!status.Status) { return(status); } //load the rest of the user date status = LoadUserData(lUserID); if (!status.Status) { return(status); } //we are loged in at this point LoggedIn = true; } return(status); }
/// <summary> /// US:834 Connect to the database using info from the /// app.config file will also load a CData object for use /// by other data classes and setup the connectsion to MDWS and /// return a mdwsSOAPClient for accessing MDWD methods /// </summary> /// <param name="lStatusCode"></param> /// <param name="strStatus"></param> /// <returns></returns> public CStatus Connect(out CData data, out EmrSvcSoapClient mdwsSOAPClient) { data = null; mdwsSOAPClient = null; //initialize parameters string strConnString = String.Empty; bool bAudit = false; //get the connection info from the web.config CStatus status = new CStatus(); status = GetConnectionInfo(out strConnString, out bAudit); if (!status.Status) { return(status); } //Connect to the db, if successful caller can use the //CDataConnection::Conn property for access to the DB connection status = Connect(strConnString, bAudit); if (!status.Status) { //todo handle error return(status); } //create a new base data object //todo: more later // //get the ipaddress string strIPAddress = String.Empty; string strHost = System.Net.Dns.GetHostName(); IPHostEntry host; host = Dns.GetHostEntry(strHost); foreach (IPAddress ip in host.AddressList) { strIPAddress = ip.ToString(); } //build the base data item used by data classes string strNow = CDataUtils.GetDateTimeAsString(DateTime.Now); data = new CData(this, strIPAddress, 0, "VAPPCTCOMM_" + strNow, null, true); //comm data class CVAPPCTCommData commData = new CVAPPCTCommData(data); //login to MDWS long lUserID = 0; CMDWSOps ops = new CMDWSOps(data); //uid and pwd need come from config file: //TODO: they need to be encrypted status = ops.MDWSLogin(ConfigurationSettings.AppSettings["MDWSEmrSvcUID"], ConfigurationSettings.AppSettings["MDWSEmrSvcPWD"], CDataUtils.ToLong(ConfigurationSettings.AppSettings["MDWSEmrSvcSiteList"]), out lUserID, out mdwsSOAPClient); if (!status.Status) { commData.SaveCommEvent("MDWSLogin_FAILED", status.StatusComment); return(status); } //set the user id on the CData object data.UserID = lUserID; //create the session so that we can call stored proc CUserData ud = new CUserData(data); string strFXSessionID = String.Empty; status = ud.CreateFXSession(out strFXSessionID); if (!status.Status) { commData.SaveCommEvent("MDWSSessionCreate_FAILED", status.StatusComment); return(status); } return(status); }