示例#1
0
 public static void Repsonsibles()
 {
     e = Responsible.List("SELECT * FROM responsible ");
     AdvancedForm._Form1.FeedBack("Uploading Responsible... " + e.Count);
     foreach (var h in e)
     {
         string Query = "DELETE from responsible WHERE id ='" + h.Id + "'";
         MySQL.Query(Query);
         Responsible p = new Responsible(h.Id, h.UserID, h.CustomerID, DateTime.Now.ToString("dd-MM-yyyy H:m:s"), "true", Helper.CompanyID);
         if (MySQL.Insert(p) != "")
         {
             AdvancedForm._Form1.FeedBack("Uploading ... " + h.Id.ToString());
             Responsible u = new Responsible(h.Id, h.UserID, h.CustomerID, DateTime.Now.ToString("dd-MM-yyyy H:m:s"), "true", Helper.CompanyID);
             DBConnect.UpdateMySql(u, h.Id);
             AdvancedForm._Form1.FeedBack("Updating .. " + h.Id.ToString());
         }
     }
     AdvancedForm._Form1.FeedBack("Uploading Patient  Complete");
 }
示例#2
0
        public void LoadData()
        {
            // create and execute query
            t = new DataTable();
            t.Columns.Add(new DataColumn("Select", typeof(bool)));
            t.Columns.Add("id");
            t.Columns.Add("uriCus");
            t.Columns.Add(new DataColumn("ImgCus", typeof(Bitmap)));
            t.Columns.Add("Patient");
            t.Columns.Add("uriUs");
            t.Columns.Add(new DataColumn("ImgUs", typeof(Bitmap)));
            t.Columns.Add("User");

            t.Columns.Add("Created");
            t.Columns.Add(new DataColumn("Delete", typeof(Image)));
            Image  delete = new Bitmap(Properties.Resources.Server_Delete_16);
            Bitmap b      = new Bitmap(50, 50);

            using (Graphics g = Graphics.FromImage(b))
            {
                g.DrawString("Loading...", this.Font, new SolidBrush(Color.Black), 0f, 0f);
            }
            Bitmap b2 = new Bitmap(50, 50);

            using (Graphics g = Graphics.FromImage(b2))
            {
                g.DrawString("Loading...", this.Font, new SolidBrush(Color.Black), 0f, 0f);
            }
            foreach (Responsible c in Responsible.List())
            {
                string user     = "";
                string cus      = "";
                string imageCus = "";
                string imageUs  = "";
                try { user = GenericCollection.users.Where(r => r.Id == c.UserID).First().Name; } catch { }
                try { imageUs = GenericCollection.users.Where(r => r.Id == c.UserID).First().Image; } catch { }
                try { cus = GenericCollection.customers.Where(r => r.Id == c.CustomerID).First().Name; } catch { }
                try { imageCus = GenericCollection.customers.Where(r => r.Id == c.CustomerID).First().Image; } catch { }
                try
                {
                    t.Rows.Add(new object[] { "false", c.Id, imageCus as string, b, cus, imageUs as string, b2, user, c.Created, delete });
                }
                catch (Exception m)
                {
                    //MessageBox.Show("" + m.Message);
                    Helper.Exceptions(m.Message, "Viewing customer {each schedule list }" + cus);
                }
            }

            dtGrid.DataSource = t;
            ThreadPool.QueueUserWorkItem(delegate
            {
                foreach (DataRow row in t.Rows)
                {
                    try
                    {
                        Image img = Helper.Base64ToImage(row["uriCus"].ToString().Replace('"', ' ').Trim());
                        System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
                        Bitmap bps     = new Bitmap(bmp, 50, 50);
                        Image dstImage = Helper.CropToCircle(bps, Color.White);
                        row["ImgCus"]  = dstImage;
                    }
                    catch
                    {
                    }
                }
            });
            ThreadPool.QueueUserWorkItem(delegate
            {
                foreach (DataRow row in t.Rows)
                {
                    try
                    {
                        Image img = Helper.Base64ToImage(row["uriUs"].ToString().Replace('"', ' ').Trim());
                        System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
                        Bitmap bps     = new Bitmap(bmp, 50, 50);
                        Image dstImage = Helper.CropToCircle(bps, Color.White);
                        row["ImgUs"]   = dstImage;
                    }
                    catch
                    {
                    }
                }
            });
            dtGrid.AllowUserToAddRows        = false;
            dtGrid.Columns["id"].Visible     = false;
            dtGrid.Columns["uriCus"].Visible = false;
            dtGrid.Columns["uriUs"].Visible  = false;
        }