/// <summary> /// Generic Delete method for the entities /// </summary> /// <param name="entityToDelete">entityToDelete</param> public virtual void Delete(TEntity entityToDelete) { if (Context.Entry(entityToDelete).State == EntityState.Detached) { DbSet.Attach(entityToDelete); } DbSet.Remove(entityToDelete); }
//通用新增 public int Insert(T t) { st.Entry <T>(t).State = System.Data.Entity.EntityState.Added; try { return(st.SaveChanges()); } catch (Exception ex) { throw; } }
public ActionResult approveliqui(int?pid) { var lalist = this.db.liqiapprovals.ToList(); var la = lalist.Find(x => x.pid == pid); if (la.pid != 0 || la != null) { la.approved_by = User.Identity.Name; la.status = "approved"; db.Entry(la).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("liquiapprove")); }
public ActionResult Edit([Bind(Include = "Employee_Id,employee_no,IBAN,Account_no,bank_name")] bank_details bank_details) { if (ModelState.IsValid) { db.Entry(bank_details).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var alist = this.db.master_file.OrderBy(e => e.employee_no).ToList(); var afinallist = new List <master_file>(); foreach (var file in alist) { if (afinallist.Count == 0) { afinallist.Add(file); } if (!afinallist.Exists(x => x.employee_no == file.employee_no)) { afinallist.Add(file); } } this.ViewBag.employee_no = new SelectList(afinallist, "employee_id", "employee_no"); return(View(bank_details)); }
public IHttpActionResult PutLeave_Type(int id, Leave_Type leave_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != leave_Type.ID) { return(BadRequest()); } db.Entry(leave_Type).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Leave_TypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
protected void EmployeeGrid_RowUpdating(object sender, GridViewUpdateEventArgs e) { using (HREntities hr = new HREntities()) { GridViewRow row = EmployeeGrid.Rows[e.RowIndex]; TextBox textmployeeId = row.Cells[1].Controls[0] as TextBox; int employeeId = int.Parse(textmployeeId.Text); TextBox textFirstName = row.Cells[2].Controls[0] as TextBox; string firstName = textFirstName.Text; TextBox textLastName = row.Cells[3].Controls[0] as TextBox; string lastName = textLastName.Text; TextBox textEmail = row.Cells[4].Controls[0] as TextBox; string email = textEmail.Text; COPY_EMP employee = new COPY_EMP { EMPLOYEE_ID = employeeId, FIRST_NAME = firstName, LAST_NAME = lastName, EMAIL = email }; hr.Entry(employee).State = System.Data.Entity.EntityState.Modified; hr.SaveChanges(); } EmployeeGrid.EditIndex = -1; UpdateDataGrid(); }
public IHttpActionResult PutUserInfo(int id, UserInfo userInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userInfo.Employee_ID) { return(BadRequest()); } db.Entry(userInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "D_ID,D_Name")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "Id,Date_Prepared,project,Location,NO_EOTH,start_date,end_date")] OVERTIME_APPROVAL oVERTIME_APPROVAL) { if (ModelState.IsValid) { db.Entry(oVERTIME_APPROVAL).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(oVERTIME_APPROVAL)); }
public ActionResult Edit([Bind(Include = "Id,expence,issuer")] liquiexp liquiexp) { if (ModelState.IsValid) { db.Entry(liquiexp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(liquiexp)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,Amonths,OTdate,remarks,BS,house_RA,HRA_advance_com")] HRA_requset hRA_requset) { if (ModelState.IsValid) { db.Entry(hRA_requset).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hRA_requset)); }
public ActionResult Edit([Bind(Include = "Id,projobtitle,department,reporting_to,type_of_hire,new_hire,justification_NH,proposed_salary,replacement_name,gross_salary,J_P_specification,age_range_from,edu_qua_and_ex_required,add_req_job_resp")] rec_req_form rec_req_form) { if (ModelState.IsValid) { db.Entry(rec_req_form).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rec_req_form)); }
public ActionResult Edit([Bind(Include = "Id,C1B,C2B,C3B,C4B,C5B,C6B,C7B,C8B")] EXIT_INTERVIEW eXIT_INTERVIEW) { if (ModelState.IsValid) { db.Entry(eXIT_INTERVIEW).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(eXIT_INTERVIEW)); }
public ActionResult Edit([Bind(Include = "Id,interviewee_name,interview_date,job_applied_for,department,education,experience,job_knoledge,conceptual_clarity,appearance,communication,confidence_level,attitude,current_salary,expected_salary,reason_F_L_P_C,overall_evaluation,recommented_to_be_employed,in_position_of,employment_in_the_future")] JOB_INTERVIEW_EVALUATION jOB_INTERVIEW_EVALUATION) { if (ModelState.IsValid) { db.Entry(jOB_INTERVIEW_EVALUATION).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jOB_INTERVIEW_EVALUATION)); }
public ActionResult Edit([Bind(Include = "Id,employee_id,C1a,C2a,C3a,C4a,C5a,C6a,C7a,C8a,C9a")] induction_training induction_training) { if (ModelState.IsValid) { db.Entry(induction_training).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.employee_id = new SelectList(db.master_file, "employee_id", "employee_name", induction_training.employee_id); return(View(induction_training)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,traning_prog,traning_date,line_manager,prog_objective,emp_work_per,emp_work_att,emp_work_team,RC_otheremp,RC_FDporg,comments")] Training_Effectiveness training_Effectiveness) { if (ModelState.IsValid) { db.Entry(training_Effectiveness).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", training_Effectiveness.Employee_id); return(View(training_Effectiveness)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,date_prepared,DJ_date,late_in,early_out,reason")] ATTENDANCE_ADJUSTMENT aTTENDANCE_ADJUSTMENT) { if (ModelState.IsValid) { db.Entry(aTTENDANCE_ADJUSTMENT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", aTTENDANCE_ADJUSTMENT.Employee_id); return(View(aTTENDANCE_ADJUSTMENT)); }
public ActionResult Edit([Bind(Include = "Id,employee_id,LETTER_TYPE,MENTION_SALARY,BL_bank_nane,BL_account_no,EL_name,EL_purpose,EL_DOV_from,EL_DOV_to,TD_NCARREG,TD_CARREGREN,TD_DLA,TDLREN,other,Etisalat,ADWEA,Mawaqif,Immigration")] CERTIFICATE_REQUEST cERTIFICATE_REQUEST) { if (ModelState.IsValid) { db.Entry(cERTIFICATE_REQUEST).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.employee_id = new SelectList(db.master_file, "employee_id", "employee_name", cERTIFICATE_REQUEST.employee_id); return(View(cERTIFICATE_REQUEST)); }
public ActionResult Edit([Bind(Include = "Id,employee_id,Knowledge_of_job,Quality_of_work,Achievement_Oriented,Ability_To_Learn,Work_Attitude_and_Co_operation,Ability_To_work_Independently,Reliability,Initiative,employee_excels,improvement_,C_success_and_strengths,further_development,support,Comments,confirming,Line_Managers_Comments,Directors_Comments")] PROBATION_ASSESSMENT pROBATION_ASSESSMENT) { if (ModelState.IsValid) { db.Entry(pROBATION_ASSESSMENT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.employee_id = new SelectList(db.master_file, "employee_id", "employee_name", pROBATION_ASSESSMENT.employee_id); return(View(pROBATION_ASSESSMENT)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,traning_prog,traning_date,TEV_1_1,TEV_1_2,TEV_1_3,TEV_1_4,TEV_1_5,TEV_2_1,TEV_2_2,TEV_2_3,TEV_2_4,TEV_2_5,TEV_3_1,TEV_3_2,TEV_3_3,TEV_3_4,TEV_3_5,TEV_4_1,TEV_4_2,TEV_4_3,TEV_4_4,TEV_4_5,TEV_5_1,TEV_5_2,enhancements")] Training_Evaluation training_Evaluation) { if (ModelState.IsValid) { db.Entry(training_Evaluation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", training_Evaluation.Employee_id); return(View(training_Evaluation)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,date,type_of_trip,IO_specify,destination,Departure_Date,Return_Date,TRIP_OBJECTIVE,Objectives")] BUSINESS_TRIP_REPORT_ bUSINESS_TRIP_REPORT_) { if (ModelState.IsValid) { db.Entry(bUSINESS_TRIP_REPORT_).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", bUSINESS_TRIP_REPORT_.Employee_id); return(View(bUSINESS_TRIP_REPORT_)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,action_active,New_Title,Action_Taken,Action_Taken2,Basic_Salary,House_Rent_Allowance,Telephone_Allowance,Living_Allowance,Transportation_Allowance,Other_Allowances,Total_Salary,Medical_Insurance_Policy,Annual_Leave,Bank_Name_Branch,Bank_Account_No,Remarks,Action_as_of")] emp_joi_sta_change emp_joi_sta_change) { if (ModelState.IsValid) { db.Entry(emp_joi_sta_change).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", emp_joi_sta_change.Employee_id); return(View(emp_joi_sta_change)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,last_working_day,status")] end_of_service end_of_service) { if (ModelState.IsValid) { db.Entry(end_of_service).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", end_of_service.Employee_id); return(View(end_of_service)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,TR_date,line_manager,e_mail_address,contact__no,course_name,training_provider,location,program_type,duration_from,duration_to,C_S_description,TR_objactive,TR_competencies,comments,budget,TE_program_cost_desc,TE_program_cost_price,TE_transportation_desc,TE_transportation_price,TE_accom_desc,TE_accom_price,TE_diem_desc,TE_diem_price,TE_total_desc,TE_total_price,HR_comments")] Training_Request training_Request) { if (ModelState.IsValid) { db.Entry(training_Request).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", training_Request.Employee_id); return(View(training_Request)); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,request_date,pro_from,por_to,effective_date,remarks")] MANPOWER_TRANSFER_REQUEST mANPOWER_TRANSFER_REQUEST) { if (ModelState.IsValid) { db.Entry(mANPOWER_TRANSFER_REQUEST).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", mANPOWER_TRANSFER_REQUEST.Employee_id); return(View(mANPOWER_TRANSFER_REQUEST)); }
public ActionResult Edit([Bind(Include = "Id,Employee_NO1,Employee_NO2,leave_start,leave_end,reason_for_handover,RNR_HO1,RNR_HO2,RNR_HO3,RNR_HO4,RNR_HO5")] DUTY_HANDOVER dUTY_HANDOVER) { if (ModelState.IsValid) { db.Entry(dUTY_HANDOVER).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_NO1 = new SelectList(db.master_file, "employee_id", "employee_name", dUTY_HANDOVER.Employee_NO1); ViewBag.Employee_NO2 = new SelectList(db.master_file, "employee_id", "employee_name", dUTY_HANDOVER.Employee_NO2); return(View(dUTY_HANDOVER)); }
public ActionResult Edit([Bind(Include = "Employee_id,Id,absence,month,fromd,tod")] leave_absence leave_absence, DateTime?eddate) { ViewBag.eddate = eddate; if (ModelState.IsValid) { db.Entry(leave_absence).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("leave_absence_Index", "Leaves", new{ eddate = eddate })); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_no", leave_absence.Employee_id); return(View(leave_absence)); }
public ActionResult UpdateEmployee(Employee edittedEmployee) { using (HREntities hr = new HREntities()) { COPY_EMP addedEmp = new COPY_EMP { EMPLOYEE_ID = edittedEmployee.EmployeeId, FIRST_NAME = edittedEmployee.FirstName, LAST_NAME = edittedEmployee.LastName }; hr.Entry(addedEmp).State = System.Data.Entity.EntityState.Modified; hr.SaveChanges(); return(Redirect("~/employees")); } }
// GET: datacorrection public void Index() { var con = this.db.payroles.ToList(); var master = this.db.contracts.OrderBy(x => x.employee_no).ThenByDescending(x => x.date_changed).ToList(); foreach (var id1 in con.OrderBy(x => x.master_file.employee_no)) { var cor = master.Find(x => x.employee_id == id1.con_id); if (cor != null) { var mast = master.FindAll(x => x.employee_no == cor.employee_no).ToList(); if (mast.Count() >= 1) { id1.con_id = mast[0].employee_id; db.Entry(id1).State = EntityState.Modified; db.SaveChanges(); } } } /* * var con = this.db.Leaves.ToList(); * var master = this.db.master_file.OrderBy(x=>x.employee_no).ThenByDescending(x=>x.date_changed).ToList(); * foreach (var id1 in con.OrderBy(x=>x.master_file.employee_no)) * { * var cor = master.Find(x => x.employee_id == id1.Employee_id); * if (cor != null) * { * var mast = master.FindAll(x => x.employee_no == cor.employee_no).ToList(); * if (mast.Count() >=1) * { * id1.Employee_id = mast[0].employee_id; * db.Entry(id1).State = EntityState.Modified; * db.SaveChanges(); * } * * } * }*/ }
public int Add <T>(T t) where T : class { hre.Entry <T>(t).State = EntityState.Added; return(hre.SaveChanges()); }