using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Globalization;


namespace check
{
    public partial class remider : Form
    {
        static SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\check.mdf;Integrated Security=True");
        PersianCalendar pc = new PersianCalendar();

        public remider()
        {
            InitializeComponent();
        }

        private void show()
        {
            DataTable dt1 = new DataTable();
            DataBase db1 = new DataBase();
            dt1 = db1.MySelect("select * from ckeck where ckeckstatus='در جریان'");
            dgv_ckeck_remider.DataSource = dt1;
        }


        private void count()
        {
            SqlCommand com = new SqlCommand("select count (*) from ckeck where ckeckstatus='در جریان'", con);
            con.Open();
            lbl_jaryan.Text = Convert.ToString((int)com.ExecuteScalar()) + "";
            con.Close();
            //--------------------------------------------------------------------------------------------
            SqlCommand com2 = new SqlCommand("select count (*) from ckeck where typeckeck='پرداختی'", con);
            con.Open();
            lbl_pardakhti.Text = Convert.ToString((int)com2.ExecuteScalar()) + "";
            con.Close();
            //--------------------------------------------------------------------------------------------
            SqlCommand com3 = new SqlCommand("select count (*) from ckeck where typeckeck='دریافتی'", con);
            con.Open();
            lbl_daryafti.Text = Convert.ToString((int)com3.ExecuteScalar()) + "";
            con.Close();
            //--------------------------------------------------------------------------------------------
        }


        private void days()
        {
            try
            {
                lbl_days.Text = pc.GetDayOfMonth(DateTime.Now).ToString();
                switch (DateTime.Now.DayOfWeek)
                {
                    case DayOfWeek.Saturday:
                        lbl_days.Text = "شنبه";
                        break;
                    case DayOfWeek.Sunday:
                        lbl_days.Text = "بکشنبه";
                        break;
                    case DayOfWeek.Monday:
                        lbl_days.Text = "دوشنبه";
                        break;
                    case DayOfWeek.Tuesday:
                        lbl_days.Text = "سه شنبه";
                        break;
                    case DayOfWeek.Wednesday:
                        lbl_days.Text = "چهارشنبه";
                        break;
                    case DayOfWeek.Thursday:
                        lbl_days.Text = "پنج شنبه";
                        break;
                    case DayOfWeek.Friday:
                        lbl_days.Text = "جمعه";
                        break;
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message,"خطا");
 
            }

        }

        private void remider_Load(object sender, EventArgs e)
        {
            count();
            days();
            show();
            string year, month, day;
            year = pc.GetYear(DateTime.Now).ToString();
            month = pc.GetMonth(DateTime.Now).ToString();
            day = pc.GetDayOfMonth(DateTime.Now).ToString();

            lbl_dates.Text = year + "/" + month + "/" + day.ToString();
        }

    }
}
