Upload to server
uploading
This commit is contained in:
124
patientman/PatientMan/Classes/clsSettingInfo.cs
Normal file
124
patientman/PatientMan/Classes/clsSettingInfo.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Windows.Forms;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
|
||||
namespace PatientMan
|
||||
{
|
||||
|
||||
public class SettingInfo
|
||||
{
|
||||
private static XmlDocument doc = new XmlDocument();
|
||||
public static string ProvinceId { get; set; }
|
||||
public static string DistrictId { get; set; }
|
||||
public static string CommuneId { get; set; }
|
||||
public static string SiteCode { get; set; }
|
||||
public static string SiteName { get; set; }
|
||||
public static string Address { get; set; }
|
||||
public static string Description { get; set; }
|
||||
public static string InstallId { get; set; }
|
||||
public static string RegisterNo { get; set; }
|
||||
public static int Language { get; set; }
|
||||
public static string Password { get; set; }
|
||||
public static string DatabaseFile { get; set; }
|
||||
public static string BackupFolder { get; set; }
|
||||
public static string Constr { get; set; }
|
||||
public static string dbPassword { get; set; }
|
||||
public static Boolean Registered { get; set; }
|
||||
enum EndExam
|
||||
{
|
||||
LostFollowup=1,
|
||||
Referral = 2,
|
||||
Death = 3
|
||||
};
|
||||
|
||||
enum EndRegimen
|
||||
{
|
||||
ClinicalFailure,
|
||||
TB,
|
||||
Pregnance,
|
||||
ImmuneFailure,
|
||||
Drugsarenolonger,
|
||||
Sideeffects,
|
||||
FailureVirus,
|
||||
NewDrugsAreAvailable,
|
||||
LostFollowup,
|
||||
Referral ,
|
||||
Death
|
||||
|
||||
}
|
||||
|
||||
public static void InitInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = new XmlDocument();
|
||||
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
string SettingsPath = Application.StartupPath + @"\Settings.fhi";
|
||||
doc.Load(SettingsPath);
|
||||
ProvinceId = doc.GetElementsByTagName("ProvinceId")[0].InnerText;
|
||||
DistrictId = doc.GetElementsByTagName("DistictId")[0].InnerText;
|
||||
CommuneId = doc.GetElementsByTagName("CommuneId")[0].InnerText;
|
||||
SiteCode = doc.GetElementsByTagName("SiteCode")[0].InnerText;
|
||||
SiteName = doc.GetElementsByTagName("SiteName")[0].InnerText;
|
||||
Address = doc.GetElementsByTagName("Address")[0].InnerText;
|
||||
Description = doc.GetElementsByTagName("Description")[0].InnerText;
|
||||
Password = doc.GetElementsByTagName("Password")[0].InnerText;
|
||||
Language = Convert.ToInt16(doc.GetElementsByTagName("Language")[0].InnerText);
|
||||
InstallId = PatientMan.FingerPrint.Value().Trim();
|
||||
dbPassword = doc.GetElementsByTagName("dbPassword")[0].InnerText; getDataBaseFile();
|
||||
getDataBaseFile();
|
||||
RegisterNo = config.AppSettings.Settings["RegisterNo"]==null?"xxxxxxxxxx":config.AppSettings.Settings["RegisterNo"].Value;
|
||||
|
||||
Registered = (common.MD5Hash(InstallId.Trim().ToString()).ToUpper() == RegisterNo);
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void getDataBaseFile()
|
||||
{
|
||||
string tmp="";
|
||||
try
|
||||
{
|
||||
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
string value = config.AppSettings.Settings["ConnectionString.MS Access (OleDb)"].Value;
|
||||
string[] values = value.Split(new char[] { ';' });
|
||||
string DataSource = values[1];
|
||||
DatabaseFile = DataSource.Split(new char[] { '=' })[1];
|
||||
tmp = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={file};User Id=admin;Password=;Jet OLEDB:System Database=;Jet OLEDB:Database password={dbPassword}";
|
||||
Constr = tmp.Replace("{file}", DatabaseFile);
|
||||
if (dbPassword != "")
|
||||
{
|
||||
Constr = Constr.Replace("{dbPassword}", Utility.Decrypt(dbPassword));
|
||||
}
|
||||
else
|
||||
{
|
||||
Constr = Constr.Replace("{dbPassword}", "");
|
||||
|
||||
}
|
||||
BackupFolder = config.AppSettings.Settings["BackupFolder"]!=null?config.AppSettings.Settings["BackupFolder"].Value:"";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
catch(Exception err)
|
||||
{
|
||||
MessageBox.Show(err.Message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user