예제 #1
0
        private void TimerButton_Click(object sender, EventArgs e)
        {
            //Right click delete
            if (e.GetType().Equals(typeof(MouseEventArgs)))
            {
                MouseEventArgs mouse = (MouseEventArgs)e;
                if (mouse.Button == MouseButtons.Right)
                {
                    TimerMenuStrip.Show(Cursor.Position);
                }
            }

            //Get selected TimerItem
            BunifuFlatButton clickedButton = (BunifuFlatButton)sender;

            BLIO.Log("TimerButton " + clickedButton.Text + " clicked!");
            //Remove all the text apart from the id and store it


            int id = GetTimerButtonId(clickedButton);


            foreach (TimerItem itm in timers)
            {
                if (itm.ID == id)
                {
                    lblTimerTitle.Text = "Timer: " + itm.TimerText;

                    currentTimerItem      = itm;
                    lblTimerTitle.Visible = true;


                    if (currentTimerItem.Running)
                    {
                        tmrCountdown.Start();
                    }
                    else
                    {
                        tmrCountdown.Stop();
                    }


                    BLIO.Log("Setting values of (UCTimer) numericupdowns");
                    TimeSpan time = TimeSpan.FromSeconds((double)currentTimerItem.SecondsRemaining);
                    numSeconds.Value = time.Seconds;
                    numMinutes.Value = time.Minutes;
                    numHours.Value   = time.Hours;
                }
            }

            //Show play or pause depending on if the selected timer is running or not
            if (currentTimerItem.Running)
            {
                btnPauseResumeTimer.Iconimage = Properties.Resources.pause_2x1;
            }
            else
            {
                btnPauseResumeTimer.Iconimage = Properties.Resources.Play;
            }

            EnableButton(clickedButton);
        }
