public ActionResult EditCon([Bind(Include = "contractdetailsid,contract_details_id,contract_details_description_english,contract_details_abreviation_english,contract_details_description_french,contract_details_abreviation_french,contract_details_status,contract_details_created_by,contract_details_created_datetime,contract_details_last_modified_by,contract_details_last_modified_datetime,contract_details_deleted_by,contract_details_deleted_datetime,contract_type_code,fundid,staffid")] contract_details contract_details) { if (ModelState.IsValid) { db.Entry(contract_details).State = EntityState.Modified; db.SaveChanges(); //var res = (from c in db.staffs // where c.staffid == contract_details.staffid // select c).SingleOrDefault(); //res.stuff_contract_details = contract_details.contractdetailsid; //db.SaveChanges(); //var res = (from c in db.staffs // where c.staffid == contract_details.staffid // select c).SingleOrDefault(); //res.stuff_contract_details = null; //db.SaveChanges(); //return RedirectToAction("Index"); return(RedirectToAction("Index")); } ViewBag.fundid = new SelectList(db.Funds, "fundid", "resource"); ViewBag.staffid = new SelectList(db.staffs, "staffid", "staff_email"); return(View(contract_details)); }
public ActionResult Edit([Bind(Include = "contractTypeid,contract_Type_code,contract_type_name,contract_type_description")] contract_type contract_type) { if (ModelState.IsValid) { db.Entry(contract_type).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contract_type)); }
public ActionResult Edit([Bind(Include = "ID,Name,Description,Non1,Non2,Non3")] MissionType missionType) { if (ModelState.IsValid) { db.Entry(missionType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(missionType)); }
public ActionResult Edit([Bind(Include = "ID,RequstingBy,RequestingDate,RequestingUnit,FocalPoint,Purpose,FromDate,ToDate,NumOFP_CO,NumOFP_RB,NumOFP_HQ,NumOFP_Other,Country,GOV,District,OtherPlace,Budget_TR,Number_Roms,Check_inDate,Check_OutDate,Rom_Type,Microphone,HiSpeedInternet,Conf_Call_Device,MMR_Days,BOR_Days,COffeBreak,COffeBreak_UNM,Lunch,Dinner,Coctail_Reception,Dedicated_IT_SUPP,DescripDaysORHours,Transportstion_ForLocal_Staff,Airport_Picup_Services,Other_Services,non1,non2,non3")] requests1 requests1) { if (ModelState.IsValid) { db.Entry(requests1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(requests1)); }
public ActionResult Edit([Bind(Include = "functionaltitleid,functional_title_id,functional_title_description_english,functional_title_abreviation_english,functional_title_description_french,functional_title_abreviation_french,functional_title_status,functional_title_created_by,functional_title_created_datetime,functional_title_last_modified_by,functional_title_last_modified_datetime,functional_title_deleted_by,functional_title_deleted_datetime")] functional_title functional_title) { if (ModelState.IsValid) { db.Entry(functional_title).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(functional_title)); }
public ActionResult Edit([Bind(Include = "MissionID,staffid,FromDate,ToDate,MissionItinerary,funding,ClearedBySupervisor,MissionObjective,ExpectedOutputs,Achievements,FollowUp,SignatureDate")] MissionAuthorization missionAuthorization) { if (ModelState.IsValid) { db.Entry(missionAuthorization).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var staffs = db.staffs.Include(s => s.contract_details).Include(s => s.contract_type).Include(s => s.Country_office).Include(s => s.functional_title).Include(s => s.staff2).Include(s => s.sub_office).Include(s => s.unit).Include(s => s.country).Include(s => s.governorate); staffs = staffs.Where(s => s.staff_email.Contains(User.Identity.Name + "@wfp.org")); ViewBag.staffid = staffs.First().staffid; ViewBag.FirstNme = staffs.First().staff_first_name; ViewBag.LastName = staffs.First().staff_last_name; return(View(missionAuthorization)); }
public ActionResult Edit([Bind(Include = "type_id,type_name,comment,typ01,type02,type22")] TRAINING_TYPE tRAINING_TYPE) { if (ModelState.IsValid) { db.Entry(tRAINING_TYPE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tRAINING_TYPE)); }
public ActionResult Edit([Bind(Include = "countryid,country_name,country_description")] country country) { if (ModelState.IsValid) { db.Entry(country).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(country)); }
public ActionResult Edit([Bind(Include = "fundid,fund_code,resource,Description")] Fund fund) { if (ModelState.IsValid) { db.Entry(fund).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fund)); }
public ActionResult Edit([Bind(Include = "PLAN_ID,TRAINING_PLACE,PERIOD_FROM,PERIOD_TO")] TRAINING_PLAN tRAINING_PLAN) { if (ModelState.IsValid) { db.Entry(tRAINING_PLAN).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tRAINING_PLAN)); }
public ActionResult Edit([Bind(Include = "sc_id,from_time,to_time,EMP_ID,attend,PLAN_ID,time_open,extra1,extra2,extra3,time_closed,comment")] TRAINING_SC tRAINING_SC) { if (ModelState.IsValid) { db.Entry(tRAINING_SC).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PLAN_ID = new SelectList(db.TRAINING_PLAN, "PLAN_ID", "TRAINING_PLACE", tRAINING_SC.PLAN_ID); return(View(tRAINING_SC)); }
public ActionResult Edit([Bind(Include = "dependentsid,dependents_code,staffid,dependents_first_name,dependents_last_name,dependents_gender,dependents_phone_num,dependents_blood_group,dependents_passport_num,dependents_passport_expiry_date,dependents_notes,dependents_medical_condition")] dependent dependent) { if (ModelState.IsValid) { db.Entry(dependent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.staffid = new SelectList(db.staffs, "staffid", "staff_email", dependent.staffid); return(View(dependent)); }
public ActionResult Edit([Bind(Include = "Sessionid,CourseID,CourseDuration,CourseStartTime,CourseEndTime,CourseStartDate,CourseEndDate,CourseLocation,SessionName,CoursePrerequisite")] CourseSession courseSession) { if (ModelState.IsValid) { db.Entry(courseSession).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", courseSession.CourseID); return(View(courseSession)); }
public ActionResult Edit([Bind(Include = "TRAINING_ID,TRAINING_NAME,TRAINING_DESC,TRAINING_PLACE,TRAINING_PERIOD,PARENT_TRAINING_ID")] TRAINING tRAINING) { if (ModelState.IsValid) { db.Entry(tRAINING).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PARENT_TRAINING_ID = new SelectList(db.TRAININGS, "TRAINING_ID", "TRAINING_NAME", tRAINING.PARENT_TRAINING_ID); return(View(tRAINING)); }
public ActionResult Edit([Bind(Include = "countryofficeid,office_id,office_description_english,office_abreviation_english,office_description_french,office_abreviation_french,office_status,office_created_by,office_created_datetime,office_last_modified_by,office_last_modified_datetime,office_deleted_by,office_deleted_datetime,country_code")] Country_office country_office) { if (ModelState.IsValid) { db.Entry(country_office).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.country_code = new SelectList(db.countries, "countryid", "country_name", country_office.country_code); return(View(country_office)); }
public async Task <ActionResult> Edit([Bind(Include = "CourseID,CourseName,CourseType")] Cours cours) { if (ModelState.IsValid) { db.Entry(cours).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cours)); }
public ActionResult Edit([Bind(Include = "governorates_code,governorates_name,governorates_description,country_code,staff_id")] governorate governorate) { if (ModelState.IsValid) { db.Entry(governorate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.country_code = new SelectList(db.countries, "countryid", "country_name", governorate.country_code); return(View(governorate)); }
public ActionResult Edit([Bind(Include = "PLAN_ID,TRAINING_ID,EMP_ID,ATTENDED,PASSED,TRAINING_EVALUATION,TRAINER_EVALUATION,CLASS_ID")] TRAINEE tRAINEE) { if (ModelState.IsValid) { db.Entry(tRAINEE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PLAN_ID = new SelectList(db.TRAINING_PLAN_TRAINING_CLASSES, "PLAN_ID", "CLASS_NAME", tRAINEE.PLAN_ID); ViewBag.TRAINING_ID = new SelectList(db.TRAININGS, "TRAINING_ID", "TRAINING_NAME", tRAINEE.TRAINING_ID); return(View(tRAINEE)); }
public ActionResult Edit([Bind(Include = "PLAN_ID,TRAINING_ID,REQUIRE_CERTIFICATE,CERTIFICATE_ID,COASTPEREMP,EMPLPERCENTAGE,FAILPASSDEPENDANCY,IFFAILPERCENTAGE,IFPASSPERCENTAGE,TRAINING_TYPE")] TRAINING_PLAN_TRAININGS tRAINING_PLAN_TRAININGS) { if (ModelState.IsValid) { db.Entry(tRAINING_PLAN_TRAININGS).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PLAN_ID = new SelectList(db.TRAINING_PLAN, "PLAN_ID", "TRAINING_PLACE", tRAINING_PLAN_TRAININGS.PLAN_ID); ViewBag.TRAINING_TYPE = new SelectList(db.TRAINING_TYPE, "type_id", "type_name", tRAINING_PLAN_TRAININGS.TRAINING_TYPE); return(View(tRAINING_PLAN_TRAININGS)); }
public ActionResult Edit([Bind(Include = "areacode,area_name,countryid,governorates_code")] district district) { if (ModelState.IsValid) { db.Entry(district).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.countryid = new SelectList(db.countries, "countryid", "country_name", district.countryid); ViewBag.governorates_code = new SelectList(db.governorates, "governorates_code", "governorates_name", district.governorates_code); return(View(district)); }
public ActionResult Edit([Bind(Include = "unitid,unit_id,unit_description_english,unit_abreviation_english,unit_description_french,unit_abreviation_french,unit_status,unit_created_by,unit_created_datetime,unit_last_modified_by,unit_last_modified_datetime,unit_deleted_by,unit_deleted_datetime,unit_short_abreviation,office_id,HOU_ID")] unit unit) { if (ModelState.IsValid) { db.Entry(unit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.office_id = new SelectList(db.Country_office, "countryofficeid", "office_description_english", unit.office_id); ViewBag.HOU_ID = new SelectList(db.Country_office, "staffid", "staff_email", unit.HOU_ID); return(View(unit)); }
public ActionResult Edit([Bind(Include = "ID,MissionID,Description,FromID,FromDate,ToID,ToDate,non1,non2,non3,non4,Fromtime,Totime")] MissionItinerary missionItinerary) { if (ModelState.IsValid) { db.Entry(missionItinerary).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FromID = new SelectList(db.countries, "countryid", "country_name", missionItinerary.FromID); ViewBag.ToID = new SelectList(db.countries, "countryid", "country_name", missionItinerary.ToID); ViewBag.MissionID = new SelectList(db.MissionAuthorizations, "MissionID", "MissionID", missionItinerary.MissionID); return(View(missionItinerary)); }
public async Task <ActionResult> Edit([Bind(Include = "RegID,staffid,courseid,sessionid,LMSPre,,SupervisorApprove")] CourseReg courseReg) { if (ModelState.IsValid) { db.Entry(courseReg).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.courseid = new SelectList(db.Courses, "CourseID", "CourseName", courseReg.courseid); ViewBag.sessionid = new SelectList(db.CourseSessions, "Sessionid", "CourseDuration", courseReg.sessionid); ViewBag.staffid = new SelectList(db.staffs, "staffid", "staff_id", courseReg.staffid); return(View(courseReg)); }
public ActionResult Edit([Bind(Include = "request_no,first_name,last_name,job_title,unit,budget_code,index_number,duty_station,supervisor_email,appointment_type,start_date,end_date,computerLaptop,computerDeskyop,email,access_P,telephone,pincode_ext,local_sim,international,roaming,SmartPhone,BasicPhone,usb_modem,color_printer,BlackberryService,IphoneService,mobile_phone,other,location,requested_by")] request request) { if (ModelState.IsValid) { db.Entry(request).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.job_title = new SelectList(db.functional_title, "functionaltitleid", "functional_title_id", request.job_title); ViewBag.requested_by = new SelectList(db.staffs, "staffid", "staff_id", request.requested_by); ViewBag.requested_by = new SelectList(db.staffs, "staffid", "staff_id", request.requested_by); ViewBag.unit = new SelectList(db.units, "unitid", "unit_id", request.unit); return(View(request)); }
public ActionResult Edit([Bind(Include = "request_no,first_name,last_name,job_title,unit,budget_code,index_number,duty_station,supervisor_email,appointment_type,start_date,end_date,computerLaptop,computerDeskyop,IphoneService,email,access_P,telephone,pincode_ext,local_sim,international,roaming,SmartPhone,BasicPhone,usb_modem,color_printer,BlackberryService,IphoneService,mobile_phone,other,location,requested_by")] request request) { if (request.computerDeskyop == false) { request.computerLaptop = true; } if (ModelState.IsValid) { try { db.Entry(request).State = EntityState.Modified; db.SaveChanges(); //////////////////// update email var email = ""; var PDrive = ""; var telephoneext = ""; var pincode = ""; var localsim = ""; var international = ""; var roaming = ""; var USBMODEM = ""; var color_printer = ""; if (request.email == true) { email = "Yes"; } else { email = "No"; } if (request.access_P == true) { PDrive = "Yes"; } else { PDrive = "No"; } if (request.telephone == true) { telephoneext = "Yes"; } else { telephoneext = "No"; } if (request.pincode_ext == true) { pincode = "Yes"; } else { pincode = "No"; } if (request.local_sim == true) { localsim = "Yes"; } else { localsim = "No"; } if (request.international == true) { international = "Yes"; } else { international = "No"; } if (request.roaming == true) { roaming = "Yes"; } else { roaming = "No"; } if (request.usb_modem == true) { USBMODEM = "Yes"; } else { USBMODEM = "No"; } if (request.color_printer == true) { color_printer = "Yes"; } else { color_printer = "No"; } var staffs = db.staffs.Include(s => s.contract_details).Include(s => s.contract_type).Include(s => s.Country_office).Include(s => s.functional_title).Include(s => s.staff2).Include(s => s.sub_office).Include(s => s.unit).Include(s => s.country).Include(s => s.governorate); staffs = staffs.Where(s => s.staffid == request.requested_by); var requestedby = staffs.First().staff_first_name + " " + staffs.First().staff_last_name; var requestedbyemail = staffs.First().staff_email; var title = db.functional_title.Include(s => s.staffs); title = title.Where(t => t.functionaltitleid == request.job_title); var jobtitle = title.First().functional_title_description_english; var unitselect = db.units.Include(s => s.staffs); unitselect = unitselect.Where(u => u.unitid == request.unit); var unit = unitselect.First().unit_description_english; var Superemail = db.staffs.Include(s => s.district); Superemail = Superemail.Where(Su => Su.staffid == request.supervisor_email); var supervisor_email = Superemail.First().staff_email; MailMessage mail = new MailMessage(); mail.To.Add("*****@*****.**"); mail.CC.Add(supervisor_email); mail.CC.Add(requestedbyemail); mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); //mail.CC.Add(supervisor_email); mail.Bcc.Add("*****@*****.**"); mail.From = new MailAddress(requestedbyemail); mail.Subject = "IT Services New Edit for :" + request.first_name + " " + request.last_name; string Body = "<table border='0'><tr><td colspan='2'><hr/>Request Information<hr/></td><hr/></tr><tr><td><font color='blue'>Request Number: </font></td><td>" + request.request_no + "</td></tr>" + "<tr><td><font color='blue'>" + " Requested By :</font></td><td>" + requestedby + "</td></tr>" + "<tr><td colspan='2'><hr/>PERSONAL INFORMATION<hr/></td></tr>" + "<tr><td><font color='blue'>" + "New Staff :</font></td><td>" + request.first_name + " " + request.last_name + "</td></tr>" + "<tr><td><font color='blue'> JOB TITLE :</font></td><td>" + jobtitle + "</td></tr>" + "<tr><td><font color='blue'>UNIT :</font></td><td>" + unit + "</td></tr>" + "<tr><td><font color='blue'>BUDGET CODE :</font></td><td>" + request.budget_code + "</td></tr>" + "<tr><td><font color='blue'>INDEX NUMBER :</font></td><td>" + request.index_number + "</td></tr>" + "<tr><td><font color='blue'>DUTY STATION :</font></td><td>" + request.duty_station + "</td></tr>" + "<tr><td><font color='blue'>SUPERVISOR EMAIL :</font></td><td>" + supervisor_email + "</td></tr>" + "<tr><td colspan='2'><hr/>Contract Information<hr/></td></tr><tr><td><font color='blue'>Appoinment Type :</font></td><td>" + request.appointment_type + "</td></tr>" + "<tr><td><font color='blue'>START DATE :</font></td><td>" + request.start_date.Value.ToString("dd/MMM/yy") + "</td></tr>" + "<tr><td><font color='blue'>END DATE :</font></td><td>" + request.end_date.Value.ToString("dd/MMM/yy") + "</td></tr>" + "<tr><td colspan='2'><hr/>SERVICES AND EQUIPMENT<hr/></td></tr>" + "<tr><td><font color='blue'>COMPUTER TYPE :</font></td><td>" + request.IphoneService + "</td></tr>" + "<tr><td><font color='blue'>E-MAIL :</font></td><td>" + email + "</td></tr>" + "<tr><td><font color='blue'>ACCESS P DRIVE :</font></td><td>" + PDrive + "</td></tr>" + "<tr><td><font color='blue'>TELEPHONE EXT :</font></td><td>" + telephoneext + "</td></tr>" + "<tr><td><font color='blue'>PINCODE FOR EXTERNAL CALLS :</font></td><td>" + pincode + "</td></tr>" + "<tr><td><font color='blue'>LOCAL MOBILE SIM :</font></td><td>" + localsim + "</td></tr>" + "<tr><td><font color='blue'>INTERNATIONAL :</font></td><td>" + international + "</td></tr>" + "<tr><td><font color='blue'>ROAMING :</font></td><td>" + roaming + "</td></tr>" + "<tr><td><font color='blue'>USB Modem :</font></td><td>" + USBMODEM + "</td></tr>" + "<tr><td><font color='blue'>PHONES :</font></td><td>" + request.mobile_phone + "</td></tr>" + "<tr><td><font color='blue'>COLOR_PRINTER :</font></td><td>" + color_printer + "</td></tr>" + "<tr><td><font color='blue'>OTHER REQUIREMENTS :</font></td><td>" + request.other + "</td></tr>" + "<tr><td><font color='blue'>SITTING LOCATION :</font></td><td>" + request.location + "</td></tr></table>"; //string Body = "Request : Mission Mission ID : " + missionAuthorization.MissionID + " <br> " + " From :" + staffs.First().staff_first_name + " " + staffs.First().staff_last_name + "<br><br>" + " Mission Information" + "<br><br>" + " From :" + missionAuthorization.FromDate + "<br>To :" + missionAuthorization.ToDate + // "<br>Funding :" + missionAuthorization.funding + "<br>Objective :" + missionAuthorization.MissionObjective + "<br> Mission Itinerary :" + missionAuthorization.MissionItinerary + "<br> Can This meeting Be Done Over Voice/Video ? :" + missionAuthorization.canbedone + " <br><br> <a href='http://10.11.135.254:8080/WFPSMS/MissionAuthorizations/Approval2?Mid=" + missionAuthorization.MissionID + "&ClearedBySupervisor=" + true + "&FromDate=" + missionAuthorization.FromDate + " &ToDate=" + missionAuthorization.ToDate + " &to=" + to + "&staffmail=" + staffs.First().staff_email + "&supervisorname=" + supername + "'>Acept</a> <a href='http://10.11.135.254:8080/WFPSMS/MissionAuthorizations/Approval?Mid=" + missionAuthorization.MissionID + "&ClearedBySupervisor= " + false + "& FromDate=" + missionAuthorization.FromDate + " &ToDate=" + missionAuthorization.ToDate + "&to=" + to + "&staffmail=" + staffs.First().staff_email + "&supervisorname=" + supername + "'>Reject</a> "; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtprelay.global.wfp.org"; smtp.Port = 25; smtp.UseDefaultCredentials = true; //smtp.Credentials = new System.Net.NetworkCredential //("ahmed.badr", "Survivor2323");// Enter seders User name and password //smtp.EnableSsl = true; smtp.Send(mail); /////////////////// update email end return(RedirectToAction("Index")); } catch (DbEntityValidationException ex) { // Retrieve the error messages as a list of strings. var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); // Join the list to a single string. var fullErrorMessage = string.Join("; ", errorMessages); // Combine the original exception message with the new one. var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage); // Throw a new DbEntityValidationException with the improved exception message. throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors); } } ViewBag.job_title = new SelectList(db.functional_title, "functionaltitleid", "functional_title_id", request.job_title); ViewBag.requested_by = new SelectList(db.staffs, "staffid", "staff_id", request.requested_by); ViewBag.requested_by = new SelectList(db.staffs, "staffid", "staff_id", request.requested_by); ViewBag.unit = new SelectList(db.units, "unitid", "unit_id", request.unit); ViewBag.supervisor_email = new SelectList(db.staffs.OrderBy(staffs => staffs.staff_email), "staffid", "staff_email", request.supervisor_email); return(View(request)); }