protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest && !IsPostBack) { SetExtLanguage(); HideShowButtons(); TimeStore.Reload(); //if (string.IsNullOrEmpty(Request.QueryString["employeeId"])) // X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorOperation).Show(); //CurrentEmployee.Text = Request.QueryString["employeeId"]; DateColumn5.Format = TimedayIdDate.Format = _systemService.SessionHelper.GetDateformat(); if (!string.IsNullOrEmpty(Request.QueryString["_employeeId"]) && !string.IsNullOrEmpty(Request.QueryString["_loanId"])) { var p1 = new Ext.Net.Parameter("id", Request.QueryString["_loanId"]); var p2 = new Ext.Net.Parameter("type", "imgEdit"); var col = new Ext.Net.ParameterCollection(); col.Add(p1); col.Add(p2); // PoPuP(null, new DirectEventArgs(col)); } //try //{ // AccessControlApplier.ApplyAccessControlOnPage(typeof(loanSelfService), BasicInfoTab, GridPanel1, btnAdd, SaveButton); //} //catch (AccessDeniedException exp) //{ // X.MessageBox.ButtonText.Ok = Resources.Common.Ok; // X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied, "closeCurrentTab()").Show(); // Viewport1.Hidden = true; // return; //} //try //{ // AccessControlApplier.ApplyAccessControlOnPage(typeof(LoanComment), null, loanCommentGrid, null, Button1); // ApplyAccessControlOnLoanComments(); //} //catch (AccessDeniedException exp) //{ // caseCommentsTab.Hidden = true; //} //if (purpose.InputType == InputType.Password) //{ // purpose.Visible = false; // purposeField.Visible = true; //} } }
public void Timebatch(string index) { try { string approve = index; string rep_params = vals.Text; TimeAttendanceViewListRequest req = new TimeAttendanceViewListRequest(); req.paramString = rep_params; req.StartAt = "0"; req.Size = "1000"; req.sortBy = "dayId"; ListResponse <TimeSelfService> Times = _selfServiceService.ChildGetAll <TimeSelfService>(req); //DashboardTimeListRequest r = new DashboardTimeListRequest(); //r.dayId = ""; //r.employeeId = 0; //if (!string.IsNullOrEmpty(_systemService.SessionHelper.GetEmployeeId())) // r.approverId = Convert.ToInt32(_systemService.SessionHelper.GetEmployeeId()); //else //{ // TimeStore.DataSource = new List<Time>(); // TimeStore.DataBind(); // return; //} //r.timeCode = timeVariationType.GetTimeCode(); //r.shiftId = "0"; //r.apStatus = "1"; //r.BranchId = req.BranchId; //r.DivisionId = req.DivisionId; //r.PositionId = req.PositionId; //r.DepartmentId = req.DepartmentId; //r.EsId = req.EsId; //r.StartAt = "0"; //r.Size = "50"; //ListResponse<TimeSelfService> Times = _selfServiceService.ChildGetAll<TimeSelfService>(r); if (!Times.Success) { Common.errorMessage(Times); return; } PostRequest <TimeSelfService> request = new PostRequest <TimeSelfService>(); PostResponse <TimeSelfService> resp; Times.Items.ForEach(x => { if (x.status != 2 && x.status != -1) { request.entity = x; if (approve == "true") { request.entity.status = 2; } else { request.entity.status = -1; } resp = _selfServiceService.ChildAddOrUpdate <TimeSelfService>(request); if (!resp.Success) { Common.errorMessage(resp); throw new Exception(); } } }); TimeStore.Reload(); //TimeStore.RemoveAll(); } catch (Exception exp) { if (!string.IsNullOrEmpty(exp.Message)) { X.MessageBox.Alert(Resources.Common.Error, exp.Message).Show(); } } }
protected void SaveTimeRecord(object sender, DirectEventArgs e) { string obj = e.ExtraParams["values"]; string seqNo = e.ExtraParams["seqNo"]; string tvId = e.ExtraParams["tvId"]; Time TI = JsonConvert.DeserializeObject <Time>(obj); try { //New Mode //Step 1 : Fill The object and insert in the store TimeApprovalRecordRequest recReq = new TimeApprovalRecordRequest(); recReq.seqNo = seqNo; //r.timeCode = timeCode; //r.shiftId = shiftId; recReq.tvId = tvId; RecordResponse <TimeSelfService> recResp = _selfServiceService.ChildGetRecord <TimeSelfService>(recReq); if (!recResp.Success) { Common.errorMessage(recResp); return; } PostRequest <TimeSelfService> request = new PostRequest <TimeSelfService>(); request.entity = recResp.result; if (recResp.result == null) { return; } request.entity.status = TI.status; request.entity.notes = TI.notes; PostResponse <TimeSelfService> r = _selfServiceService.ChildAddOrUpdate <TimeSelfService>(request); //check if the insert failed if (!r.Success)//it maybe be another condition { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r);; return; } else { TimeStore.Reload(); Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordSavingSucc }); this.TimeWindow.Close(); } } catch (Exception ex) { //Error exception displaying a messsage box X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show(); } }