예제 #2
0
        private void ucTimerDeleteToolstrip_Click(object sender, EventArgs e)
        {
            //First, see what button is pressed
            BunifuFlatButton button = null;

            foreach (Control c in pnlRunningTimers.Controls)
            {
                if (c is BunifuFlatButton)
                {
                    button = (BunifuFlatButton)c;

                    if (button.Normalcolor == Color.Gray)
                    {
                        break;
                    }
                }
            }

            //Now that we have the selected button stored in the "button" variable, let's work with it
            //Get the id
            int id = GetTimerButtonId(button);
            //Use the id to get the correct TimerItem from the "timers" collection, and delete it
            TimerItem toRemoveItem = timers.Where(t => t.ID == id).ToList()[0];

            RemoveTimer(toRemoveItem);
            toRemoveItem.Dispose();

            //Set the current timer to the first one in the list
            if (timers.Count > 0)
            {
                currentTimerItem      = timers[0];
                lblTimerTitle.Visible = true;

                BLIO.Log("Setting values of (UCTimer) numericupdowns");
                TimeSpan time = TimeSpan.FromSeconds((double)currentTimerItem.SecondsRemaining);
                numSeconds.Value = time.Seconds;
                numMinutes.Value = time.Minutes;
                numHours.Value   = time.Hours;
            }
            else  //Nothing left
            {
                numSeconds.Value = 0;
                numMinutes.Value = 0;
                numHours.Value   = 0;
                btnPauseResumeTimer.Iconimage = Properties.Resources.pause_2x1;
                lblTimerTitle.Visible         = false;
            }

            //Set the pause/resume icon image depending on the current timer
            if (currentTimerItem.Disposed || currentTimerItem == null)
            {
                return;
            }

            tmrCountdown.Enabled = currentTimerItem.Running;

            if (currentTimerItem.Running)
            {
                btnPauseResumeTimer.Iconimage = Properties.Resources.pause_2x1;
            }
            else
            {
                btnPauseResumeTimer.Iconimage = Properties.Resources.Play;
            }

            //Now make the current TimerItem button selected
            foreach (Control c in pnlRunningTimers.Controls)
            {
                if (c is BunifuFlatButton)
                {
                    button = (BunifuFlatButton)c;

                    if (GetTimerButtonId(button) == currentTimerItem.ID)
                    {
                        button.Normalcolor = Color.Gray; //This is our button
                    }
                }
            }
        }
 private void btn_Click(object sender, EventArgs e)
 {
     try
     {
         btnSet            = (BunifuFlatButton)sender;
         flowUsers.Enabled = false;
         com.CommandText   = "select PricePerShare from tbl_setting";
         con.Open();
         PricePerShare = int.Parse(com.ExecuteScalar().ToString());
         con.Close();
         for (i = 0; i < dataTable.Rows.Count; i++)
         {
             if (dataTable.Rows[i][0].ToString() == btnSet.Text.Substring(btnSet.Text.IndexOf(" ") + 1, btnSet.Text.Length - (btnSet.Text.IndexOf(" ") + 1)))
             {
                 break;
             }
         }
         txtCode.Text         = dataTable.Rows[i][0].ToString();
         txtName.Text         = dataTable.Rows[i][1].ToString() + " " + dataTable.Rows[i][2].ToString();
         txtNumberSahm.Text   = dataTable.Rows[i][3].ToString();
         txtTotalSarmaye.Text = dataTable.Rows[i][4].ToString();
         txtPayMonthly.Text   = (long.Parse(dataTable.Rows[i][3].ToString()) * PricePerShare).ToString();
         txtLastDatePay.Text  = dataTable.Rows[i][6].ToString();
         string date120 = dataTable.Rows[i][7].ToString();
         txtPrevious.Text = dataTable.Rows[i][7].ToString();
         string[] date = ClassCurrentDate.currentDate.Split('/');
         txtYear.Text  = date[0];
         txtMonth.Text = date[1];
         txtDay.Text   = date[2];
         string[] datePrevious = txtLastDatePay.Text.Split('/');
         //برای محاسبه عقب مانده
         if (int.Parse(date[0]) == int.Parse(datePrevious[0]))
         {
             //شرط بالا برای سال جاری
             if (int.Parse(date[1]) > int.Parse(datePrevious[1]))
             {
                 if (int.Parse(date[2]) > int.Parse(datePrevious[2]))
                 {
                     txtPrevious.Text = ((int.Parse(date[1])) - (int.Parse(datePrevious[1]))).ToString();
                     txtPrevious.Text = (int.Parse(txtPrevious.Text) + int.Parse(dataTable.Rows[i][7].ToString())).ToString();
                 }
                 else
                 {
                     txtPrevious.Text = (((int.Parse(date[1])) - (int.Parse(datePrevious[1]))) - 1).ToString();
                     txtPrevious.Text = (int.Parse(txtPrevious.Text) + int.Parse(dataTable.Rows[i][7].ToString())).ToString();
                 }
             }
         }
         //برای سال بعد
         if (int.Parse(date[0]) > int.Parse(datePrevious[0]))
         {
             if ((int.Parse(date[2]) > int.Parse(datePrevious[2])))
             {
                 txtPrevious.Text = (int.Parse(date[1]) + (((int.Parse(date[0]) - int.Parse(datePrevious[0])) * 12) - int.Parse(datePrevious[1]))).ToString();
                 txtPrevious.Text = (int.Parse(txtPrevious.Text) + int.Parse(dataTable.Rows[i][7].ToString())).ToString();
             }
             else
             {
                 txtPrevious.Text = ((((int.Parse(date[0]) - int.Parse(datePrevious[0])) * 12) - int.Parse(datePrevious[1])) + (int.Parse(date[1]) - 1)).ToString();
                 txtPrevious.Text = (int.Parse(txtPrevious.Text) + int.Parse(dataTable.Rows[i][7].ToString())).ToString();
             }
         }
         if (int.Parse(txtPrevious.Text) < 0)
         {
             txtPrevious.Text = "0";
         }
         flowUsers.Enabled     = true;
         btnPayMonthly.Enabled = true;
     }
     catch
     {
         MessageBox.Show(".خطا در آوردن اطلاعات لطفا دکمه تازه سازی را بزنیدیا یکبار برنامه رو راه اندازی مجدد کنید", "!!خطا", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #4
0
파일: items.cs 프로젝트: ikwabe/UdoRead
        private void loadItems()
        {
            MySqlConnection con = new MySqlConnection();

            con.ConnectionString = login.dbConnection;

            string       load = "select item_id,item_name,status from sentitems where receiver_email = '" + login.user_email + "' order by item_id DESC";
            MySqlCommand com  = new MySqlCommand(load, con);

            DataTable       table = new DataTable();
            MySqlDataReader reader;

            try
            {
                con.Open();
                reader = com.ExecuteReader();
                table.Load(reader);
                reader.Close();
                count = table.Rows.Count;
                if (count == 0)
                {
                    //a lable to hold the name of the item
                    Label item = new Label();
                    item           = new Label();
                    item.AutoSize  = true;
                    item.ForeColor = Color.FromArgb(235, 60, 0);
                    item.Font      = new Font("Cambria", 15, FontStyle.Bold);
                    item.Text      = "Sorry, You Have No Items To View -:)";

                    //seperator for the emails
                    BunifuSeparator spr = new BunifuSeparator();
                    spr.LineThickness = 2;
                    spr.Height        = 1;
                    spr.Anchor        = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
                    spr.LineColor     = Color.FromArgb(0, 122, 204);
                    spr.Transparency  = 50;

                    //a panel to catch the rows
                    FlowLayoutPanel fly = new FlowLayoutPanel();
                    fly.Height        = 40;
                    fly.Width         = 850;
                    fly.AutoSize      = true;
                    fly.FlowDirection = FlowDirection.LeftToRight;
                    fly.WrapContents  = false;

                    //adding the controls to the dynamic panel
                    fly.Controls.Add(item);

                    //adding the pannel to the mother flowpanel
                    flowLayoutPanel1.Controls.Add(fly);
                    flowLayoutPanel1.Controls.Add(spr);
                }
                else
                {
                    reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        //taking the item id
                        string item_id = reader.GetString("item_id");
                        //taking th enam of the item
                        string item_name = reader.GetString("item_name");
                        //checking the status of the item
                        string status = reader.GetString("status");

                        //checking if the item is new(never opened)
                        if (status == "New")
                        {
                            //creating a sign to show the item is new
                            Label sign = new Label();
                            sign.Text      = "New";
                            sign.Font      = new Font("Cambria", 8, FontStyle.Bold);
                            sign.ForeColor = Color.DarkGreen;

                            //a lable to hold the name of the item
                            Label item = new Label();
                            item           = new Label();
                            item.Name      = item_id;
                            item.Width     = 500;
                            item.ForeColor = Color.FromArgb(30, 0, 40);
                            item.Font      = new Font("Cambria", 12, FontStyle.Bold);
                            item.Text      = item_name;

                            //creating the butto to download the item
                            // Download Button
                            BunifuFlatButton bt = new BunifuFlatButton();
                            bt.Name   = item_id;
                            bt.Text   = "Download";
                            bt.Height = 30;
                            bt.Width  = 120;

                            bt.Normalcolor  = Color.FromArgb(0, 122, 204);
                            bt.OnHovercolor = Color.FromArgb(32, 9, 191);
                            bt.Activecolor  = Color.FromArgb(0, 122, 204);
                            bt.Iconimage    = null;
                            bt.TextAlign    = ContentAlignment.MiddleCenter;
                            bt.BorderRadius = 5;
                            bt.Click       += new EventHandler(downloadBtn_Click);

                            // Delete Button
                            BunifuFlatButton bt1 = new BunifuFlatButton();
                            bt1.Name         = item_id;
                            bt1.Text         = "Delete";
                            bt1.Height       = 30;
                            bt1.Width        = 120;
                            bt1.Normalcolor  = Color.FromArgb(0, 122, 204);
                            bt1.OnHovercolor = Color.FromArgb(32, 9, 191);
                            bt1.Activecolor  = Color.FromArgb(0, 122, 204);
                            bt1.Iconimage    = null;
                            bt1.TextAlign    = ContentAlignment.MiddleCenter;
                            bt1.BorderRadius = 5;
                            bt1.Click       += new EventHandler(deletebtn_Click);

                            //seperator for the emails
                            BunifuSeparator spr = new BunifuSeparator();
                            spr.LineThickness = 2;
                            spr.Height        = 1;
                            spr.Anchor        = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
                            spr.LineColor     = Color.FromArgb(235, 60, 0);
                            spr.Transparency  = 50;

                            //a panel to catch the rows
                            FlowLayoutPanel fly = new FlowLayoutPanel();
                            fly.Height        = 40;
                            fly.Width         = 850;
                            fly.AutoSize      = true;
                            fly.FlowDirection = FlowDirection.LeftToRight;
                            fly.WrapContents  = false;

                            //adding the controls to the dynamic panel
                            fly.Controls.Add(sign);
                            fly.Controls.Add(item);
                            fly.Controls.Add(bt);
                            fly.Controls.Add(bt1);

                            //adding the pannel to the mother flowpanel
                            flowLayoutPanel1.Controls.Add(fly);
                            flowLayoutPanel1.Controls.Add(spr);
                        }
                        else
                        {
                            //creating a sign to show the item is new
                            Label sign = new Label();
                            sign.Text      = "√";
                            sign.Font      = new Font("Cambria", 9, FontStyle.Bold);
                            sign.ForeColor = Color.FromArgb(235, 60, 0);
                            //a lable to hold the name of the item
                            Label item = new Label();
                            item           = new Label();
                            item.Name      = item_id;
                            item.Width     = 500;
                            item.ForeColor = Color.FromArgb(129, 129, 131);
                            item.Font      = new Font("Cambria", 12, FontStyle.Regular);
                            item.Text      = item_name;

                            //creating the butto to download the item
                            //Button
                            BunifuFlatButton bt = new BunifuFlatButton();
                            bt.Name   = item_id;
                            bt.Text   = "View";
                            bt.Height = 30;
                            bt.Width  = 120;

                            bt.Normalcolor  = Color.DarkGray;
                            bt.OnHovercolor = Color.DimGray;
                            bt.Activecolor  = Color.DarkGray;
                            bt.Iconimage    = null;
                            bt.TextAlign    = ContentAlignment.MiddleCenter;
                            bt.BorderRadius = 5;
                            bt.Click       += new EventHandler(viewBtn_Click);

                            // Delete Button
                            BunifuFlatButton bt1 = new BunifuFlatButton();
                            bt1.Name         = item_id;
                            bt1.Text         = "Delete";
                            bt1.Height       = 30;
                            bt1.Width        = 120;
                            bt1.Normalcolor  = Color.DarkGray;
                            bt1.OnHovercolor = Color.DimGray;
                            bt1.Activecolor  = Color.DarkGray;
                            bt1.Iconimage    = null;
                            bt1.TextAlign    = ContentAlignment.MiddleCenter;
                            bt1.BorderRadius = 5;
                            bt1.Click       += new EventHandler(deletebtn_Click);

                            //Redownload Button
                            BunifuFlatButton bt2 = new BunifuFlatButton();
                            bt2.Name   = item_id;
                            bt2.Text   = "Re-Download";
                            bt2.Height = 30;
                            bt2.Width  = 120;

                            bt2.Normalcolor  = Color.DarkGray;
                            bt2.OnHovercolor = Color.DimGray;
                            bt2.Activecolor  = Color.DarkGray;
                            bt2.Iconimage    = null;
                            bt2.TextAlign    = ContentAlignment.MiddleCenter;
                            bt2.BorderRadius = 5;
                            bt2.Click       += new EventHandler(downloadBtn_Click);

                            //seperator for the emails
                            BunifuSeparator spr = new BunifuSeparator();
                            spr.LineThickness = 2;
                            spr.Height        = 1;
                            spr.Anchor        = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
                            spr.LineColor     = Color.FromArgb(235, 60, 0);
                            spr.Transparency  = 50;


                            //a panel to catch the rows
                            FlowLayoutPanel fly = new FlowLayoutPanel();
                            fly.Height        = 40;
                            fly.Width         = 850;
                            fly.AutoSize      = true;
                            fly.FlowDirection = FlowDirection.LeftToRight;
                            fly.WrapContents  = false;

                            //adding the controls to the dynamic panel
                            fly.Controls.Add(sign);
                            fly.Controls.Add(item);
                            fly.Controls.Add(bt);
                            fly.Controls.Add(bt1);
                            fly.Controls.Add(bt2);

                            //adding the pannel to the mother flowpanel
                            flowLayoutPanel1.Controls.Add(fly);
                            flowLayoutPanel1.Controls.Add(spr);
                        }
                    }
                }
                reader.Close();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
        }
예제 #5
0
파일: postb.cs 프로젝트: ikwabe/UdoRead
        //the function to retrieve user acounts from the databases
        private void showFriend()
        {
            MySqlConnection con = new MySqlConnection();
            con.ConnectionString = login.dbConnection;
            MySqlDataAdapter ad;

            //reading data query
            string readAccount = "select * from users where user_id <> '"+ login.user_id +"'";

           

            //string to read userID from request table
            string checkReq = "select * from requests where sender_id = '"+ login.user_id +"'";
            con.Open();
            //for request user_id fetch
            MySqlCommand com1 = new MySqlCommand(checkReq, con);
            ad = new MySqlDataAdapter(com1);
            DataTable table = new DataTable();
            ad.Fill(table);

            //execute ones to check if the database is empty or not
            object nullValue = com1.ExecuteScalar();
            

            ReqUser_id = new int[table.Rows.Count];
            for(int i =0; i< table.Rows.Count; i++)
            {
                ReqUser_id[i] = (int)table.Rows[i][1];
            }
            ad.Dispose();

            //for users 
            MySqlCommand com = new MySqlCommand(readAccount, con);
           
            ad = new MySqlDataAdapter(com);
            DataTable table1 = new DataTable();
            ad.Fill(table1);
            
            i = 0;
            
            for (int j = 0; j < table1.Rows.Count; j++)
            {
               string user_id = table1.Rows[j][0].ToString();

                //if the database return null value
                if(nullValue == null || nullValue == DBNull.Value)
                {
                    //Image
                    PictureBox phot = new PictureBox();
                    phot.Width = 120;
                    phot.Height = 95;
                    phot.Name = user_id;
                    phot.SizeMode = PictureBoxSizeMode.Zoom;
                    phot.Cursor = Cursors.Hand;
                    phot.Click += new EventHandler(ProfilePhoto_Click);
                    //takking photo to the panel
                    try
                    {
                        byte[] img = (byte[])table1.Rows[j][7];
                        MemoryStream ms = new MemoryStream(img);
                        phot.Image = Image.FromStream(ms);



                    }
                    catch
                    {

                    }

                    //User Full name
                    string fullname = table1.Rows[j][1].ToString() + " " + table1.Rows[j][2].ToString();
                    Label uname = new Label();
                    uname = new Label();
                    uname.Name = table1.Rows[j][0].ToString();
                    uname.AutoSize = true;
                    uname.ForeColor = Color.DarkGreen;
                    uname.Cursor = Cursors.Hand;
                    uname.Font = new Font("Cambria", 11, FontStyle.Bold);
                    uname.Click += new EventHandler(uname_Click);
                    uname.Text = fullname;

                    //Button
                    BunifuFlatButton bt = new BunifuFlatButton();
                    bt.Name = user_id;
                    bt.Text = "Follow";
                    bt.Height = 30;
                    bt.Width = 120;
                    bt.Normalcolor = Color.FromArgb(0, 122, 204);
                    bt.OnHovercolor = Color.FromArgb(32, 9, 191);
                    bt.Activecolor = Color.FromArgb(0, 122, 204);
                    bt.Iconimage = null;
                    bt.TextAlign = ContentAlignment.MiddleCenter;
                    bt.BorderRadius = 5;
                    bt.Click += new EventHandler(addFriendBtn_Click);

                    //taking photo to panel
                    flowLayoutPanel2.Controls.Add(phot);

                    //adding user name to the panel
                    flowLayoutPanel2.Controls.Add(uname);

                    //adding button to the panel
                    flowLayoutPanel2.Controls.Add(bt);

                }
                //if the database doesnt return null value
                else
                {

                        try
                        {
                            //reseting if the requests index bound exeeds
                            if (i > (table.Rows.Count - 1))
                            {
                                i = table.Rows.Count - 1;

                            }
                            else
                            {

                            }
                            //checking if the request is available
                            if (ReqUser_id[i] != int.Parse(user_id))
                            {
                                //Image
                                PictureBox phot = new PictureBox();
                                phot.Width = 120;
                                phot.Height = 95;
                                phot.Name = user_id;
                                phot.SizeMode = PictureBoxSizeMode.Zoom;
                                phot.Cursor = Cursors.Hand;
                            phot.Click += new EventHandler(ProfilePhoto_Click);
                            //takking photo to the panel
                            try
                                {
                                    byte[] img = (byte[])table1.Rows[j][7];
                                    MemoryStream ms = new MemoryStream(img);
                                    phot.Image = Image.FromStream(ms);


                                }
                                catch
                                {

                                }

                                //User Full name
                                string fullname = table1.Rows[j][1].ToString() + " " + table1.Rows[j][2].ToString();
                                Label uname = new Label();
                                uname = new Label();
                            uname.Name = table1.Rows[j][0].ToString();
                            uname.AutoSize = true;
                            uname.ForeColor = Color.DarkGreen;
                            uname.Cursor = Cursors.Hand;
                            uname.Font = new Font("Cambria", 11, FontStyle.Bold);
                            uname.Click += new EventHandler(uname_Click);
                            uname.Text = fullname;

                            //Button
                            BunifuFlatButton bt = new BunifuFlatButton();
                                bt.Name = user_id;
                                bt.Text = "Follow";
                                bt.Height = 30;
                                bt.Width = 120;
                                bt.Normalcolor = Color.FromArgb(0, 122, 204);
                                bt.OnHovercolor = Color.FromArgb(32, 9, 191);
                                bt.Activecolor = Color.FromArgb(0, 122, 204);
                                bt.Iconimage = null;
                                bt.TextAlign = ContentAlignment.MiddleCenter;
                                bt.BorderRadius = 5;
                                bt.Click += new EventHandler(addFriendBtn_Click);

                                //taking photo to panel
                                flowLayoutPanel2.Controls.Add(phot);

                                //adding user name to the panel
                                flowLayoutPanel2.Controls.Add(uname);

                                //adding button to the panel
                                flowLayoutPanel2.Controls.Add(bt);


                            }
                            else
                            {


                            }
                            i++;
                        }
                        catch
                        {

                        }
                  
                   
                }
               
            }

            ad.Dispose();
            con.Close();
        }
예제 #6
0
        private void menuTiklanma(object sender, EventArgs e)
        {
            kullanicilarUserControl.listView1.Visible    = false;
            urunlerUserControl.listView2.Visible         = false;
            masalarUserControl.flowLayoutPanel1.Visible  = false;
            durumlarUserControl.flowLayoutPanel3.Visible = false;
            ciroUserControl.flowLayoutPanel5.Visible     = false;
            anaPanel.Controls.Clear();
            BunifuFlatButton gelen = (BunifuFlatButton)sender;

            genelButton.Enabled        = true;
            kullanicilarButton.Enabled = true;
            urunlerButton.Enabled      = true;
            masalarButton.Enabled      = true;
            optimizasyonButton.Enabled = true;
            sonDurumlarButton.Enabled  = true;
            cikisButton.Enabled        = true;
            gelen.Enabled = false;
            bunifuTransition3.HideSync(yanPanel);
            yanPanel.Location = new Point(yanPanel.Location.X, gelen.Location.Y);
            bunifuTransition3.ShowSync(yanPanel);
            ustBaslikLabel.Text = gelen.Text;
            pictureBox3.Image   = gelen.Iconimage;
            switch (gelen.Text)
            {
            case "Genel":
                anaPanel.Controls.Add(ciroUserControl.flowLayoutPanel5);
                ciroUserControl.flowLayoutPanel5.Visible = true;
                ciroUserControl.flowLayoutPanel5.Dock    = DockStyle.Fill;
                ciroUserControl.YenidenBoyutlandir();
                break;

            case "Kullanıcılar":
                anaPanel.Controls.Add(kullanicilarUserControl.listView1);
                kullanicilarUserControl.listView1.Visible = true;
                kullanicilarUserControl.listView1.Dock    = DockStyle.Fill;
                break;

            case "Ürünler":
                anaPanel.Controls.Add(urunlerUserControl.listView2);
                urunlerUserControl.listView2.Visible = true;
                urunlerUserControl.listView2.Dock    = DockStyle.Fill;
                break;

            case "Masalar":
                anaPanel.Controls.Add(masalarUserControl.flowLayoutPanel1);
                masalarUserControl.flowLayoutPanel1.Visible = true;
                masalarUserControl.flowLayoutPanel1.Dock    = DockStyle.Fill;
                break;

            case "Optimizasyon":
                anaPanel.Controls.Add(optimizasyonUserControl.optimizasyonPanel);
                optimizasyonUserControl.optimizasyonPanel.Visible = true;
                optimizasyonUserControl.optimizasyonPanel.Dock    = DockStyle.Fill;
                break;

            case "Son Durumlar":
                anaPanel.Controls.Add(durumlarUserControl.flowLayoutPanel3);
                durumlarUserControl.flowLayoutPanel3.Visible = true;
                durumlarUserControl.flowLayoutPanel3.Dock    = DockStyle.Fill;
                break;

            case "Çıkış":
                anaPanel.Controls.Add(cikisUserControl.cikisPanel);
                cikisUserControl.cikisPanel.Visible = true;
                cikisUserControl.cikisPanel.Dock    = DockStyle.Fill;
                break;
            }
        }
예제 #7
0
파일: postb.cs 프로젝트: ikwabe/UdoRead
        //function for retreaving posts from post table
        private void loadPost()
        {
            MySqlConnection con = new MySqlConnection();
            con.ConnectionString = login.dbConnection;
            MySqlDataAdapter ad;

            //reading data query
            string readImage = "select * from post";

            //read the comments 
            string loadcomments = "select post_id,comment,user_name,user_id from comments";
            MySqlCommand com1 = new MySqlCommand(loadcomments, con);
            DataTable table = new DataTable();
            MySqlDataReader rd;
            try
            {
                con.Open();
                //taking the comments
                rd = com1.ExecuteReader();
                table.Load(rd);
                rd.Close();

                MySqlCommand com = new MySqlCommand(readImage, con);
                ad = new MySqlDataAdapter(com);
                DataTable table1 = new DataTable();
                ad.Fill(table1);



                bt = new BunifuFlatButton[table1.Rows.Count];
                phot = new PictureBox[table1.Rows.Count];
                btnName = new string[table1.Rows.Count];
                comPanel = new FlowLayoutPanel[table1.Rows.Count];
                count = table1.Rows.Count;
                dbCount = table1.Rows.Count;
                for (int j = 0; j < table1.Rows.Count; j++)
                {

                    i++;
                    string post_id = table1.Rows[j][0].ToString();
                    //Image
                    phot[j] = new PictureBox();
                    phot[j].Width = 300;
                    phot[j].Height = 172;
                    phot[j].Name = post_id;
                    phot[j].SizeMode = PictureBoxSizeMode.Zoom;
                    phot[j].Cursor = Cursors.Hand;
                    phot[j].Click += new EventHandler(photoClickBtn_Click);
                    //takking photo to the panel
                    try
                    {
                        byte[] img = (byte[])table1.Rows[j][1];
                        MemoryStream ms = new MemoryStream(img);
                        phot[j].Image = Image.FromStream(ms);


                    }
                    catch
                    {

                    }

                    //Label
                    lb = new Label();
                    lb.Name = "lable" + k;
                    lb.AutoSize = true;
                    lb.Font = new Font("Cambria", 16);
                    try
                    {
                        lb.Text = table1.Rows[j][2].ToString();

                    }
                    catch
                    {

                    }
                    //User Full name
                    string fullname = table1.Rows[j][5].ToString();
                    Label uname = new Label();
                    uname = new Label();
                    uname.Name = table1.Rows[j][3].ToString();
                    uname.AutoSize = true;
                    uname.ForeColor = Color.DarkGreen;
                    uname.Cursor = Cursors.Hand;
                    uname.Font = new Font("Cambria", 14);
                    uname.Text = "Posted by: " + fullname;
                    uname.Click += new EventHandler(uname_Click);
                    //Button

                    bt[j] = new BunifuFlatButton();
                    bt[j].Text = "Comment";
                    bt[j].Name = post_id;
                    bt[j].Height = 25;
                    bt[j].Width = 100;
                    bt[j].Normalcolor = Color.FromArgb(0, 122, 204);
                    bt[j].OnHovercolor = Color.FromArgb(32, 9, 191);
                    bt[j].Activecolor = Color.FromArgb(0, 122, 204);
                    bt[j].Iconimage = null;
                    bt[j].TextAlign = ContentAlignment.MiddleCenter;
                    bt[j].BorderRadius = 5;
                    bt[j].Click += new EventHandler(commentPostBtn_Click);

                    //TextBox
                    txt = new BunifuCustomTextbox();
                    txt.Name = post_id;
                    txt.Width = 300;
                    txt.Height = 25;
                    txt.Multiline = true;
                    txt.Font = new Font("Cambria", 11);
                    txt.BackColor = Color.FromArgb(240, 240, 240);
                    txt.BorderStyle = BorderStyle.FixedSingle;
                    txt.ForeColor = Color.Black;
                    txt.BorderColor = Color.FromArgb(32, 9, 191);
                    txt.TextChanged += new EventHandler(txt_TextChanged);

                    //a panel for photo
                    FlowLayoutPanel photoPanel = new FlowLayoutPanel();

                    photoPanel.AutoSize = true;
                    photoPanel.Controls.Add(phot[j]);

                    ////a panel forcomments
                    comPanel[j] = new FlowLayoutPanel();
                    comPanel[j].AutoSize = true;
                    comPanel[j].Name = post_id;
                    comPanel[j].BackColor = Color.LightGray;
                    comPanel[j].FlowDirection = FlowDirection.TopDown;
                    //adding data to comment panel

                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        if (comPanel[j].Name == table.Rows[i][0].ToString())
                        {
                            //label
                            Label coomm = new Label();
                            coomm.Font = new Font("Sitka Small", 11, FontStyle.Bold);
                            coomm.ForeColor = Color.FromArgb(30, 0, 40);
                            coomm.Text = ": " + table.Rows[i][1].ToString();
                            coomm.AutoSize = true;

                            //LinkLable for username
                            LinkLabel userbt = new LinkLabel();
                           userbt.Text = table.Rows[i][2].ToString();
                           userbt.Name = table.Rows[i][3].ToString();
                            userbt.ActiveLinkColor = Color.Gray;
                           userbt.LinkColor = Color.Gray;
                           userbt.AutoSize = true;
                            userbt.LinkBehavior = LinkBehavior.NeverUnderline;
                            userbt.Cursor = Cursors.Hand;
                            userbt.BackColor = Color.Transparent;
                           userbt.Font = new Font("Lucida Fax", 9, FontStyle.Bold);
                           userbt.TextAlign = ContentAlignment.MiddleLeft;
                           userbt.Click += new EventHandler(buttonBtn_Click);

                            //flowlayout to add comment and name 
                            FlowLayoutPanel content = new FlowLayoutPanel();
                            content.FlowDirection = FlowDirection.LeftToRight;
                            content.WrapContents = false;
                            content.AutoSize = true;

                            //ading the comment to the panel
                            content.Controls.Add(userbt);
                            content.Controls.Add(coomm);

                            //adding the panel to the main panel
                            comPanel[j].AutoSize = true;
                            comPanel[j].Controls.Add(content);
                        }
                        else
                        {

                        }

                    }

                    //a panel for comment text and button
                    FlowLayoutPanel commentPanel = new FlowLayoutPanel();
                    commentPanel.AutoSize = true;
                    commentPanel.FlowDirection = FlowDirection.LeftToRight;
                    commentPanel.WrapContents = false;
                    commentPanel.Controls.Add(txt);
                    commentPanel.Controls.Add(bt[j]);

                    //a panel for caption
                    FlowLayoutPanel captionPanel = new FlowLayoutPanel();
                    captionPanel.AutoSize = true;

                    captionPanel.Controls.Add(lb);

                    //a panel for caption
                    FlowLayoutPanel unamePanel = new FlowLayoutPanel();
                    unamePanel.AutoSize = true;

                    unamePanel.Controls.Add(uname);

                    ////adding comment and button to the panel
                    flowLayoutPanel1.Controls.Add(commentPanel);

                    //taking comments to panel
                    flowLayoutPanel1.Controls.Add(comPanel[j]);

                    ////taking photo to panel
                    flowLayoutPanel1.Controls.Add(photoPanel);

                    ////taking lable to the panel
                    flowLayoutPanel1.Controls.Add(captionPanel);

                    //adding user name to the panel
                    flowLayoutPanel1.Controls.Add(unamePanel);

                }

                ad.Dispose();
            }
            catch(MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
           

        }
예제 #8
0
파일: postb.cs 프로젝트: ikwabe/UdoRead
        //boolean for activating the instant post
       
        //add posted post at instant
        private void instLoadPost()
        {
            MySqlConnection con = new MySqlConnection();
            con.ConnectionString = login.dbConnection;
            MySqlDataAdapter ad;

            //query to check if the post is added at instant
            string readpost = "SELECT * FROM  post where chek = 'New' order by post_id DESC LIMIT 1";

            MySqlCommand com = new MySqlCommand(readpost, con);
            ad = new MySqlDataAdapter(com);
            DataTable table1 = new DataTable();
            ad.Fill(table1);
            ad.Dispose();

            bt = new BunifuFlatButton[table1.Rows.Count];
            phot = new PictureBox[table1.Rows.Count];
            btnName = new string[table1.Rows.Count];
            try
            {
                con.Open();
                if (table1.Rows.Count > 0)
                {
                    
                    for (int j = 0; j < table1.Rows.Count; j++)
                    {
                        i++;
                        string post_id = table1.Rows[j][0].ToString();
                        //Image
                        phot[j] = new PictureBox();
                        phot[j].Width = 300;
                        phot[j].Height = 172;
                        phot[j].Name = post_id;
                        phot[j].SizeMode = PictureBoxSizeMode.Zoom;
                        phot[j].Cursor = Cursors.Hand;
                        phot[j].Click += new EventHandler(photoClickBtn_Click);
                        //takking photo to the panel
                        try
                        {
                            byte[] img = (byte[])table1.Rows[j][1];
                            MemoryStream ms = new MemoryStream(img);
                            phot[j].Image = Image.FromStream(ms);


                        }
                        catch
                        {

                        }

                        //Label
                        lb = new Label();
                        lb.Name = "lable" + k;
                        lb.AutoSize = true;
                        lb.Font = new Font("Cambria", 16);
                        try
                        {
                            lb.Text = table1.Rows[j][2].ToString();

                        }
                        catch
                        {

                        }
                        //User Full name
                        string fullname = table1.Rows[j][5].ToString();
                        Label uname = new Label();
                        uname = new Label();
                        uname.Name = table1.Rows[j][3].ToString();
                        uname.AutoSize = true;
                        uname.ForeColor = Color.DarkGreen;
                        uname.Font = new Font("Cambria", 14);
                        uname.Cursor = Cursors.Hand;
                        uname.Text = "Posted by: " + fullname;
                        uname.Click += new EventHandler(uname_Click);
                        //Button

                        bt[j] = new BunifuFlatButton();
                        bt[j].Text = "Comment";
                        bt[j].Name = post_id;
                        bt[j].Height = 25;
                        bt[j].Width = 100;
                        bt[j].Normalcolor = Color.FromArgb(0, 122, 204);
                        bt[j].OnHovercolor = Color.FromArgb(32, 9, 191);
                        bt[j].Activecolor = Color.FromArgb(0, 122, 204);
                        bt[j].Iconimage = null;
                        bt[j].TextAlign = ContentAlignment.MiddleCenter;
                        bt[j].BorderRadius = 5;
                        bt[j].Click += new EventHandler(commentPostBtn_Click);

                        //TextBox
                        txt = new BunifuCustomTextbox();
                        txt.Name = post_id;
                        txt.Width = 300;
                        txt.Height = 25;
                        txt.Multiline = true;
                        txt.Font = new Font("Cambria", 11);
                        txt.BackColor = Color.FromArgb(240, 240, 240);
                        txt.BorderStyle = BorderStyle.FixedSingle;
                        txt.ForeColor = Color.Black;
                        txt.BorderColor = Color.FromArgb(32, 9, 191);
                        txt.TextChanged += new EventHandler(txt_TextChanged);

                        //a panel for photo
                        FlowLayoutPanel photoPanel = new FlowLayoutPanel();

                        photoPanel.AutoSize = true;
                        photoPanel.Controls.Add(phot[j]);

                        ////a panel forcomments
                        comPanel[j] = new FlowLayoutPanel();
                        comPanel[j].AutoSize = true;
                        comPanel[j].Name = post_id;
                        comPanel[j].BackColor = Color.LightGray;
                        comPanel[j].FlowDirection = FlowDirection.TopDown;

                        //a panel for comment and button
                        FlowLayoutPanel commentPanel = new FlowLayoutPanel();
                        commentPanel.AutoSize = true;
                        commentPanel.FlowDirection = FlowDirection.LeftToRight;
                        commentPanel.WrapContents = false;
                        commentPanel.Controls.Add(txt);
                        commentPanel.Controls.Add(bt[j]);

                        //a panel for caption
                        FlowLayoutPanel captionPanel = new FlowLayoutPanel();
                        captionPanel.AutoSize = true;

                        captionPanel.Controls.Add(lb);

                        //a panel for caption
                        FlowLayoutPanel unamePanel = new FlowLayoutPanel();
                        unamePanel.AutoSize = true;

                        unamePanel.Controls.Add(uname);

                        ////adding comment and button to the panel
                        flowLayoutPanel1.Controls.Add(commentPanel);

                        //taking comments to panel
                        flowLayoutPanel1.Controls.Add(comPanel[j]);

                        ////taking photo to panel
                        flowLayoutPanel1.Controls.Add(photoPanel);

                        ////taking lable to the panel
                        flowLayoutPanel1.Controls.Add(captionPanel);

                        //adding user name to the panel
                        flowLayoutPanel1.Controls.Add(unamePanel);


                        //update the poast
                        string update = "update post set chek = 'Posted' where post_id = '" + post_id + "'";
                        MySqlCommand com1 = new MySqlCommand(update, con);
                        MySqlDataReader rd;

                        rd = com1.ExecuteReader();
                        rd.Close();

                    }
                   
                }

            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();





        }
예제 #9
0
        public void CheckNotification()
        {
            string user = "";
            int    schedctr = 0, critlvlctr = 0, balancectr = 0, donectr = 0, totalctr = 0;
            string date = DateTime.Now.ToString("yyyy-MM-dd");
            string time = DateTime.Now.ToString("hh:mm:ss tt");
            int    checkhour = Convert.ToInt32(time.Substring(0, 2));
            int    checkmin = Convert.ToInt32(time.Substring(3, 2));
            string checkampm = time.Substring(9, 2);
            int    hour = 0, min = 0, endhour = 0, endmin = 0, qty = 0, crit = 0, j = 0, ctr = 0, checkappointmentno = 0;
            string ampm = "", endampm = "", empname = "";
            bool   check = false, checker = false, checks = false, checking = false;

            int[]            appointmentno  = new int[500];
            BunifuFlatButton btnDoneAppoint = new BunifuFlatButton();
            BunifuFlatButton btnBalance     = new BunifuFlatButton();
            BunifuFlatButton btnCritLvl     = new BunifuFlatButton();
            bool             upAppoint      = checkUpAppoint();
            bool             doneAppoint    = checkDoneAppoint();

            if (upAppoint)
            {
                Label lbl = new Label();
                lbl.Text   = "These employee(s) have an appointment";
                lbl.Font   = new Font("Arial", 8);
                lbl.Size   = new Size(200, 15);
                lbl.Margin = new Padding(3, 3, 3, 3);
                notificationPanel1.Controls.Add(lbl);
                try
                {
                    connection.Open();
                    MySqlCommand    cmd        = new MySqlCommand("SELECT *,CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit) from appointmenttbl a, employee_appointmenttbl ea, employee_patienttbl ep, employeetbl e where Appointment_Date = '" + date + "' and a.Appointment_Status = 'Not Started' and a.Appointment_No = ea.Appointment_No and ea.Employee_Patient_No = ep.Employee_Patient_No and ep.Employee_No = e.Employee_No group by e.Employee_No", connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        hour    = Convert.ToInt32(dataReader.GetString("Appointment_StartTime").Substring(0, 2));
                        min     = Convert.ToInt32(dataReader.GetString("Appointment_StartTime").Substring(3, 2));
                        ampm    = dataReader.GetString("Appointment_StartTime").Substring(6, 2);
                        endhour = Convert.ToInt32(dataReader.GetString("Appointment_EndTime").Substring(0, 2));
                        endmin  = Convert.ToInt32(dataReader.GetString("Appointment_EndTime").Substring(3, 2));
                        endampm = dataReader.GetString("Appointment_EndTime").Substring(6, 2);
                        empname = dataReader.GetString("CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit)");
                        if (((checkhour == hour && checkmin >= min && string.Equals(ampm, checkampm, StringComparison.OrdinalIgnoreCase)) || (checkhour > hour && string.Equals(ampm, checkampm, StringComparison.OrdinalIgnoreCase))) && ((checkhour < endhour && (!string.Equals(endampm, checkampm, StringComparison.OrdinalIgnoreCase) || string.Equals(endampm, checkampm, StringComparison.OrdinalIgnoreCase))) || (checkhour == endhour && checkmin <= endmin && string.Equals(endampm, checkampm, StringComparison.OrdinalIgnoreCase))))
                        {
                            schedctr++;
                            BunifuFlatButton btnUpAppoint = new BunifuFlatButton();
                            btnUpAppoint.Size      = new Size(200, 50);
                            btnUpAppoint.Iconimage = null;
                            btnUpAppoint.Margin    = new Padding(0);
                            btnUpAppoint.Text      = empname;

                            btnUpAppoint.Click += delegate
                            {
                                smUC sm = new smUC();
                                user = label15.Text;
                                string newempname = btnUpAppoint.Text;
                                //sm.label15.Text = user;
                                int    x = 0, hour1 = 0, min1 = 0, endhour1 = 0, endmin1 = 0;
                                string ampm1 = "", endampm1 = "", empname1 = "";
                                string datenow = DateTime.Now.ToString("yyyy-MM-dd");
                                sm.dataGridView4.Rows.Clear();
                                sm.dataGridView4.ClearSelection();
                                try
                                {
                                    connection.Open();
                                    MySqlCommand    cmd1        = new MySqlCommand("Select *,CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit),CONCAT(Patient_LName,', ',Patient_FName,' ',Patient_MidInit) from appointmenttbl a, employee_appointmenttbl ea, employeetbl e, employee_patienttbl ep,patienttbl p,servicetbl s where Appointment_Date = '" + datenow + "' and CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit) = '" + newempname + "' and ea.Appointment_No = a.Appointment_No and ea.Employee_Patient_No = ep.Employee_Patient_No and ep.Employee_No = e.Employee_No and ep.Patient_No = p.Patient_No and a.Service_No = s.Service_No", connection);
                                    MySqlDataReader dataReader1 = cmd1.ExecuteReader();
                                    while (dataReader1.Read())
                                    {
                                        sm.dataGridView4.ClearSelection();
                                        hour1    = Convert.ToInt32(dataReader1.GetString("Appointment_StartTime").Substring(0, 2));
                                        min1     = Convert.ToInt32(dataReader1.GetString("Appointment_StartTime").Substring(3, 2));
                                        ampm1    = dataReader1.GetString("Appointment_StartTime").Substring(6, 2);
                                        endhour1 = Convert.ToInt32(dataReader1.GetString("Appointment_EndTime").Substring(0, 2));
                                        endmin1  = Convert.ToInt32(dataReader1.GetString("Appointment_EndTime").Substring(3, 2));
                                        endampm1 = dataReader1.GetString("Appointment_EndTime").Substring(6, 2);
                                        empname1 = dataReader1.GetString("CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit)");

                                        sm.dataGridView4.Rows.Add(dataReader1.GetInt32("Appointment_No"), dataReader1.GetString("CONCAT(Patient_LName,', ',Patient_FName,' ',Patient_MidInit)"), dataReader1.GetString("Service_Name"), dataReader1.GetString("Appointment_StartTime"), dataReader1.GetString("Appointment_EndTime"), dataReader1.GetString("Appointment_Status"));
                                        if (((checkhour == hour1 && checkmin >= min1 && string.Equals(ampm1, checkampm, StringComparison.OrdinalIgnoreCase)) || (checkhour > hour1 && string.Equals(ampm1, checkampm, StringComparison.OrdinalIgnoreCase))) && ((checkhour < endhour1 && (!string.Equals(endampm1, checkampm, StringComparison.OrdinalIgnoreCase) || string.Equals(endampm1, checkampm, StringComparison.OrdinalIgnoreCase))) || (checkhour == endhour1 && checkmin <= endmin1 && string.Equals(endampm1, checkampm, StringComparison.OrdinalIgnoreCase))))
                                        {
                                            checkappointmentno = dataReader1.GetInt32("Appointment_No");
                                            if (checkappointmentno == Convert.ToInt32(sm.dataGridView4.Rows[x].Cells[0].Value))
                                            {
                                                sm.dataGridView4.Rows[x].Cells[0].Style.BackColor = Color.Salmon;
                                            }
                                        }
                                        x++;
                                    }
                                    connection.Close();
                                }
                                catch (Exception me)
                                {
                                    connection.Close();
                                    MessageBox.Show(me.Message);
                                }
                                for (int row = 0; row < sm.dataGridView4.Rows.Count; row++)
                                {
                                    if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "Not Started")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.Bisque;
                                        DataGridViewTextBoxCell txtCell = new DataGridViewTextBoxCell();
                                        sm.dataGridView4.Rows[row].Cells[8]          = txtCell;
                                        sm.dataGridView4.Rows[row].Cells[8].ReadOnly = true;
                                    }
                                    else if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "On Going")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.DeepSkyBlue;
                                        DataGridViewTextBoxCell txtCell = new DataGridViewTextBoxCell();
                                        sm.dataGridView4.Rows[row].Cells[6]          = txtCell;
                                        sm.dataGridView4.Rows[row].Cells[6].ReadOnly = true;
                                    }
                                    else if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "Cancelled")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.LightCoral;
                                    }
                                    else if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "Done")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.MediumSeaGreen;
                                        DataGridViewTextBoxCell txtCell  = new DataGridViewTextBoxCell();
                                        DataGridViewTextBoxCell txtCell1 = new DataGridViewTextBoxCell();
                                        DataGridViewTextBoxCell txtCell2 = new DataGridViewTextBoxCell();
                                        sm.dataGridView4.Rows[row].Cells[6]          = txtCell;
                                        sm.dataGridView4.Rows[row].Cells[6].ReadOnly = true;
                                        sm.dataGridView4.Rows[row].Cells[7]          = txtCell1;
                                        sm.dataGridView4.Rows[row].Cells[7].ReadOnly = true;
                                        sm.dataGridView4.Rows[row].Cells[8]          = txtCell2;
                                        sm.dataGridView4.Rows[row].Cells[8].ReadOnly = true;
                                    }
                                }
                                sm.label53.Text = newempname;
                                sm.servicemonitoringPanel.Hide();
                                sm.consultantschedPanel.Hide();
                                sm.empButtons.Hide();
                                sm.schedulePanel.Show();
                                sm.Show();
                                this.Hide();
                            };

                            notificationPanel1.Controls.Add(btnUpAppoint);
                        }
                    }
                    connection.Close();
                }
                catch (Exception me)
                {
                    connection.Close();
                    MessageBox.Show(me.Message);
                }
            }

            if (doneAppoint)
            {
                Label lbl1 = new Label();
                lbl1.Text   = "Employee(s) with done appointment";
                lbl1.Font   = new Font("Arial", 8);
                lbl1.Size   = new Size(200, 15);
                lbl1.Margin = new Padding(3, 3, 3, 3);
                notificationPanel1.Controls.Add(lbl1);
                try
                {
                    connection.Open();
                    MySqlCommand    cmd        = new MySqlCommand("SELECT *,CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit) from appointmenttbl a, employee_appointmenttbl ea, employee_patienttbl ep, employeetbl e where Appointment_Date = '" + date + "' and a.Appointment_Status = 'Not Started' and a.Appointment_No = ea.Appointment_No and ea.Employee_Patient_No = ep.Employee_Patient_No and ep.Employee_No = e.Employee_No group by e.Employee_No", connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        hour    = Convert.ToInt32(dataReader.GetString("Appointment_StartTime").Substring(0, 2));
                        min     = Convert.ToInt32(dataReader.GetString("Appointment_StartTime").Substring(3, 2));
                        ampm    = dataReader.GetString("Appointment_StartTime").Substring(6, 2);
                        endhour = Convert.ToInt32(dataReader.GetString("Appointment_EndTime").Substring(0, 2));
                        endmin  = Convert.ToInt32(dataReader.GetString("Appointment_EndTime").Substring(3, 2));
                        endampm = dataReader.GetString("Appointment_EndTime").Substring(6, 2);
                        empname = dataReader.GetString("CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit)");

                        if ((checkhour == endhour && checkmin >= endmin && string.Equals(endampm, checkampm, StringComparison.OrdinalIgnoreCase)) || (checkhour > endhour && string.Equals(endampm, checkampm, StringComparison.OrdinalIgnoreCase)))
                        {
                            donectr++;
                            empname                  = dataReader.GetString("CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit)");
                            btnDoneAppoint           = new BunifuFlatButton();
                            btnDoneAppoint.Size      = new Size(200, 50);
                            btnDoneAppoint.Iconimage = null;
                            btnDoneAppoint.Margin    = new Padding(0);
                            btnDoneAppoint.Text      = empname;
                            btnDoneAppoint.Click    += delegate
                            {
                                smUC sm = new smUC();
                                user = label15.Text;
                                string newempname = btnDoneAppoint.Text;
                                //sm.label15.Text = user;
                                int    x = 0, hour1 = 0, min1 = 0, endhour1 = 0, endmin1 = 0;
                                string ampm1 = "", endampm1 = "", empname1 = "";
                                string datenow = DateTime.Now.ToString("yyyy-MM-dd");
                                try
                                {
                                    connection.Open();
                                    MySqlCommand    cmd2        = new MySqlCommand("Select *,CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit),CONCAT(Patient_LName,', ',Patient_FName,' ',Patient_MidInit) from appointmenttbl a, employee_appointmenttbl ea, employeetbl e, employee_patienttbl ep,patienttbl p,servicetbl s where Appointment_Date = '" + datenow + "' and CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit) = '" + newempname + "' and ea.Appointment_No = a.Appointment_No and ea.Employee_Patient_No = ep.Employee_Patient_No and ep.Employee_No = e.Employee_No and ep.Patient_No = p.Patient_No and a.Service_No = s.Service_No", connection);
                                    MySqlDataReader dataReader2 = cmd2.ExecuteReader();
                                    while (dataReader2.Read())
                                    {
                                        sm.dataGridView4.ClearSelection();
                                        hour1    = Convert.ToInt32(dataReader2.GetString("Appointment_StartTime").Substring(0, 2));
                                        min1     = Convert.ToInt32(dataReader2.GetString("Appointment_StartTime").Substring(3, 2));
                                        ampm1    = dataReader2.GetString("Appointment_StartTime").Substring(6, 2);
                                        endhour1 = Convert.ToInt32(dataReader2.GetString("Appointment_EndTime").Substring(0, 2));
                                        endmin1  = Convert.ToInt32(dataReader2.GetString("Appointment_EndTime").Substring(3, 2));
                                        endampm1 = dataReader2.GetString("Appointment_EndTime").Substring(6, 2);
                                        empname1 = dataReader2.GetString("CONCAT(Employee_LName,', ',Employee_FName,' ',Employee_MidInit)");

                                        sm.dataGridView4.Rows.Add(dataReader2.GetInt32("Appointment_No"), dataReader2.GetString("CONCAT(Patient_LName,', ',Patient_FName,' ',Patient_MidInit)"), dataReader2.GetString("Service_Name"), dataReader2.GetString("Appointment_StartTime"), dataReader2.GetString("Appointment_EndTime"), dataReader2.GetString("Appointment_Status"));
                                        if ((checkhour == endhour1 && checkmin >= endmin1 && string.Equals(endampm1, checkampm, StringComparison.OrdinalIgnoreCase)) || (checkhour > endhour1 && string.Equals(endampm1, checkampm, StringComparison.OrdinalIgnoreCase)))
                                        {
                                            checkappointmentno = dataReader2.GetInt32("Appointment_No");
                                            if (checkappointmentno == Convert.ToInt32(sm.dataGridView4.Rows[x].Cells[0].Value))
                                            {
                                                sm.dataGridView4.Rows[x].Cells[0].Style.BackColor = Color.Salmon;
                                            }
                                        }
                                        x++;
                                    }
                                    connection.Close();
                                }
                                catch (Exception me)
                                {
                                    connection.Close();
                                    MessageBox.Show(me.Message);
                                }
                                for (int row = 0; row < sm.dataGridView4.Rows.Count; row++)
                                {
                                    if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "Not Started")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.Bisque;
                                    }
                                    else if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "On Going")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.DeepSkyBlue;
                                    }
                                    else if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "Cancelled")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.LightCoral;
                                    }
                                    else if (sm.dataGridView4.Rows[row].Cells[5].Value.ToString() == "Done")
                                    {
                                        sm.dataGridView4.Rows[row].Cells[5].Style.BackColor = Color.MediumSeaGreen;
                                    }
                                }
                                sm.label53.Text = newempname;
                                sm.servicemonitoringPanel.Hide();
                                sm.consultantschedPanel.Hide();
                                sm.empButtons.Hide();
                                sm.schedulePanel.Show();
                                sm.Show();
                                this.Hide();
                            };
                            notificationPanel1.Controls.Add(btnDoneAppoint);
                        }
                    }
                    connection.Close();
                }
                catch (Exception me)
                {
                    connection.Close();
                    MessageBox.Show(me.Message);
                }
            }
            try
            {
                connection.Open();
                MySqlCommand    cmd3        = new MySqlCommand("SELECT Billing_No,Billing_Date,Total_Bill,Balance,CONCAT(Patient_LName,', ',Patient_FName,' ',Patient_MidInit),b.Patient_No from billingtbl b, patienttbl p where p.Patient_No = b.Patient_No and b.Balance > 0 and Billing_No in (SELECT MAX(Billing_No) from billingtbl group by Patient_No)", connection);
                MySqlDataReader dataReader3 = cmd3.ExecuteReader();
                while (dataReader3.Read())
                {
                    balancectr++;
                    checks = true;
                }
                connection.Close();

                connection.Open();
                string          query2      = ("Select Total_Quantity, Critical_Level from product_inventorytbl pi, product_prodtypetbl ppt where ppt.Product_ProdType_No = pi.Product_ProdType_No");
                MySqlCommand    cmd4        = new MySqlCommand(query2, connection);
                MySqlDataReader dataReader4 = cmd4.ExecuteReader();
                while (dataReader4.Read())
                {
                    qty  = dataReader4.GetInt32("Total_Quantity");
                    crit = dataReader4.GetInt32("Critical_Level");
                    if (qty <= crit)
                    {
                        critlvlctr++;
                        checking = true;
                    }
                    j++;
                }
                connection.Close();


                if (checks)
                {
                    btnBalance           = new BunifuFlatButton();
                    btnBalance.Size      = new Size(200, 50);
                    btnBalance.Iconimage = null;
                    btnBalance.Margin    = new Padding(0);
                    btnBalance.Text      = "(" + balancectr + ")" + "  There's a patient with balance";
                    btnBalance.Click    += delegate
                    {
                        user = label15.Text;
                        paymentUC pay = new paymentUC();
                        pay.panel2.BringToFront();
                        pay.panel8.SendToBack();
                        pay.panel3.SendToBack();
                        //pay.label15.Text = user;
                        pay.Show();
                        this.Hide();
                    };
                    notificationPanel1.Controls.Add(btnBalance);
                }

                if (checking)
                {
                    btnCritLvl           = new BunifuFlatButton();
                    btnCritLvl.Size      = new Size(200, 50);
                    btnCritLvl.Iconimage = null;
                    btnCritLvl.Margin    = new Padding(0);
                    btnCritLvl.Text      = "(" + critlvlctr + ")" + "  There's a f*****g shit in the inventory";
                    btnCritLvl.Click    += delegate
                    {
                        user = label15.Text;
                        allinventoryUC i = new allinventoryUC();
                        i.inventoryUC1.BringToFront();
                        i.orderUC1.SendToBack();
                        i.pullOutProductsUC1.SendToBack();
                        i.adddInventoryUC1.SendToBack();
                        //i.label15.Text = user;
                        i.Show();
                        this.Hide();
                    };
                    notificationPanel1.Controls.Add(btnCritLvl);
                }
                totalctr = schedctr + critlvlctr + balancectr + donectr;
                if (totalctr != 0)
                {
                    label1.Visible = true;
                }
                else
                {
                    label1.Visible = false;
                }
                label1.Text = totalctr.ToString();
            }
            catch (Exception me)
            {
                connection.Close();
                MessageBox.Show(me.Message);
            }
        }
