public IHttpActionResult PostTeacherCode(TeacherCode teacherCode) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TeacherCodes.Add(teacherCode); try { db.SaveChanges(); } catch (DbUpdateException) { if (TeacherCodeExists(teacherCode.TeacherCode1)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = teacherCode.TeacherCode1 }, teacherCode)); }
public IHttpActionResult PutTeacherCode(string id, TeacherCode teacherCode) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != teacherCode.TeacherCode1) { return(BadRequest()); } db.Entry(teacherCode).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TeacherCodeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTeacherCode(string id) { TeacherCode teacherCode = db.TeacherCodes.Find(id); if (teacherCode == null) { return(NotFound()); } return(Ok(teacherCode)); }
public IHttpActionResult DeleteTeacherCode(string id) { TeacherCode teacherCode = db.TeacherCodes.Find(id); if (teacherCode == null) { return(NotFound()); } db.TeacherCodes.Remove(teacherCode); db.SaveChanges(); return(Ok(teacherCode)); }
private bool setTeacherInformation() { if (TeacherCode == 0) { return(false); } DataTable dtPeople = FRB.GetOstadInfoFromHR(TeacherCode);//FRB.GetOstadInfoFromHR(Convert.ToInt32(Session["user"])); if (dtPeople.Rows.Count == 1) { Business.Adobe.ProfPresentBusiness pb = new Business.Adobe.ProfPresentBusiness(); professorCode.InnerText = TeacherCode.ToString(); lblProfGender.Text = dtPeople.Rows[0]["sex"] == DBNull.Value ? "آقای/خانم " : dtPeople.Rows[0]["sex"].ToString() == "1" ? "آقای " : "خانم "; lblAddress.Text = dtPeople.Rows[0]["add_home"] == DBNull.Value ? "" : dtPeople.Rows[0]["add_home"].ToString(); lblBankAccount.Text = dtPeople.Rows[0]["siba"] == DBNull.Value ? "" : dtPeople.Rows[0]["siba"].ToString(); lblBirthDate.Text = dtPeople.Rows[0]["sal_tav"] == DBNull.Value ? "----" : dtPeople.Rows[0]["sal_tav"].ToString(); lblCertificateTitle.Text = dtPeople.Rows[0]["idmadrak"] == DBNull.Value ? "" : getNameOfCode(Convert.ToInt32(dtPeople.Rows[0]["idmadrak"]), 2); lblEmail.Text = dtPeople.Rows[0]["add_email"] == DBNull.Value ? "" : dtPeople.Rows[0]["add_email"].ToString(); lblFatherName.Text = dtPeople.Rows[0]["namep"] == DBNull.Value ? "" : dtPeople.Rows[0]["namep"].ToString(); lblFieldTitle.Text = dtPeople.Rows[0]["idresh"] == DBNull.Value ? "" : getNameOfCode(Convert.ToInt32(dtPeople.Rows[0]["idresh"]), 4); lblFirstName.Text = dtPeople.Rows[0]["name"] == DBNull.Value ? "" : dtPeople.Rows[0]["name"].ToString(); lblLastName.Text = dtPeople.Rows[0]["family"] == DBNull.Value ? "" : dtPeople.Rows[0]["family"].ToString(); lblFullName.Text = dtPeople.Rows[0]["name"] == DBNull.Value ? "" : dtPeople.Rows[0]["name"].ToString() + " " + dtPeople.Rows[0]["family"].ToString(); lblIdd.Text = dtPeople.Rows[0]["idd"] == DBNull.Value ? "" : dtPeople.Rows[0]["idd"].ToString(); //lblJobStatus.Text = dtPeople.Rows[0]["IsRetired"] == DBNull.Value ? "" : (dtPeople.Rows[0]["IsRetired"].ToString() == "0" ? "شاغل" : "بازنشسته");// if (dtPeople.Rows[0]["IsRetired"] != DBNull.Value) { lblJobStatus.Text = (dtPeople.Rows[0]["IsRetired"].ToString() == "0" ? "شاغل" : "بازنشسته"); //dvJobDetail.Visible = true; } lblMaritalStatus.Text = dtPeople.Rows[0]["marital_status"] == DBNull.Value ? "" : (dtPeople.Rows[0]["IsRetired"].ToString() == "1" ? "مجرد" : "متاهل");// ; lblMobile.Text = dtPeople.Rows[0]["mobile"] == DBNull.Value ? "" : dtPeople.Rows[0]["mobile"].ToString(); lblNationalCode.Text = dtPeople.Rows[0]["idd_meli"] == DBNull.Value ? "" : dtPeople.Rows[0]["idd_meli"].ToString(); lblPhoneNo.Text = dtPeople.Rows[0]["tel_home"] == DBNull.Value ? "----" : dtPeople.Rows[0]["tel_home"].ToString(); lblUniversity.Text = dtPeople.Rows[0]["university"] == DBNull.Value ? "" : getNameOfCode(Convert.ToInt32(dtPeople.Rows[0]["university"]), 1); lblPaye.Text = dtPeople.Rows[0]["payeh"] == DBNull.Value ? "" : dtPeople.Rows[0]["payeh"].ToString(); lblGroups.Text = pb.getActiveGroupOfGroupManagers(Convert.ToInt32(year), TeacherCode); lblMartabe.Text = dtPeople.Rows[0]["martabeh"] == DBNull.Value ? "" : FRB.getMartabeText(Convert.ToInt32(dtPeople.Rows[0]["martabeh"].ToString())); lbkSalary.Text = pb.getProfessorSalary(Convert.ToInt32(year), TeacherCode).ToString(); DataTable dtWorkDate = bsn.getbeginAndEndWorkTimeHOD(TeacherCode, Convert.ToInt32(year)); lblFromDate.Text = dtWorkDate.Rows[0]["beginDay"].ToString(); lblToDate.Text = dtWorkDate.Rows[0]["endDay"].ToString(); if (lblToDate.Text.Length > 0) { string[] splt = lblToDate.Text.Split('/'); if (splt.Length == 3 && splt[1] == "12" && splt[2] == "30") { splt[2] = DateTime.IsLeapYear(DateTime.Now.Year - ((Convert.ToInt32(DateTime.Now.ToPeString().Substring(0, 4))) - Convert.ToInt32(splt[0]))) ? "30" : "29"; lblToDate.Text = string.Format("{0}/{1}/{2}", splt[0], splt[1], splt[2]); } } incompletedInf = ""; if (lblFromDate.Text == "") { incompletedInf += "تاریخ شروع به فعالیت سال انتخابی، "; } if (lblToDate.Text == "") { incompletedInf += "تاریخ پایان فعالیت در سال انتخابی، "; } if (lbkSalary.Text == "") { incompletedInf += "مبلغ قرارداد، "; } if (lblAddress.Text == "") { incompletedInf += "آدرس محل سکونت، "; } if (lblBankAccount.Text == "") { incompletedInf += "شماره حساب بانکی، "; } //if (lblBirthDate.Text == "") // incompletedInf += "تاریخ تولد، "; if (lblCertificateTitle.Text == "") { incompletedInf += "مدرک تحصیلی، "; } if (lblEmail.Text == "") { incompletedInf += "پست الکترونیکی، "; } if (lblFatherName.Text == "") { incompletedInf += "نام پدر، "; } if (lblFieldTitle.Text == "") { incompletedInf += "رشته تحصیلی، "; } if (lblFirstName.Text == "") { incompletedInf += "نام، "; } if (lblFullName.Text == "") { incompletedInf += "نام خانوادگی، "; } if (lblIdd.Text == "") { incompletedInf += "شماره شناسنامه، "; } if (lblJobStatus.Text == "") { incompletedInf += "وضعیت شغلی، "; } if (lblMaritalStatus.Text == "") { incompletedInf += "وضعیت تاهل، "; } if (lblLastName.Text == "") { incompletedInf += "نام خانوادگی، "; } if (lblMobile.Text == "") { incompletedInf += "تلفن همراه، "; } if (lblNationalCode.Text == "") { incompletedInf += "کد ملی، "; } if (lblUniversity.Text == "") { incompletedInf += "نام دانشگاه، "; } if (incompletedInf.Length > 3) { incompletedInf = incompletedInf.Substring(0, incompletedInf.Length - 2); } return(incompletedInf.Length == 0); } return(dtPeople.Rows.Count == 1); }
private bool setTeacherInformation() { if (TeacherCode == 0) { return(false); } DataTable dtPeople = FRB.GetOstadInfoFromHR(TeacherCode);//FRB.GetOstadInfoFromHR(Convert.ToInt32(Session["user"])); if (dtPeople.Rows.Count == 1) { professorCode.InnerText = TeacherCode.ToString(); lblProfGender.Text = dtPeople.Rows[0]["sex"] == DBNull.Value ? "آقای/خانم " : dtPeople.Rows[0]["sex"].ToString() == "1" ? "آقای " : "خانم "; lblAddress.Text = dtPeople.Rows[0]["add_home"] == DBNull.Value ? "" : dtPeople.Rows[0]["add_home"].ToString(); lblBankAccount.Text = dtPeople.Rows[0]["siba"] == DBNull.Value ? "" : dtPeople.Rows[0]["siba"].ToString(); lblBirthDate.Text = dtPeople.Rows[0]["sal_tav"] == DBNull.Value ? "----" : dtPeople.Rows[0]["sal_tav"].ToString(); lblCertificateTitle.Text = dtPeople.Rows[0]["idmadrak"] == DBNull.Value ? "" : getNameOfCode(Convert.ToInt32(dtPeople.Rows[0]["idmadrak"]), 2); lblEmail.Text = dtPeople.Rows[0]["add_email"] == DBNull.Value ? "" : dtPeople.Rows[0]["add_email"].ToString(); lblFatherName.Text = dtPeople.Rows[0]["namep"] == DBNull.Value ? "" : dtPeople.Rows[0]["namep"].ToString(); lblFieldTitle.Text = dtPeople.Rows[0]["idresh"] == DBNull.Value ? "" : getNameOfCode(Convert.ToInt32(dtPeople.Rows[0]["idresh"]), 4); lblFirstName.Text = dtPeople.Rows[0]["name"] == DBNull.Value ? "" : dtPeople.Rows[0]["name"].ToString(); lblFullName.Text = dtPeople.Rows[0]["name"] == DBNull.Value ? "" : dtPeople.Rows[0]["name"].ToString() + " " + dtPeople.Rows[0]["family"].ToString(); lblIdd.Text = dtPeople.Rows[0]["idd"] == DBNull.Value ? "" : dtPeople.Rows[0]["idd"].ToString(); lblJobStatus.Text = dtPeople.Rows[0]["IsRetired"] == DBNull.Value ? "" : (dtPeople.Rows[0]["IsRetired"].ToString() == "0" ? "شاغل" : "بازنشسته");// ; lblLastName.Text = dtPeople.Rows[0]["family"] == DBNull.Value ? "" : dtPeople.Rows[0]["family"].ToString(); lblMobile.Text = dtPeople.Rows[0]["mobile"] == DBNull.Value ? "" : dtPeople.Rows[0]["mobile"].ToString(); lblNationalCode.Text = dtPeople.Rows[0]["idd_meli"] == DBNull.Value ? "" : dtPeople.Rows[0]["idd_meli"].ToString(); lblPhoneNo.Text = dtPeople.Rows[0]["tel_home"] == DBNull.Value ? "----" : dtPeople.Rows[0]["tel_home"].ToString(); lblTeachYears.Text = dtPeople.Rows[0]["sanavat_tadris"] == DBNull.Value ? "" : dtPeople.Rows[0]["sanavat_tadris"].ToString() + " سال"; lblUniversity.Text = dtPeople.Rows[0]["university"] == DBNull.Value ? "" : getNameOfCode(Convert.ToInt32(dtPeople.Rows[0]["university"]), 1); incompletedInf = ""; if (lblAddress.Text == "") { incompletedInf = "آدرس محل سکونت، "; } if (lblBankAccount.Text == "") { incompletedInf += "شماره حساب بانکی، "; } //if (lblBirthDate.Text == "") // incompletedInf += "تاریخ تولد، "; if (lblCertificateTitle.Text == "") { incompletedInf += "مدرک تحصیلی، "; } if (lblEmail.Text == "") { incompletedInf += "پست الکترونیکی، "; } if (lblFatherName.Text == "") { incompletedInf += "نام پدر، "; } if (lblFieldTitle.Text == "") { incompletedInf += "رشته تحصیلی، "; } if (lblFirstName.Text == "") { incompletedInf += "نام، "; } if (lblFullName.Text == "") { incompletedInf += "نام خانوادگی، "; } if (lblIdd.Text == "") { incompletedInf += "شماره شناسنامه، "; } if (lblJobStatus.Text == "") { incompletedInf += "وضعیت شغلی، "; } if (lblLastName.Text == "") { incompletedInf += "نام خانوادگی، "; } if (lblMobile.Text == "") { incompletedInf += "تلفن همراه، "; } if (lblNationalCode.Text == "") { incompletedInf += "کد ملی، "; } //if (lblPhoneNo.Text == "") // incompletedInf += "تلفن منزل، "; if (lblTeachYears.Text == "") { incompletedInf += "سنوات تدریس، "; } if (lblUniversity.Text == "") { incompletedInf += "نام دانشگاه، "; } if (incompletedInf.Length > 3) { incompletedInf = incompletedInf.Substring(0, incompletedInf.Length - 2); } return(incompletedInf.Length == 0); } return(dtPeople.Rows.Count == 1); }
public override int GetHashCode() { return(TeacherCode != null ? TeacherCode.GetHashCode() : 0); }