private void LoadQuickViewInfo(string employeeId, DateTime?startDate = null) { EmployeeQuickViewRecordRequest r = new EmployeeQuickViewRecordRequest(); r.RecordID = employeeId; r.asOfDate = startDate == null ? DateTime.Now : (DateTime)startDate; RecordResponse <EmployeeQuickView> resp = _employeeService.ChildGetRecord <EmployeeQuickView>(r); if (!resp.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(resp); return; } leaveBalance.Text = resp.result.leaveBalance.ToString(); yearsInService.Text = resp.result.serviceDuration; }
protected void fillEmployeeInfo(object sender, DirectEventArgs e) { string employeeId = e.ExtraParams["employeeId"]; if (string.IsNullOrEmpty(employeeId)) { return; } EmployeeQuickViewRecordRequest req = new EmployeeQuickViewRecordRequest(); req.RecordID = employeeId; req.asOfDate = DateTime.Now; RecordResponse <EmployeeQuickView> resp = _employeeService.ChildGetRecord <EmployeeQuickView>(req); if (!resp.Success) { Common.errorMessage(resp); return; } branchId.Select(resp.result.branchId); departmentId.Select(resp.result.departmentId); }
public object GetQuickView(Dictionary <string, string> parameters) { try { EmployeeTerminationRecordRequest caRequest = new EmployeeTerminationRecordRequest(); caRequest.employeeId = parameters["id"]; RecordResponse <EmployeeTermination> response = _employeeService.ChildGetRecord <EmployeeTermination>(caRequest); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return(null); } EmployeeQuickViewRecordRequest req = new EmployeeQuickViewRecordRequest(); req.RecordID = parameters["id"]; if (response.result != null) { req.asOfDate = response.result.date ?? DateTime.Now; } else { req.asOfDate = DateTime.Now; } RecordResponse <EmployeeQuickView> qv = _employeeService.ChildGetRecord <EmployeeQuickView>(req); if (!qv.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", qv.ErrorCode) != null ? GetGlobalResourceObject("Errors", qv.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + qv.LogId : qv.Summary).Show(); return(null); } if (qv.result.terminationDate != null) { qv.result.statusString = GetLocalResourceObject("EmployeeStatus3").ToString(); } else { qv.result.statusString = GetLocalResourceObject("EmployeeStatus1").ToString(); } return(new { reportsTo = qv.result.reportToName != null? qv.result.reportToName:"", indemnity = qv.result.indemnity, salary = qv.result.salary, leavesBalance = qv.result.leaveBalance, serviceDuration = qv.result.serviceDuration, earnedLeaves = qv.result.earnedLeaves, usedLeaves = qv.result.usedLeaves, paidLeaves = qv.result.paidLeaves, earnedLeavesLeg = qv.result.earnedLeavesLeg, usedLeavesLeg = qv.result.usedLeavesLeg, lastLeave = qv.result.LastLeave(_systemService.SessionHelper.GetDateformat()), status = qv.result.statusString, loansBalance = qv.result.loanBalance, leavePayments = qv.result.leavePayments }); } catch (Exception exp) { if (exp != null) { X.Msg.Alert(Resources.Common.Error, exp.Message).Show(); } return(null); } }
private LeavePaymentsReport GetReport() { if (String.IsNullOrEmpty(currentLeavePayment.Text)) { return(new LeavePaymentsReport()); } RecordRequest r = new RecordRequest(); r.RecordID = currentLeavePayment.Text; RecordResponse <LeavePayment> response = _payrollService.ChildGetRecord <LeavePayment>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return(null); } EmployeeQuickViewRecordRequest req = new EmployeeQuickViewRecordRequest(); req.RecordID = response.result.employeeId.ToString(); req.asOfDate = response.result.effectiveDate; RecordResponse <EmployeeQuickView> routers = _employeeService.ChildGetRecord <EmployeeQuickView>(req); if (!routers.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", routers.ErrorCode) != null ? GetGlobalResourceObject("Errors", routers.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + routers.LogId: routers.Summary).Show(); return(null); } response.result.dateString = response.result.date.ToString(_systemService.SessionHelper.GetDateformat()); response.result.effectiveDateString = response.result.effectiveDate.ToString(_systemService.SessionHelper.GetDateformat()); List <LeavePayment> l = new List <LeavePayment>(); l.Add(response.result); LeavePaymentsReport p = new LeavePaymentsReport(); p.DataSource = l; p.Parameters["leaveBalance"].Value = routers.result.leaveBalance; p.Parameters["hireDate"].Value = routers.result.hireDate.Value.ToString(_systemService.SessionHelper.GetDateformat()); p.Parameters["serviceDuration"].Value = routers.result.serviceDuration; p.Parameters["departmentName"].Value = routers.result.departmentName; p.Parameters["positionName"].Value = routers.result.positionName; p.Parameters["branchName"].Value = routers.result.branchName; p.Parameters["countryName"].Value = routers.result.countryName; if (routers.result.lastLeaveStartDate != null) { p.Parameters["lastLeaveStartDate"].Value = routers.result.lastLeaveStartDate.Value.ToString(_systemService.SessionHelper.GetDateformat()); } ; if (routers.result.lastLeaveEndDate != null) { p.Parameters["lastLeaveEndDate"].Value = routers.result.lastLeaveEndDate.Value.ToString(_systemService.SessionHelper.GetDateformat()); } ; p.Parameters["User"].Value = _systemService.SessionHelper.GetCurrentUser(); p.RightToLeft = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeft.Yes : DevExpress.XtraReports.UI.RightToLeft.No; p.RightToLeftLayout = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeftLayout.Yes : DevExpress.XtraReports.UI.RightToLeftLayout.No; return(p); }
//public object ValidateSave(bool isPhantom, string obj, JsonObject values) //{ // if (!values.ContainsKey("comment")) // { // return new { valid = false, msg = "Error in call" }; // } // PostRequest<LoanComment> req = new PostRequest<LoanComment>(); // LoanComment note = JsonConvert.DeserializeObject<List<LoanComment>>(obj)[0]; // //note.recordId = id; // note.loanId = Convert.ToInt32(currentCase.Text); // note.comment = values["comment"].ToString(); // int bulk; // req.entity = note; // PostResponse<LoanComment> resp = _loanService.ChildAddOrUpdate<LoanComment>(req); // if (!resp.Success) // { // Common.errorMessage(resp); // return new { valid = false }; // } // return new { valid = true }; protected void FillEmployeeInfo(object sender, DirectEventArgs e) { try { string effectiveDate = e.ExtraParams["effectiveDate"]; string employeeId = e.ExtraParams["employeeId"]; if (string.IsNullOrEmpty(employeeId)) { return; } if (!string.IsNullOrEmpty(effectiveDate)) { EmployeeQuickViewRecordRequest req = new EmployeeQuickViewRecordRequest(); req.RecordID = employeeId; req.asOfDate = Convert.ToDateTime(effectiveDate); RecordResponse <EmployeeQuickView> routers = _employeeService.ChildGetRecord <EmployeeQuickView>(req); if (!routers.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, routers.Summary).Show(); } //RecordRequest req = new RecordRequest(); //req.RecordID = employeeId.Value.ToString(); //RecordResponse<Employee> routers = _employeeService.Get<Employee>(req); //if (!routers.Success) //{ // Common.errorMessage(routers); // return; //} //this.setFillEmployeeInfoDisable(false); if (routers.result == null) { return; } branchNameTx.Text = routers.result.branchName; departmentNameTx.Text = routers.result.departmentName; positionNameTx.Text = routers.result.positionName; hireDateDf.Value = routers.result.hireDate; nationalityTx.Text = routers.result.countryName; if (updateLeaveBalance.Text == "false") { earnedLeaves.Text = routers.result.earnedLeaves.ToString(); leaveBalance.Text = routers.result.leaveBalance.ToString(); } usedLeaves.Text = routers.result.usedLeaves.ToString(); leavePayments.Text = routers.result.leavePayments.ToString(); lastLeaveStartDate.Value = routers.result.lastLeaveStartDate; lastLeaveEndDate.Value = routers.result.lastLeaveEndDate; salary.Text = routers.result.salary.ToString(); //days.Text = "0"; serviceDuration.Text = routers.result.serviceDuration; updateLeaveBalance.Text = "false"; } } catch (Exception exp) { X.MessageBox.Alert(GetGlobalResourceObject("Common", "Error").ToString(), exp.Message); } }
protected void PoPuP(object sender, DirectEventArgs e) { string id = e.ExtraParams["id"]; string type = e.ExtraParams["type"]; currentLeavePayment.Text = id; switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id; RecordResponse <LeavePayment> response = _payrollService.ChildGetRecord <LeavePayment>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return; } //employeeId.SuspendEvent("Change"); employeeId.GetStore().Add(new object[] { new { recordId = response.result.employeeId, fullName = response.result.employeeName } }); employeeId.SetValue(response.result.employeeId); //employeeId.ResumeEvent("Change"); //effectiveDate.SuspendEvent("Change"); effectiveDate.SetValue(response.result.effectiveDate); //effectiveDate.ResumeEvent("Change"); leaveBalance.Text = response.result.leaveBalance.ToString(); this.BasicInfoTab.SetValues(response.result); updateLeaveBalance.Text = "true"; EmployeeQuickViewRecordRequest qvReq = new EmployeeQuickViewRecordRequest(); qvReq.RecordID = response.result.employeeId.ToString();; qvReq.asOfDate = response.result.effectiveDate; RecordResponse <EmployeeQuickView> qvResp = _employeeService.ChildGetRecord <EmployeeQuickView>(qvReq); if (!qvResp.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, qvResp.Summary).Show(); } leavePayments.Text = qvResp.result.leavePayments != null?qvResp.result.leavePayments.ToString() : "0"; //if (!response.result.effectiveDate.HasValue) // effectiveDate.SelectedDate = DateTime.Now; this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "colAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void PoPuP(object sender, DirectEventArgs e) { try { BasicInfoTab.Reset(); FillDamageStore(); string id = e.ExtraParams["id"]; int dayId = Convert.ToInt32(e.ExtraParams["dayId"]); int employeeId = Convert.ToInt32(e.ExtraParams["employeeId"]); string damageLavel = e.ExtraParams["damage"]; string durationValue = e.ExtraParams["duration"]; string timeCodeParameter = e.ExtraParams["timeCode"]; string shiftId = e.ExtraParams["shiftId"]; string apStatus = e.ExtraParams["apStatus"]; string type = e.ExtraParams["type"]; string justificationParam = e.ExtraParams["justification"]; string clockDuration = e.ExtraParams["clockDuration"]; string arId = e.ExtraParams["arId"]; switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service //Step 2 : call setvalues with the retrieved object damage.Select(damageLavel); duration.Text = durationValue; clock.Text = clockDuration; // recordId.Text = id; justification.Text = justificationParam; TimeApprovalReasonControl.setApprovalReason(arId); if (apStatus == "2" || apStatus == "-1") { disableEditing(false); } else { disableEditing(true); } recordId.Text = id; this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "imgReject": X.Msg.Confirm(Resources.Common.Confirmation, GetLocalResourceObject("RejectRecord").ToString(), new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.RejectRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "imgAttach": overrideForm.Reset(); RecordRequest req = new RecordRequest(); //req.employeeId = employeeId.ToString(); //req.dayId = dayId.ToString(); //req.shiftId = shiftId; //req.timeCode = timeCodeParameter; req.RecordID = id; RecordResponse <DashBoardTimeVariation> resp = _timeAttendanceService.ChildGetRecord <DashBoardTimeVariation>(req); if (!resp.Success) { Common.errorMessage(resp); return; } ORId.Text = resp.result.recordId; timeCodeStore.DataSource = ConstTimeVariationType.TimeCodeList(_systemService).Where(x => x.key == Convert.ToInt32(timeCodeParameter)).ToList(); timeCodeStore.DataBind(); FillBranch(); EmployeeQuickViewRecordRequest QVReq = new EmployeeQuickViewRecordRequest(); QVReq.RecordID = employeeId.ToString(); QVReq.asOfDate = DateTime.Now; RecordResponse <EmployeeQuickView> qv = _employeeService.ChildGetRecord <EmployeeQuickView>(QVReq); if (!qv.Success) { Common.errorMessage(qv); return; } overrideForm.SetValues(resp.result); branchId.Select(qv.result.branchId); ListRequest UdIdReq = new ListRequest(); UdIdReq.Filter = ""; ListResponse <BiometricDevice> UdIdResp = _timeAttendanceService.ChildGetAll <BiometricDevice>(UdIdReq); if (!UdIdResp.Success) { Common.errorMessage(UdIdResp); return; } udIdStore.DataSource = UdIdResp.Items; udIdStore.DataBind(); FlatPunchesListRequest FPreq = new FlatPunchesListRequest(); FPreq.shiftId = shiftId; FPreq.sortBy = "clockStamp"; FPreq.StartAt = "0"; FPreq.Size = "30"; ListResponse <FlatPunch> FPresp = _timeAttendanceService.ChildGetAll <FlatPunch>(FPreq); if (!FPresp.Success) { Common.errorMessage(FPresp); return; } punchesList.Text = ""; FPresp.Items.ForEach(x => { punchesList.Text += x.clockStamp.ToString(_systemService.SessionHelper.GetDateformat() + " HH:mm", CultureInfo.CurrentUICulture) + System.Environment.NewLine; } ); inOutStore.DataSource = Common.XMLDictionaryList(_systemService, "34"); inOutStore.DataBind(); overrideWindow.Show(); break; case "LinkRender": FillTimeApproval(id); TimeApprovalWindow.Show(); break; case "imgHistory": TimeVariationHistoryControl1.Show("41203", id); break; default: break; } } catch (Exception exp) { X.Msg.Alert(Resources.Common.Error, exp.Message).Show(); } }