public void getturn() { if (i >= todayturn.Count || i < 0) { MessageBox.Show("invalid turn."); return; } x = todayturn[i]; if (x == null) { MessageBox.Show("wrong date"); } else { txtname.Text = x.name; txtfamilyname.Text = x.familyname; txtphone.Text = x.phone; txtdoctor.Text = x.doctorname; txtfilecode.Text = x.fileid; txtturn.Text = Convert.ToString(x.shomarenobat); employes newemp = new employes(x.doctorname, "doctor"); double money = Convert.ToDouble(returncost(x.work)) + Convert.ToDouble(readandwriteemp.getspecialsalary(newemp)); txtpayment.Text = money.ToString(); } }
public managenobat(nobatdehi newnobat) { s.newnobat = newnobat; this.timenoabt = s.getallnobat(newnobat); this.newlist = read.getallnobatbasespeficaation(); this.newnobat = newnobat; }
public void writeinfile(nobatdehi nobat, List <DateTime> gets) { timenoabt = gets; newnobat = nobat; string save = nobatdehi.nobatdehiToString(newnobat); System.IO.File.AppendAllText(path, save); }
public static nobatdehi StringTonobatdehi(string nobat) { string[] personinform = nobat.Split('*'); string[] daten = personinform[0].Split('/'); string[] datm = personinform[1].Split(':'); DateTime x = new DateTime(Convert.ToInt32(daten[0]), Convert.ToInt32(daten[1]), Convert.ToInt32(daten[2]), Convert.ToInt32(datm[0]), Convert.ToInt32(datm[1]), 0); nobatdehi nobats = new nobatdehi(personinform[4], personinform[5], personinform[6], personinform[3], personinform[7], x, personinform[6], personinform[11], Convert.ToBoolean(personinform[9]), Convert.ToBoolean(personinform[10])); return(nobats); }
private void button1_Click(object sender, EventArgs e) { nobatdehi temp = new nobatdehi(); temp.doctorname = txtdoctorname.Text; managenobat manage = new managenobat(temp); txtfrom.Text = manage.getfreetime(dateTimePicker1.Value).TimeOfDay.ToString(); DateTime xs = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, 20, 0, 0); txtto.Text = xs.TimeOfDay.ToString(); }
private void button1_Click(object sender, EventArgs e) { /* Boolean x= deleteturn.deleteturnfun(dateturn.Value, txtfileid.Text);*/ nobatdehi delno = new nobatdehi(); delno.date = dateturn.Value; managenobat manage = new managenobat(delno); Boolean x = manage.deletenobat(dateturn.Value, txtfileid.Text); if (x == true) { txtresult.Text = "succsesful"; } else { txtresult.Text = "faild"; } }
public List <DateTime> getallnobat(nobatdehi nobat)//getallnobats { //string[] nobats = System.IO.File.ReadAllLines(path); //string[] nob; //newnobat = nobat; //if (!System.IO.File.Exists(path)) //{ // return timenoabt; //} ////set(); //foreach (string x in nobats) //{ // nob = x.Split('*'); // string[] stime = nob[0].Split('/'); // string[] ttime = nob[1].Split(':'); // day = new DateTime(Convert.ToInt32(stime[0]), Convert.ToInt32(stime[1]), Convert.ToInt32(stime[2]), Convert.ToInt32(ttime[0]), Convert.ToInt32(ttime[1]), 0); // if (Convert.ToInt32(stime[0]) == newnobat.date.Year && Convert.ToInt32(stime[1]) == newnobat.date.Month && Convert.ToInt32(stime[2]) == newnobat.date.Day && day.DayOfWeek != DayOfWeek.Friday && nob[11] == newnobat.doctorname) // { // timenoabt.Add(new DateTime(Convert.ToInt32(stime[0]), Convert.ToInt32(stime[1]), Convert.ToInt32(stime[2]), Convert.ToInt32(ttime[0]), Convert.ToInt32(ttime[1]), 0)); // } //} //return timenoabt; getandsetalldate(); getallnobatbasespeficaation(); newnobat = nobat; for (int i = 0; i < timenoabt.Count; i++) { if (timenoabt[i].Year == newnobat.date.Year && timenoabt[i].Month == newnobat.date.Month && timenoabt[i].Day == newnobat.date.Day && timenoabt[i].DayOfWeek != DayOfWeek.Friday && newlist[i].doctorname == newnobat.doctorname) { timenoabt2.Add(timenoabt[i]); } } return(timenoabt2); }
public void writedeletednobatinfile(nobatdehi deleted) { string save = nobatdehi.nobatdehiToString(deleted); System.IO.File.AppendAllText(deletepath, save); }
public readandwrite(nobatdehi nobat) { newnobat = nobat; }
public static string nobatdehiToString(nobatdehi nobat) { return(nobat.date.Year + "/" + nobat.date.Month + "/" + nobat.date.Day + "/" + '*' + nobat.date.TimeOfDay.ToString() + '*' + nobat.minute + '*' + nobat.work + '*' + nobat.name + '*' + nobat.familyname + '*' + nobat.idnumber + '*' + nobat.phone + '*' + nobat.shomarenobat + '*' + nobat.noteven + '*' + nobat.notodd + '*' + nobat.doctorname + '\n'); }
private void btnratings_Click(object sender, EventArgs e) { if (!chkrestrictions.Checked) { chkodd.Checked = false; chkeven.Checked = false; } DateTime date = ratetime.Value; nobatdehi x; string work = ""; string doctorname = ""; if (chkeven.Checked == true) { if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Monday || date.DayOfWeek == DayOfWeek.Wednesday) { MessageBox.Show("please inter true date,this date is " + date.DayOfWeek + " and isnt odd"); return; } } else if (chkodd.Checked == true) { if (date.DayOfWeek == DayOfWeek.Sunday || date.DayOfWeek == DayOfWeek.Tuesday || date.DayOfWeek == DayOfWeek.Thursday) { MessageBox.Show("please inter true date,this date is " + date.DayOfWeek + " and isnt even"); return; } } if (date.DayOfWeek == DayOfWeek.Friday) { MessageBox.Show("its closed in fridays"); return; } if (rbExamination.Checked == true) { work = "moayene"; doctorname = cbexam.SelectedItem.ToString(); } else if (rb1serface.Checked == true) { work = "tarmim1"; doctorname = cbsu1.SelectedItem.ToString(); } else if (rbsurface2.Checked == true) { work = "tarmim2"; doctorname = cbsu2.SelectedItem.ToString(); } else if (rbroot.Checked == true) { work = "darmanreshe"; doctorname = cbroot.SelectedItem.ToString(); } if (chkhaveid.Checked == true) { x = new nobatdehi(date, txtfilecode.Text, work, doctorname, chkeven.Checked, chkodd.Checked); } else { path = Application.StartupPath; string name = txtname.Text; string familyname = txtfamily.Text; string phone = txtphone.Text; string id = txtfilecode.Text; x = new nobatdehi(name, familyname, id, work, phone, date, txtfilecode.Text, doctorname, chkeven.Checked, chkodd.Checked); } //DateTime s = x.readandgetnobat(path); managenobat manage = new managenobat(x); DateTime s = manage.getnobat(); //DateTime s = if (s == new DateTime(1, 1, 1, 1, 1, 1)) { DialogResult res = MessageBox.Show("not have turn in this day do you want to set after this day", "settime", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (res == DialogResult.Yes) { //s = x.another(); s = manage.another(); txtresult.Text = s.AddMinutes(+(double)x.minute).ToString(); txtfrom.Text = s.ToString() + " " + s.DayOfWeek; } } else { txtresult.Text = s.AddMinutes(+(double)x.minute).ToString(); txtfrom.Text = s.ToString() + " " + s.DayOfWeek; } }