private void CreatChart(Person person)
 {
     if (Combo_Project.SelectedIndex == -1)
     {
         chart1.Series.Clear();
         int i = 0;
         List<Salary> Lists = person.Salaries.ToList();
         foreach (Salary item in Lists)
         {
             Series series = this.chart1.Series.Add
                 (++i + " _ " + " از " + utility.ConvertDate_M_To_Sh(item.DateStart) + " تا " +
                  utility.ConvertDate_M_To_Sh(item.DateFinish));
             series.Font = new Font("B Nazanin", 10.2F, System.Drawing.FontStyle.Bold,
                 System.Drawing.GraphicsUnit.Point, ((byte)(178)));
             series.IsValueShownAsLabel = true;
             series.Points.Add(Convert.ToDouble(item.Cost));
         }
     }
     else
     {
         chart1.Series.Clear();
         int i = 0;
         List<Salary> Lists = person.Salaries.Where(p => p.ProjectId == Convert.ToInt32(Combo_Project.SelectedValue)).ToList();
         foreach (Salary item in Lists)
         {
             var series = this.chart1.Series.Add
                 (++i + " _ " + " از " + utility.ConvertDate_M_To_Sh(item.DateStart) + " تا " +
                  utility.ConvertDate_M_To_Sh(item.DateFinish));
             series.Font = new Font("B Nazanin", 10.2F, System.Drawing.FontStyle.Bold,
                 System.Drawing.GraphicsUnit.Point, ((byte)(178)));
             series.IsValueShownAsLabel = true;
             series.Points.Add(Convert.ToDouble(item.Cost));
         }
     }
 }
 public Form_PayToPeople2(Person P)
 {
     person = P;
     InitializeComponent();
 }
 private void ComboPerson_SelectedValueChanged(object sender, EventArgs e)
 {
     if (ComboPerson.SelectedIndex != -1)
     {
         person = null;
         person = Listpeople.Single(p => p.EmployeeID == Convert.ToInt32(ComboPerson.SelectedValue));
         if (person != null)
         {
             Txt_Name.Text = person.EmployeeFullName;
             Txt_Phone.Text = person.CellPhone;
             var list = person.Payments.ToList();
             Txt_TotalPay.Text = utility.ConvertPrice(list.Sum(p => p.Cost).ToString());
         }
     }
 }
 private void Register()
 {
     Person P = new Person()
     {
         EmployeeNationalCode = Txt_NationalCode.Text.Trim(),
         FatherName = Txt_FatherName.Text.Trim(),
         EmployeeFullName = Txt_FName.Text.Trim(),
         PhoneNumber = Txt_Phone.Text.Trim(),
         EmployeeBirth = Txt_Date.GeoDate.Value,
         CellPhone = Txt_Cell.Text.Trim(),
         Adress = Txt_Address.Text.Trim(),
         IdentityNumber = Txt_Shenasname.Text.Trim(),
     };
     if (Combo_StatusMarried.SelectedIndex == 0) P.EmployeeMaried = false;
     else { P.EmployeeMaried = true; P.NumberOfChildren = Txt_NumChild.Text.Trim(); }
     db.Persons.Add(P);
     db.SaveChanges();
     utility.Show_Message("اطلاعات این شخص با موفقیت ذخیره شد ", "پیغام");
 }
 private void SetDatainSalaryInfo(int p)
 {
     Person s = ListPerson.Single(a => a.EmployeeID == p);
     per = s;
     Txt_Name.Text = s.EmployeeFullName;
     Txt_NationalCode.Text = s.EmployeeNationalCode;
     Txt_Father.Text = s.FatherName;
     Txt_CellPhone.Text = s.CellPhone;
 }
 private void Reg()
 {
     Salary S = new Salary()
     {
         Cost = utility.ConvertCommaPrice(Txt_Cost.Text.Trim()),
         Description = Txt_Description.Text.Trim(),
         DateStart = Txt_DateStart.GeoDate.Value,
         DateFinish = Txt_DateFinish.GeoDate.Value,
         Date = Date.GeoDate.Value,
         Person = per
     };
     if (Combo_P.SelectedIndex != -1)
     {
         S.Project = ListProject.Single(p => p.ProjectID == Convert.ToInt32(Combo_P.SelectedValue));
     }
     ListSalary.Add(S);
     Grid_ListSalary.Rows.Add(++i, per.EmployeeFullName, per.EmployeeNationalCode, utility.ConvertPrice(S.Cost), per.EmployeeID, S.Id);
     per = null;
     ClearSalaryInfo();
     Txt_Fname.Focus();
 }