Beispiel #1
0
        public static string CurrentSiteDetails()
        {
            string sql  = @"select (case when value is not null then value else '-1' end) from setting where name = 'siteid'";

            MysqlDbUtility db = new MysqlDbUtility();
            string s =  db.scalarValue(sql);
            if(!db.Equals(""))
            {
                return null;
            }
            return s;
        }
Beispiel #2
0
 private void PopulateDataGridView(string surname, string firstname, string id)
 {
     MysqlDbUtility db = new MysqlDbUtility();
     string[][] result = db.searchPatient(surname, firstname, id);
     if (result == null) return;
     foreach(string[]s in result)
     {
         if(s==null) break;
         DateTime temp = DateTime.Parse(s[4]);
         int yrs = DateTime.Now.Year - temp.Year;
         if (DateTime.Now.Month < temp.Month || (DateTime.Now.Month == temp.Month && DateTime.Now.Day < temp.Day))
             yrs--;
         int t = dataGridView1.Rows.Add(s);
         dataGridView1.Rows[t].Cells["Age"].Value = yrs;
     }
 }
Beispiel #3
0
        public ReportAllPatients(Login p)
        {
            parent = p;
            MysqlDbUtility db = new MysqlDbUtility();
            InitializeComponent();
            ReportDocument reportdoc = new ReportDocument();
            string sql = "SELECT r.`patientID`, r.`firstname`, r.`middle_name`, r.`surname`, r.`Sex`, r.`dateofbirth`, r.`nrc_number` FROM registration r;";
            DataSet s = db.getDataSet(sql);
            s.Tables[0].TableName = "Command";
            int count = s.Tables[0].Rows.Count;
            string printer = reportdoc.PrintOptions.PrinterName;

            reportdoc.Load(Application.StartupPath + "\\rpt-all_patients.rpt");
            reportdoc.SetDataSource(s);
            //crystalReportViewer1.ReportSource = Application.StartupPath + "\\patientList.rpt";
            crystalReportViewer1.ReportSource = reportdoc;
            crystalReportViewer1.ShowFirstPage();
            this.Show();

            //this.crystalReportViewer1.ShowFirstPage();
            this.Visible = true;
        }
        public string WriteDataPayloadMySql([FromBody] SimplePayload payload)
        {
            string apiRequestStartTime = "";

            apiRequestStartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff");

            try {
                string strDockerName     = System.Environment.MachineName;
                string dtApiResponseTime = string.Empty;
                try {
                    MysqlDbUtility.WriteData(payload.transactionId, "Hello-World", strDockerName, payload.clientRequestTime, apiRequestStartTime);
                }
                catch (Exception) {
                    throw;
                }

                return("Insert Successfull");
            }
            catch (Exception ex) {
                return(ex.Message);
            }
        }
Beispiel #5
0
        public static void SetCurrentSiteDetails(string sitename)
        {
            LocationProvider p = new LocationProvider();
            string siteid = p.GetSiteIdFromSiteName(sitename);

            string sql = string.Format(@"insert into setting(name,value) values(siteid,{0})",siteid);

            string countsql = @"select count(*) from setting where name = 'siteid'";

            MysqlDbUtility db = new MysqlDbUtility();

            int count = Int32.Parse(db.scalarValue(countsql));

            if (count == 1)
            {
                string updatesql = string.Format(@"update setting set value = '{0}' where name = 'siteid'", siteid);

                db.runNonQuery(updatesql);
            }
            else
            {
                db.runNonQuery(sql);
            }
        }
Beispiel #6
0
 private void btnReport_Click(object sender, EventArgs e)
 {
     MysqlDbUtility db = new MysqlDbUtility();
     DataSet1 ds = db.GetAllPatients();
     parent.SetUserControl(new ReportsBrowser(parent));
 }
Beispiel #7
0
        public string GetSiteIdFromSiteName(string sitename)
        {
            string sql = string.Format(@"select siteid from sites where sitename = '{0}' ", sitename);

            MysqlDbUtility db = new MysqlDbUtility();

            string s = db.scalarValue(sql);

            return s;
        }