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;

namespace video_club
{
    public partial class frmdaramad : Form
    {
        public frmdaramad()
        {
            InitializeComponent();
        }



        private void btnmohasebe_Click(object sender, EventArgs e)
        {
            if (date2.Text == "" || date1.Text == "")
            {
                MessageBox.Show("لطفا برای محاسبه هر دو تا تاریخ را انتخاب کنید", "!!!اخطار", MessageBoxButtons.OK);

            }
            else
            {
                DateTime d1 = Convert.ToDateTime(myfunction.convertDate(date1.Text, myfunction.dataConvertMode.toGregorian));
                DateTime d2 = Convert.ToDateTime(myfunction.convertDate(date2.Text, myfunction.dataConvertMode.toGregorian));
                this.tblkeraye1TableAdapter.Fillbydae(dataSet1.tblkeraye1, d1, d2);
               
                float a = 0;

                for (int j = 0; j < dataGridViewX1.RowCount; j++)
                {
                 //  if(dataGridViewX1.Rows[i].Cells[9].Value.ToString()==""
                    try
                    {
                        
                        a += float.Parse(dataGridViewX1.Rows[j].Cells[9].Value.ToString());
                    }
                    catch
                    {
                      //  a += float.Parse(dataGridViewX1.Rows[i].Cells[9].Value.ToString());

                    }
                }
                lblmablagh.Text = Convert.ToString(a);
             lbljamkil.Text=myfunction.numtostr(lblmablagh.Text);
             
            }
        }

        private void lbl2_Click(object sender, EventArgs e)
        {

        }

        private void lblriyal_Click(object sender, EventArgs e)
        {
           
        }

        private void frmdaramad_Load(object sender, EventArgs e)
        {

        }

        private void lblmablagh_MouseMove(object sender, MouseEventArgs e)
        {
          
        }




        public int i { get; set; }

        private void btnprint_Click(object sender, EventArgs e)
        {
            frmrepoetdaramad f = new frmrepoetdaramad();
            f.crdaramad1.SetDataSource(dataSet1);
            this.Close();
            f.Show();
            
        }
    }
}