예제 #10
0
        private void LoadAssignedPatient()
        {
            MySqlConnection con = new MySqlConnection();

            con.ConnectionString = login.DBconnection;
            string loadInf = "select pID,patientName from patient_assign where status = 'Assigned' and doctorAssigned = '" + login.uname + "'";

            MySqlCommand    com = new MySqlCommand(loadInf, con);
            MySqlDataReader rd;

            DataTable tab = new DataTable();

            try
            {
                int j = 0;
                con.Open();
                //counting the menu in the table
                rd = com.ExecuteReader();
                tab.Load(rd);
                rd.Close();
                if (tab.Rows.Count > 0)
                {
                    bt = new BunifuFlatButton[tab.Rows.Count];

                    for (int i = 0; i < tab.Rows.Count; i++)
                    {
                        //Button

                        bt[j]              = new BunifuFlatButton();
                        bt[j].Text         = tab.Rows[i][1].ToString();
                        bt[j].Name         = tab.Rows[i][0].ToString();
                        bt[j].Height       = 41;
                        bt[j].Width        = 351;
                        bt[j].Normalcolor  = Color.FromArgb(0, 122, 204);
                        bt[j].OnHovercolor = Color.FromArgb(134, 49, 199);
                        bt[j].Activecolor  = Color.DarkGreen;
                        bt[j].Iconimage    = null;
                        bt[j].TextAlign    = ContentAlignment.MiddleCenter;
                        bt[j].Textcolor    = Color.White;
                        bt[j].BorderRadius = 5;
                        bt[j].Click       += new EventHandler(LoadPatientInfo);

                        string       update = "update patient_assign set status = 'ToDoctor' where pID = '" + tab.Rows[i][0].ToString() + "'";
                        MySqlCommand Update = new MySqlCommand(update, con);
                        rd = Update.ExecuteReader();
                        rd.Close();


                        //adding button to the panel
                        flowLayoutPanel1.Controls.Add(bt[j]);

                        j++;
                    }
                }
                rd.Close();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
        }
예제 #11
0
 public void ResetButton(BunifuFlatButton button)
 {
     button.Normalcolor = System.Drawing.Color.Black;
     MainMap.CursorMode = MapWinGIS.tkCursorMode.cmZoomIn;
     count = 0;
 }