public static async Task GetDebugMethodAsync(string HDInfo, string username) { string HrdsqLicenseUserId = "", HrdsqLicenseKey = "", strHDInfo = "", SipUsername = "", Sippassword = "", Sipserver = "", Sipport = "", SMSFNo = "", SMSAuthID = "", SMSAuthToken = "", Logmachine = ""; string uApiKey = "", uAuthToken = "", uAuthID = "", ProviderType = ""; int dbUserId = 0; Boolean CheckOpen = true, IsSipVoipSDKlog = false, IsTransPortTCP = false; string Username, DrPhoneNumber = string.Empty; DataAccess ServiceObj = new DataAccess(); HRDsqApi.DataAccess.User objuserinfo = new HRDsqApi.DataAccess.User(); List <HRDsqApi.DataAccess.UserHDDInfo> userhddinfo = new List <HRDsqApi.DataAccess.UserHDDInfo>(); userhddinfo.Add(new HRDsqApi.DataAccess.UserHDDInfo { HDDNumber = HDInfo.ToString(), IsServer = true }); objuserinfo.UserHDDInfo = userhddinfo; // call api and check for Status New/Pending/Approved/Disable objuserinfo = await ServiceObj.GetServerDetail(objuserinfo); string subcription = string.Empty; int SMScount = 0; if (objuserinfo.Message.ToLower().ToString().Trim() == "approved") { HrdsqLicenseUserId = objuserinfo.HrdsqLicenseUserId; HrdsqLicenseKey = objuserinfo.HrdsqLicenseKey; //Library.WriteErrorLog("HrdsqLicenseUserId our id" + HrdsqLicenseUserId); //Library.WriteErrorLog("HrdsqLicenseKey our key" + HrdsqLicenseKey); foreach (var item in objuserinfo.UserHDDInfo) { SipUsername = item.SipUsername; Sippassword = item.Sippassword; Sipserver = item.Sipserver; Sipport = item.Sipport; subcription = item.Subscription; SMScount = item.Count; SMSFNo = objuserinfo.SMSFromNumber; SMSAuthID = item.AuthID; SMSAuthToken = item.AuthToken; Logmachine = item.IPAddress; //Temp Using IP for LogMachine Filed. dbUserId = item.ID; //-----------Added by Vandna on 12-May-2017------- IsSipVoipSDKlog = objuserinfo.IsSipVoipSDKLog; IsTransPortTCP = item.IsTransPortTCP; IsDebugMode = item.IsDebugMode; //--------------End-------------------- } DrPhoneNumber = objuserinfo.PhoneNumber; //-----------Added by Vandna on 05-Jan-2017-- uAuthID = objuserinfo.uAuthID; uAuthToken = objuserinfo.uAuthToken; // Library.WriteErrorLog("My auth token" + uAuthToken); uApiKey = objuserinfo.uApiKey; ProviderType = objuserinfo.ProviderType; } }
/// <summary> /// Check Account details Approved/Disabled/Expired /// </summary> /// <param name="HDInfo">Harddisk number</param> /// <param name="username">PC LogIn Username</param> public async void SetAuthDetail(string HDInfo, string username) { try { DataAccess ServiceObj = new DataAccess(); HRDsqApi.DataAccess.User objuserinfo = new HRDsqApi.DataAccess.User(); List <HRDsqApi.DataAccess.UserHDDInfo> userhddinfo = new List <HRDsqApi.DataAccess.UserHDDInfo>(); userhddinfo.Add(new HRDsqApi.DataAccess.UserHDDInfo { HDDNumber = HDInfo.ToString(), IsServer = true }); objuserinfo.UserHDDInfo = userhddinfo; // call api and check for Status New/Pending/Approved/Disable objuserinfo = await ServiceObj.GetServerDetail(objuserinfo); string subcription = string.Empty; int SMScount = 0; ExtractLibrary.WriteInLogFile("user status: " + objuserinfo.Message); if (objuserinfo.Message.ToLower().ToString().Trim() == "approved") { HrdsqLicenseUserId = objuserinfo.HrdsqLicenseUserId; HrdsqLicenseKey = objuserinfo.HrdsqLicenseKey; //Library.WriteErrorLog("HrdsqLicenseUserId our id" + HrdsqLicenseUserId); //Library.WriteErrorLog("HrdsqLicenseKey our key" + HrdsqLicenseKey); foreach (var item in objuserinfo.UserHDDInfo) { SipUsername = item.SipUsername; Sippassword = item.Sippassword; Sipserver = item.Sipserver; Sipport = item.Sipport; subcription = item.Subscription; SMScount = item.Count; SMSFNo = objuserinfo.SMSFromNumber; SMSAuthID = item.AuthID; SMSAuthToken = item.AuthToken; Logmachine = item.IPAddress; //Temp Using IP for LogMachine Filed. dbUserId = item.ID; //-----------Added by Vandna on 12-May-2017------- IsSipVoipSDKlog = objuserinfo.IsSipVoipSDKLog; IsTransPortTCP = item.IsTransPortTCP; IsDebugMode = item.IsDebugMode; //--------------End-------------------- } DrPhoneNumber = objuserinfo.PhoneNumber; //-----------Added by Vandna on 05-Jan-2017-- uAuthID = objuserinfo.uAuthID; uAuthToken = objuserinfo.uAuthToken; // Library.WriteErrorLog("My auth token" + uAuthToken); uApiKey = objuserinfo.uApiKey; ProviderType = objuserinfo.ProviderType; Library.WriteErrorLog("IsDebugMode : " + IsDebugMode + " AuthToken: " + uAuthToken); //----End----- //--------------End-------------------- if (SipUsername.ToString().Trim() == "" || SipUsername.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SIP username."); } else if (Sippassword.ToString().Trim() == "" || Sippassword.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SIP password."); } else if (Sipserver.ToString().Trim() == "" || Sipserver.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SIP Server."); } else if (Sipport.ToString().Trim() == "" || Sipport.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SIP port number."); } else if (SMSFNo.ToString().Trim() == "" || SMSFNo.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SMS from number."); } else if (SMSAuthID.ToString().Trim() == "" || SMSAuthID.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SMS auth id."); } else if (SMSAuthToken.ToString().Trim() == "" || SMSAuthToken.ToString().Trim() == "-") { Library.WriteErrorLog("Please provide SIP password."); } RegisterToHRDsq(SMSFNo, SMSAuthID, SMSAuthToken, IsSipVoipSDKlog, IsTransPortTCP, IsDebugMode, uApiKey, ProviderType, DrPhoneNumber); } else { Library.WriteErrorLog("Else case -- " + objuserinfo.Message.ToLower().ToString().Trim()); switch (objuserinfo.Message.ToLower().ToString().Trim()) { case "new": ProcessExtensions.StartProcessAsCurrentUser(AppDomain.CurrentDomain.BaseDirectory + "\\ConvergedComm.exe", "new"); break; case "pending": ProcessExtensions.StartProcessAsCurrentUser(AppDomain.CurrentDomain.BaseDirectory + "\\ConvergedComm.exe", "pending"); break; case "expired": ProcessExtensions.StartProcessAsCurrentUser(AppDomain.CurrentDomain.BaseDirectory + "\\ConvergedComm.exe", "expired"); OnStop(); break; case "disable": OnStop(); ProcessExtensions.StartProcessAsCurrentUser(AppDomain.CurrentDomain.BaseDirectory + "\\ConvergedComm.exe", "disable"); break; default: Library.WriteErrorLog(objuserinfo.Message.ToLower().ToString().Trim()); break; } } //Added On 15-Sept-18 //string frpRoot = AppDomain.CurrentDomain.BaseDirectory + "\\frp"; //string frpDest = @"C:\frp"; //foreach (var file in Directory.GetFiles(frpDest)) //{ // if (!Directory.Exists(frpRoot)) // { // Directory.CreateDirectory(frpRoot); // } // File.Copy(file, Path.Combine(frpRoot, Path.GetFileName(file))); //} //------------------------------ //string path2 = @"C:\Program Files (x86)\HRDSQPlugin\HRDSQPlugin\HRDSQTray.exe"; //if (!IsProcessOpen("HRDSQTray.exe")) //{ // ProcessStartInfo stinfo = new ProcessStartInfo(); // stinfo.FileName = @"C:\Program Files (x86)\HRDSQPlugin\HRDSQPlugin\HRDSQTray.exe"; // stinfo.CreateNoWindow = true; // stinfo.UseShellExecute = false; // stinfo.Arguments = "-c " + "\"" + path2 + "\""; // stinfo.RedirectStandardOutput = true; // Process myProcess2 = Process.Start(stinfo); // while (!myProcess2.StandardOutput.EndOfStream) // { // Library.WriteErrorLog("FRP LOG " + myProcess2.StandardOutput.ReadLine()); // } //} string text = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "\\frp\\frpc.ini").Replace("$Token", (string.IsNullOrEmpty(uAuthToken) == true ? "$Token": uAuthToken)); System.IO.File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "\\frp\\frpc.ini", text); //----------------------------------------- //sWorkingDir = AppDomain.CurrentDomain.BaseDirectory + "\\frp\\frpc.exe"; //sWorkingDir = "@" + sWorkingDir.Replace(@"\\", @"\"); //Library.WriteErrorLog("sWorkingDir" + sWorkingDir); //string iniFile = AppDomain.CurrentDomain.BaseDirectory + "\\frp\\frpc.ini"; //iniFile = @"-c " + iniFile.Replace(@"\\", @"\"); //Library.WriteErrorLog("iniFile" + iniFile); //------------------------------------------ string path = @"C:\Program Files (x86)\HRDSQPlugin\HRDSQPlugin\frp\frpc.ini"; if (!IsProcessOpen("frpc.exe")) { ProcessStartInfo stinfo = new ProcessStartInfo(); stinfo.FileName = @"C:\Program Files (x86)\HRDSQPlugin\HRDSQPlugin\frp\frpc.exe"; stinfo.CreateNoWindow = true; stinfo.UseShellExecute = false; stinfo.Arguments = "-c " + "\"" + path + "\""; stinfo.RedirectStandardOutput = true; Process myProcess = Process.Start(stinfo); while (!myProcess.StandardOutput.EndOfStream) { Library.WriteErrorLog("FRP LOG " + myProcess.StandardOutput.ReadLine()); } // //Library.WriteErrorLog("FRP Service Start"); // //Process proc = new Process(); // //proc.StartInfo.FileName = sWorkingDir; // //proc.StartInfo.CreateNoWindow = true; // //proc.StartInfo.UseShellExecute = false; // //proc.StartInfo.Arguments = @"-c " + iniFile; //@"-c c:\frp\frpc.ini"; // //proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal; // //proc.StartInfo.RedirectStandardOutput = true; // //Library.WriteErrorLog("FRP Process START"); // //proc.Start(); // //while (!proc.StandardOutput.EndOfStream) // //{ // // Library.WriteErrorLog(proc.StandardOutput.ReadLine()); // //} //} //------------------------------------------------------- } } catch (Exception pcex) { Library.WriteErrorLog("FRPError " + pcex.Message); } }
private async void btn_submit_Click(object sender, EventArgs e) { try { Validation validation = new Validation(); if (txt_fname.Text.ToString().Trim() == "") { MessageBox.Show("Please enter name.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_fname.Focus(); return; } else if (txt_lname.Text.ToString().Trim() == "") { MessageBox.Show("Please enter practice name.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_lname.Focus(); return; } else if (txt_email.Text.ToString().Trim() == "") { MessageBox.Show("Please enter email.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_email.Focus(); return; } else if (!validation.isValidEmail(txt_email.Text.Trim())) { MessageBox.Show("Please provide valid email address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_email.Focus(); return; } else if (txt_pnumber.Text.ToString().Trim() == "") { MessageBox.Show("Please enter phone number.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_pnumber.Focus(); return; } else if (validation.IsInvalidNumber(txt_pnumber.Text.Trim().Replace("(", "").Replace(")", "").Replace("-", ""))) { MessageBox.Show("Please enter valid phone number.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_pnumber.Focus(); return; } else { if (!PingTest()) { MessageBox.Show("There seems to be some internet connectivity issue, please check internet connection.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } btn_submit.Enabled = false; //string appPath = Directory.GetCurrentDirectory();//Path.GetDirectoryName(Application.ExecutablePath); //string[] aPath; //aPath = appPath.ToString().Trim().Split(':'); //if (aPath.Length > 0) { appPath = aPath[0].ToString(); } HDInfo _objHD = new HDInfo(); string strHDInfo = clsHDInfo.MacAddress(); //_objHD.getUniqueID(""); string IPAddress = LocalIPAddress(); //getExternalIp(); DataAccess ServiceObj = new DataAccess(); HRDsqApi.DataAccess.User oUser = new HRDsqApi.DataAccess.User(); oUser.FirstName = txt_fname.Text.Trim(); oUser.LastName = txt_lname.Text.Trim(); oUser.Email = txt_email.Text.Trim(); oUser.PhoneNumber = txt_pnumber.Text.Trim().Replace("(", "").Replace(")", "").Replace("-", ""); oUser.SMSFromNumber = "NULL"; var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(Path.GetDirectoryName(Application.ExecutablePath) + "\\HRDSQPlugin.exe"); string AssemblyVersion = versionInfo.ProductVersion; List <HRDsqApi.DataAccess.UserHDDInfo> userhddinfo = new List <HRDsqApi.DataAccess.UserHDDInfo>(); userhddinfo.Add(new HRDsqApi.DataAccess.UserHDDInfo { HDDNumber = strHDInfo.ToString(), UserName = FindUserName(), IPAddress = IPAddress, Subscription = "Trial", Count = 0, Status = "Pending", ODVersion = "Common Plugin", PCCVersion = AssemblyVersion, //"1.8.0.0", IsServer = true }); oUser.UserHDDInfo = userhddinfo; // call api and check for Status New/Pending/Approved/Disable oUser = await ServiceObj.GetServerDetail(oUser); // MessageBox.Show(oUser.Message); if (oUser.Message == "Success") { MessageBox.Show("Thank you for Registering with patientXpress! Your registration has been received and will take some time to get activated. You will receive a mail on the registered email id.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); } else { btn_submit.Enabled = true; MessageBox.Show(oUser.Message, "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { Library.WriteErrorLog(ex); } }
public async Task <DBUserInfo> checkAuthenticity(string PCUsername) { try { Library.WriteErrorLog(PCUsername); _objDUI = new DBUserInfo(); username = PCUsername; strHDInfo = clsHDInfo.MacAddress();// getUniqueID(""); Library.WriteErrorLog("MACAddress: " + strHDInfo); HRDsqApi.DataAccess ServiceObj = new HRDsqApi.DataAccess(); HRDsqApi.DataAccess.User objuserinfo = new HRDsqApi.DataAccess.User(); List <HRDsqApi.DataAccess.UserHDDInfo> userhddinfo = new List <HRDsqApi.DataAccess.UserHDDInfo>(); userhddinfo.Add(new HRDsqApi.DataAccess.UserHDDInfo { HDDNumber = strHDInfo.ToString().Trim(), IsServer = true }); objuserinfo.UserHDDInfo = userhddinfo; objuserinfo = await ServiceObj.GetServerDetail(objuserinfo); if (objuserinfo.Message.Trim().ToLower() == "approved") { foreach (var item in objuserinfo.UserHDDInfo) { _objDUI.dbUserSub = item.Subscription; _objDUI.dbCnt = item.Count; _objDUI.SMSFNo = objuserinfo.SMSFromNumber; _objDUI.DrPhoneNumber = objuserinfo.PhoneNumber; _objDUI.PracticeName = objuserinfo.LastName; _objDUI.SMSAuthID = item.AuthID; _objDUI.SMSAuthToken = item.AuthToken; _objDUI.ODVersion = item.ODVersion; _objDUI.dbUserId = item.ID; IsDebug = item.IsDebugMode; AuID = item.ID; AuUID = item.UserId; Library.WriteErrorLog("accountStatus: " + objuserinfo.Message); _objDUI.AccountStatus = objuserinfo.Message; } //---------Practice Id-------------------- ClsStaticString.PracticeID = Convert.ToString(AuUID); ClsStaticString.SMSNo = objuserinfo.SMSFromNumber.ToString(); Library.WriteErrorLog("Practice id -- " + AuID); //-----------Added by Vandna on 05-Jan-2017-- uAuthID = objuserinfo.uAuthID; uAuthToken = objuserinfo.uAuthToken; uApiKey = objuserinfo.uApiKey; ProviderType = objuserinfo.ProviderType; pSMS.sVoipLogin = objuserinfo.uAuthID; pSMS.sVoipSecret = objuserinfo.uAuthToken; //----End----- _objDUI.IsInsService = objuserinfo.IsInsService; _objDUI.IsRSApptConf = objuserinfo.IsRSApptConf; _objDUI.IsRSApptRecall = objuserinfo.IsRSApptRecall; _objDUI.IsRSBirthday = objuserinfo.IsRSBirthday; _objDUI.isAuthentic = true; _objDUI.isSMS = objuserinfo.IsSMS; // Added by ashok patel Date 04 Oct 2016 _objDUI.dbUserId = objuserinfo.UserId; // Added by vandna chaurasia Date 18 March 2017 _objDUI.SecNo = objuserinfo.Line2PhoneNumber; //Library.WriteErrorLog("User " + username.ToString().Trim() + " is approved user."); } else { _objDUI.isAuthentic = false; _objDUI.isSMS = false; _objDUI.IsInsService = false; _objDUI.IsRSApptConf = false; _objDUI.IsRSApptRecall = false; _objDUI.IsRSBirthday = false; _objDUI.AccountStatus = objuserinfo.Message; Library.WriteErrorLog("User " + username.ToString().Trim() + " is not approved user." + Environment.NewLine + objuserinfo.Message.Trim().ToLower()); } return(_objDUI); } catch (Exception pcex) { Library.LogError(pcex); return(null); } finally { if (_objDUI != null) { _objDUI = null; } } }
public static void Main() { String[] arguments = Environment.GetCommandLineArgs(); string SourcePhone = "", OfficePn = ""; Library.WriteErrorLog("Arguments " + string.Join("$", arguments)); HRDsqApi.DataAccess.User objuserinfo = new HRDsqApi.DataAccess.User(); //List<HRDsqApi.DataAccess.UserHDDInfo> userhddinfo = new List<HRDsqApi.DataAccess.UserHDDInfo>(); //userhddinfo.Add(new HRDsqApi.DataAccess.UserHDDInfo { HDDNumber = HRDsqApi.HDInfo.ToString(), IsServer = true }); //objuserinfo.UserHDDInfo = userhddinfo; // call api and check for Status New/Pending/Approved/Disable //objuserinfo = await ServiceObj.GetServerDetail(objuserinfo); string argmt = arguments[0].ToLower().ToString().Trim(); Library.WriteErrorLog(arguments[0].ToLower().ToString().Trim()); // Check for getting SMS Not In Use By Vandna on 27_April_2017 if (argmt == "SMS".ToLower()) { //arguments[0] = "SMS"; //arguments[1] = "Phone Number"; //arguments[2] = "SMS Text"; LogSMS(arguments[1].ToLower().ToString().Trim(), arguments[2].ToLower().ToString().Trim()); Application.Exit(); }// Open System Tray else if (argmt == "OpenTray".ToLower()) { StartTray(); Application.Exit(); } else { string caller = string.Empty; //if (arguments.Length > 3) //{ // SourcePhone = Convert.ToString(arguments[4]); // OfficePn = Convert.ToString(arguments[1]); //} Library.WriteErrorLog("in main: " + Convert.ToString(arguments[0])); switch (arguments[0].ToLower().ToString().Trim()) { case "new": NewUser oNewUser = new NewUser(); oNewUser.ShowDialog(); break; case "pending": MessageBox.Show("Your Registration is pending Approval! If you have any queries you can contact us at [email protected] / phone: +1-949-542-6773.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); break; case "expired": MessageBox.Show("Your Subscription at patientXpress has either expired or is outside the active period. Please contact us at [email protected] / phone: +1-949-542-6773..", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); break; case "disable": MessageBox.Show("Your Account has been disabled. Please contact [email protected] / phone: +1-949-542-6773.", "patientXpress", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); break; case "&id": { object[] parameters1 = new object[5]; parameters1[0] = argmt; //Pass Like &id17193 parameters1[1] = ""; parameters1[2] = ""; parameters1[3] = ""; parameters1[4] = ""; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //MessageBox.Show("called from here"); //Application.Run(new FormIncoming(arguments)); int counter = ClsLogCall.GetTimerCount(); if (counter == 0) { } else { ///MessageBox.Show("called from here1"); Application.Run(new FormIncoming(parameters1)); } break; } default: { ///MessageBox.Show("dEFAULT CASE " + arguments[1] + " /" + OfficePn + " /" + SourcePhone); object[] parameters = new object[5]; parameters[0] = arguments[0]; parameters[1] = OfficePn; parameters[2] = ""; parameters[3] = ""; parameters[4] = SourcePhone; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //MessageBox.Show("cout3:" + arguments.Count()); //Application.Run(new FormIncoming(arguments)); //MessageBox.Show("called from here2"); //// to avoid 2 call popup, commented this by vk //Application.Run(new FormIncoming(parameters)); int counter = ClsLogCall.GetTimerCount(); if (counter == 0) { } else { ///MessageBox.Show("called from here3"); Application.Run(new FormIncoming(parameters)); } break; } } } }