private void FillCurrentTime() { this.divmessage.InnerText = string.Empty; this.divmessage.Style.Add("display", "none"); SettingProvider provider = null; try { // Create provider and get data. provider = new SettingProvider(); provider.AppManager = this.AppManager; currentDateTime = provider.GetSystemUtcDateTime(); // Display time in 12 hour format. // Display time span. // Enable/disable based on user type. if (this.UserType.Equals("Self", StringComparison.InvariantCultureIgnoreCase)) { this.txtSwipeTime.Enabled = false; this.spnSwipeDate.InnerHtml = this.UserSwipe.WorkDate.ToString("MM/dd/yyyy"); this.txtSwipeTime.Text = currentDateTime.ToString("hh:mm tt"); this.ddlTimeSpan.Visible = false; this.spnSwipeDate.Visible = true; this.txtSwipeDate.Visible = false; } else { // Allow manager to edit the time span. this.txtSwipeTime.Enabled = true; this.spnSwipeDate.Visible = false; this.txtSwipeDate.Visible = true; this.ddlTimeSpan.Visible = true; this.txtSwipeDate.Text = this.UserSwipe.WorkDate.ToString("MM/dd/yyyy"); this.ddlTimeZoneList.Visible = false; this.LabTimeZone.Visible = true; if (this.UserSwipe.Id == 0) { this.txtSwipeTime.Text = currentDateTime.ToString("hh:mm"); } } } catch { throw; } }
private DateTime RetrieveCurrentDateTime() { SettingProvider provider = null; try { // Create provider and get data. provider = new SettingProvider(); provider.AppManager = this.mAppManager; return(DateTime.Parse(provider.GetSystemUtcDateTime().ToString("MM/dd/yyyy"))); } catch { throw; } finally { if (provider != null) { provider.Dispose(); } } }