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(); } } }