private void txtm1_TextChanged(object sender, EventArgs e) { if (txttype.Text == "انتظام") { int val1, val2, val3, val4, val5; Int32.TryParse(combosubject.SelectedValue.ToString(), out val1); Int32.TryParse(combodept.SelectedValue.ToString(), out val2); Int32.TryParse(combolevel.SelectedValue.ToString(), out val3); Int32.TryParse(combosem.SelectedValue.ToString(), out val4); Int32.TryParse(cmbstd.SelectedValue.ToString(), out val5); txtm3.Text = (abs.get_sub_abs_deg(val2, val3, val4, val1, val5).ToString()); } else if (txttype.Text == "انتساب") { int ss = s.get_sub_t(Convert.ToInt32(combosubject.SelectedValue)); float subb = ss * 75 / 100; txtm3.Text = subb.ToString(); } }
private void btnadd_Click(object sender, EventArgs e) { if (frmType == "Add") { if (cmbstd.Text == string.Empty || combodept.Text == string.Empty || combolevel.Text == string.Empty || combosem.Text == string.Empty || combosubject.Text == string.Empty || txtlec.Text == string.Empty) { MessageBox.Show("رجاءا ادخل جميع البيانات ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataTable dt = new DataTable(); dt = abs.VerifiedAbsSTDId(int.Parse(combodept.SelectedValue.ToString()), int.Parse(combolevel.SelectedValue.ToString()), int.Parse(cmbstd.SelectedValue.ToString()), int.Parse(combosubject.SelectedValue.ToString()), int.Parse(combosem.SelectedValue.ToString())); if (dt.Rows.Count > 0) { MessageBox.Show("هذه الماده مضاف درجاتها مسبقاً", "تنبيه"); } else { float Total; Total = Convert.ToInt32(txtlec.Text.ToString()); //int sub_t = Convert.ToInt32(txtt.Text.ToString()); Math.Round(Total); int totalLecAttend; totalLecAttend = int.Parse(numlec1.Value.ToString()) + int.Parse(numlec2.Value.ToString()) + int.Parse(numlec3.Value.ToString()) + int.Parse(numlec4.Value.ToString()) + int.Parse(numlec5.Value.ToString()) + int.Parse(numlec6.Value.ToString()) + int.Parse(numlec7.Value.ToString()) + int.Parse(numlec8.Value.ToString()) + int.Parse(numlec9.Value.ToString()) + int.Parse(numlec10.Value.ToString()) + int.Parse(numlec11.Value.ToString()) + int.Parse(numlec12.Value.ToString()); // Math.Round(totalLecAttend); float totalAttenDeg; totalAttenDeg = ((totalLecAttend / Total) * 100); // Math.Round(totalAttenDeg); float totalLecAbs; totalLecAbs = (Total - totalLecAttend); Math.Round(totalLecAbs); float totalAbsDeg; totalAbsDeg = ((totalLecAbs / Total) * 100); // Math.Round(totalAbsDeg); int ss = s.get_sub_t(Convert.ToInt32(combosubject.SelectedValue)); float SubDeg; SubDeg = (totalLecAttend / Total) * ss; Math.Round(SubDeg); abs.add_absance(Convert.ToInt32(Total), Convert.ToInt32(totalLecAttend), totalAttenDeg, Convert.ToInt32(totalLecAbs), totalAbsDeg, SubDeg, Convert.ToInt32(cmbstd.SelectedValue), Convert.ToInt32(combosubject.SelectedValue), Convert.ToInt32(combodept.SelectedValue), Convert.ToInt32(combolevel.SelectedValue), Convert.ToInt32(combosem.SelectedValue), int.Parse(numlec1.Value.ToString()), int.Parse(numlec2.Value.ToString()), int.Parse(numlec3.Value.ToString()), int.Parse(numlec4.Value.ToString()), int.Parse(numlec5.Value.ToString()), int.Parse(numlec6.Value.ToString()), int.Parse(numlec7.Value.ToString()), int.Parse(numlec8.Value.ToString()), int.Parse(numlec9.Value.ToString()), int.Parse(numlec10.Value.ToString()), int.Parse(numlec11.Value.ToString()), int.Parse(numlec12.Value.ToString()), cmbyeare.Text); MessageBox.Show("تم اضافة غياب المادة بنجاح ", "اضافة غياب مادة", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { //this.cmbstd.SelectedValue = StdName; //this.combosem.SelectedValue = Sem; //this.combosubject.SelectedValue = Sub; if (/*cmbstd.Text == string.Empty ||*/ combodept.Text == string.Empty || combolevel.Text == string.Empty || /* combosem.Text == string.Empty || combosubject.Text == string.Empty ||*/ txtlec.Text == string.Empty) { MessageBox.Show("رجاءا ادخل جميع البيانات ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { float Total; Total = Convert.ToInt32(txtlec.Text.ToString()); Math.Round(Total); float totalLecAttend; totalLecAttend = int.Parse(numlec1.Value.ToString()) + int.Parse(numlec2.Value.ToString()) + int.Parse(numlec3.Value.ToString()) + int.Parse(numlec4.Value.ToString()) + int.Parse(numlec5.Value.ToString()) + int.Parse(numlec6.Value.ToString()) + int.Parse(numlec7.Value.ToString()) + int.Parse(numlec8.Value.ToString()) + int.Parse(numlec9.Value.ToString()) + int.Parse(numlec10.Value.ToString()) + int.Parse(numlec11.Value.ToString()) + int.Parse(numlec12.Value.ToString()); Math.Round(totalLecAttend); float totalAttenDeg; totalAttenDeg = ((totalLecAttend / Total) * 100); Math.Round(totalAttenDeg); float totalLecAbs; totalLecAbs = (Total - totalLecAttend); Math.Round(totalLecAbs); float totalAbsDeg; totalAbsDeg = ((totalLecAbs / Total) * 100); Math.Round(totalAbsDeg); int ss = s.get_sub_t(Convert.ToInt32(combosubject.SelectedValue)); float SubDeg; SubDeg = (totalLecAttend / Total) * ss; Math.Round(SubDeg); abs.UpdateAbsance(ID, Convert.ToInt32(Total), Convert.ToInt32(totalLecAttend), totalAttenDeg, Convert.ToInt32(totalLecAbs), totalAbsDeg, SubDeg, IdName, IdSub, Convert.ToInt32(combodept.SelectedValue), Convert.ToInt32(combolevel.SelectedValue), IdSem, int.Parse(numlec1.Value.ToString()), int.Parse(numlec2.Value.ToString()), int.Parse(numlec3.Value.ToString()), int.Parse(numlec4.Value.ToString()), int.Parse(numlec5.Value.ToString()), int.Parse(numlec6.Value.ToString()), int.Parse(numlec7.Value.ToString()), int.Parse(numlec8.Value.ToString()), int.Parse(numlec9.Value.ToString()), int.Parse(numlec10.Value.ToString()), int.Parse(numlec11.Value.ToString()), int.Parse(numlec12.Value.ToString()), cmbyeare.Text); MessageBox.Show("تم تعديل الغياب بنجاح ", "تعديل غياب مادة", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } }
private void btnadd_Click(object sender, EventArgs e) { if (txtDept.Text == string.Empty || txtLev.Text == string.Empty || txtSem.Text == string.Empty || txtSub.Text == string.Empty || txtStd.Text == string.Empty || txtlec.Text == string.Empty) { MessageBox.Show("رجاءا ادخل جميع البيانات ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { float Total; Total = Convert.ToInt32(txtlec.Text.ToString()); Math.Ceiling(Total); float totalLecAttend; totalLecAttend = int.Parse(numlec1.Value.ToString()) + int.Parse(numlec2.Value.ToString()) + int.Parse(numlec3.Value.ToString()) + int.Parse(numlec4.Value.ToString()) + int.Parse(numlec5.Value.ToString()) + int.Parse(numlec6.Value.ToString()) + int.Parse(numlec7.Value.ToString()) + int.Parse(numlec8.Value.ToString()) + int.Parse(numlec9.Value.ToString()) + int.Parse(numlec10.Value.ToString()) + int.Parse(numlec11.Value.ToString()) + int.Parse(numlec12.Value.ToString()); Math.Ceiling(totalLecAttend); float totalAttenDeg; totalAttenDeg = ((totalLecAttend / Total) * 100); Math.Ceiling(totalAttenDeg); float totalLecAbs; totalLecAbs = (Total - totalLecAttend); Math.Ceiling(totalLecAbs); float totalAbsDeg; totalAbsDeg = ((totalLecAbs / Total) * 100); Math.Ceiling(totalAbsDeg); int ss = s.get_sub_t(this.IdSub); float SubDeg; SubDeg = (totalLecAttend / Total) * ss; Math.Ceiling(SubDeg); abs.UpdateAbsance(ID, Convert.ToInt32(txtlec.Text.ToString()), Convert.ToInt32(totalLecAttend), totalAttenDeg, Convert.ToInt32(totalLecAbs), totalAbsDeg, SubDeg, IdName, IdSub, IdDept, IdLev, IdSem, int.Parse(numlec1.Value.ToString()), int.Parse(numlec2.Value.ToString()), int.Parse(numlec3.Value.ToString()), int.Parse(numlec4.Value.ToString()), int.Parse(numlec5.Value.ToString()), int.Parse(numlec6.Value.ToString()), int.Parse(numlec7.Value.ToString()), int.Parse(numlec8.Value.ToString()), int.Parse(numlec9.Value.ToString()), int.Parse(numlec10.Value.ToString()), int.Parse(numlec11.Value.ToString()), int.Parse(numlec12.Value.ToString()) , cmbyeare.Text); MessageBox.Show("تم تعديل الغياب بنجاح ", "تعديل غياب مادة", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }