protected void btnStatusChange_Click(object sender, EventArgs e) { try { HRM_JobAllocation joba = new HRM_JobAllocation(); if (drpdwnStatus.SelectedItem.ToString() == "Success") { joba.SuccessStatus = true; } else if (drpdwnStatus.SelectedItem.ToString() == "Pending") { joba.PendingStatus = true; } else if (drpdwnStatus.SelectedItem.ToString() == "Cancel") { joba.CancelStatus = true; } joba.UpdateRemark = txtbxRemark.Text; string jobAllocatinCode = lblJobAllocationCode.Text; int result = jobAllocationDal.SaveJobAllocationStatus(joba, jobAllocatinCode); if (result == 1) { lblMessage.Text = "Status Save Successfully."; } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
internal int SaveJobAllocationStatus(HRM_JobAllocation joba, string jobAllocationCode) { HRM_JobAllocation jobAllocatonCode = _context.HRM_JobAllocation.First(x => x.JobAllocationCode == jobAllocationCode); jobAllocatonCode.PendingStatus = joba.PendingStatus; jobAllocatonCode.SuccessStatus = joba.SuccessStatus; jobAllocatonCode.CancelStatus = joba.CancelStatus; jobAllocatonCode.UpdateRemark = joba.UpdateRemark; _context.SaveChanges(); return(1); }
protected void btnProcess_Click(object sender, EventArgs e) { List <HRM_JobAllocation> jobAllocationes = new List <HRM_JobAllocation>(); try { TimeSpan jobAllocationTime = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtbxTime.Hour, txtbxTime.Minute, txtbxTime.Second)); for (int i = 0; i < grdviewsseletedEmployee.Rows.Count; i++) { HRM_JobAllocation joba = new HRM_JobAllocation(); Label lblRegion = (Label)grdviewsseletedEmployee.Rows[i].FindControl("lblResion"); Label lblOffice = (Label)grdviewsseletedEmployee.Rows[i].FindControl("lblOfficeId"); Label lblDepartment = (Label)grdviewsseletedEmployee.Rows[i].FindControl("lblDepartmentId"); joba.RegionID = Convert.ToInt32(lblRegion.Text); joba.OfficeID = Convert.ToInt32(lblOffice.Text); joba.DepartmentID = Convert.ToInt32(lblDepartment.Text); joba.EID = grdviewsseletedEmployee.Rows[i].Cells[4].Text; joba.JobAllocationCode = lblJobAllocationCode.Text; joba.ClientID = Convert.ToInt32(drpClient.SelectedValue); joba.Region = txtbxRegion.Text; joba.Remark = txtbxRemark.Text; joba.RequestFrom = txtbxRequestFrom.Text; joba.JobAllocationTime = jobAllocationTime; joba.JobAllocatonDate = Convert.ToDateTime(txtboxDate.Text); joba.OCODE = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode); joba.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; joba.EDIT_DATE = DateTime.Now; //if (drpStatus.SelectedItem.ToString() == "Yes") //{ // joba.Status = true; //} //else //{ // joba.Status = false; //} jobAllocationes.Add(joba); } int result = jobAllocationDal.SaveJobAllocation(jobAllocationes); if (result == 1) { // lblMessage.Text = "Data Save Successfully."; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save Successfully')", true); string Ocode = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode); string jobAllocationCode = lblJobAllocationCode.Text; List <RJobAllocation> jobAlles = new List <RJobAllocation>(); jobAlles = jobAllocationDal.GetJobAllocationAssignList(Ocode, jobAllocationCode); if (jobAlles.Count > 0) { GetJobAllocationCode(); Session["rptDs"] = "ds_jobAllocaion"; Session["rptDt"] = jobAlles; Session["rptFile"] = "/HRM/reports/HRM_JobAllocation.rdlc"; Session["rptTitle"] = "Job Allocation"; Response.Redirect("Report_Viewer.aspx"); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }