private void FillUserSwipes() { IUserSwipeService service = null; try { DateTime fromDate = this.StartDate; DateTime toDate = this.RetrieveCurrentDateTime().AddDays(1); //Validate this.ValidateUserSearch(); // Create the service. service = AppService.Create <IUserSwipeService>(); service.AppManager = this.mAppManager; // Call service method. mSwipeList = service.Retrieve(Int32.Parse(hdnuserid.Value), fromDate, toDate); this.divMessage.InnerText = string.Empty; this.HideCalenderControl(true); //if(this.divMessage.InnerText.Trim()!="") if (Session["ResposeMessage"] != null) { this.divMessage.Style.Add("display", "block"); this.divMessage.InnerText = Session["ResposeMessage"].ToString(); this.Session.Remove("ResposeMessage"); } else { this.divMessage.Style.Add("display", "none"); } } catch (ValidationException ex) { //display the validation Message. StringBuilder message = new StringBuilder("<ul>"); foreach (object value in ex.Data.Values) { message.Append(string.Format("<li>{0}</li>", value.ToString())); } message.Append("</ul>"); this.divMessage.Style.Add("display", "block"); this.divMessage.InnerHtml = message.ToString(); this.HideCalenderControl(false); this.lblChooseEmployeeName.Text = "No Record Found"; } catch { throw; } }
private void FillUserSwipes() { IUserSwipeService service = null; try { DateTime fromDate = StartDate; DateTime toDate = this.RetrieveCurrentDateTime(); // Create the service. service = AppService.Create <IUserSwipeService>(); service.AppManager = this.mAppManager; // Call service method. mSwipeList = service.Retrieve(this.mAppManager.LoginUser.Id, fromDate, toDate); } catch { throw; } }
private void RemoveUserSwipeCheckInOutDetails() { IUserSwipeService service = null; try { // Create the service. service = AppService.Create <IUserSwipeService>(); service.AppManager = this.AppManager; //validate the data. ValidationException validexception = new ValidationException(); if (tbxreason.InnerText.Trim() == "" || string.IsNullOrEmpty(tbxreason.InnerText)) { validexception.Data.Add("USER_SWIPE_REASON", "Reason is a Mandatory Field"); } if (validexception.Data.Count > 0) { //Throw the exception. throw validexception; } //Assing the varibles. DateTime swipeDate = this.UserSwipe.WorkDate; int userId = this.UserSwipe.UserId; int movedUserId = this.AppManager.LoginUser.Id; string movedreason = this.tbxreason.InnerText.ToString(); // Call method. service.RemoveUserSwipeCheckInOutDetailsint(userId, swipeDate, movedUserId, movedreason); } catch { throw; } finally { if (service != null) { service.Dispose(); } } }
private void CheckOut() { IUserSwipeService service = null; try { DateTime checkoutTime; string checkoutDateTime; this.ValidateCheckOutTime(); // Assign values. if (UserType.Equals("Self", StringComparison.InvariantCultureIgnoreCase)) { checkoutDateTime = string.Format("{0} {1}", spnSwipeDate.InnerText.ToString(), txtSwipeTime.Text); checkoutTime = DateTime.Parse(checkoutDateTime); } else { //checkout time checkoutDateTime = string.Format("{0} {1} {2}", txtSwipeDate.Text.ToString(), txtSwipeTime.Text, ddlTimeSpan.SelectedValue); checkoutTime = DateTime.Parse(checkoutDateTime); } //Validate in CheckOutTime this.ValidateCheckOutTime(checkoutTime, this.UserSwipe); this.UserSwipe.CheckOutTime = checkoutTime; //this.UserSwipe.TimeZoneId = Int32.Parse(ddlTimeZoneList.Items[ddlTimeZoneList.SelectedIndex].Value); this.UserSwipe.CreateUserId = this.AppManager.LoginUser.Id; this.UserSwipe.LastUpdateUserId = this.AppManager.LoginUser.Id; this.UserSwipe.Shift = Int32.Parse(this.ddlShift.SelectedItem.Value); this.UserSwipe.Reason = this.tbxreason.InnerText; if (!this.UserSwipe.CustomData.ContainsKey("EditBy")) { this.UserSwipe.CustomData.Add("EditBy", UserType); } // Create the service and invoke method. service = AppService.Create <IUserSwipeService>(); service.AppManager = this.AppManager; // Invoke method. service.CheckIn(this.UserSwipe); //Close the Dialog. this.CloseDialogControl(); } catch (ValidationException ve) { throw ve; } catch { throw; } finally { if (service != null) { service.Dispose(); } } }