public static string ReturnTomorrowDate() { string _TimeValue = GetCurrentClaimValues.GetCurrentUserTimezone(); Thread.CurrentThread.CurrentCulture = new CultureInfo(GetCurrentClaimValues.GetCurrentUserCultureInfo()); DateTime _Now = DateTime.Now.AddDays(1); TimeZoneInfo _TimeZone = TimeZoneInfo.FindSystemTimeZoneById(_TimeValue); string tomorrowDateTime = TimeZoneInfo.ConvertTime(_Now, _TimeZone).ToString(); string[] splitTomorrowDateTime = tomorrowDateTime.Split(' '); string tomorrowDate = splitTomorrowDateTime[0]; return(tomorrowDate); }
public string UploadImage(HttpPostedFileBase imageToUpload) { string imageFullPath = null; string imageName = null; if (imageToUpload == null || imageToUpload.ContentLength == 0) { return(null); } try { CloudStorageAccount cloudStorageAccount = StorageConnectionString.GetConnectionString(); CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); // as usual, depending on where the user came from, container is gonna be different string userEmployer = GetCurrentClaimValues.GetCurrentUserEmployer(); CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference(CommonPaths.ReturnContainerPath() + userEmployer); if (cloudBlobContainer.CreateIfNotExists()) { cloudBlobContainer.SetPermissions( new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob } ); } imageName = Guid.NewGuid().ToString() + "-" + Path.GetExtension(imageToUpload.FileName); Console.WriteLine(imageName); CloudBlockBlob cloudBlockBlob = cloudBlobContainer.GetBlockBlobReference(imageName); cloudBlockBlob.Properties.ContentType = imageToUpload.ContentType; cloudBlockBlob.UploadFromStream(imageToUpload.InputStream); imageFullPath = cloudBlockBlob.Uri.ToString(); // here's where I should put the shit into the database with the respective user Console.WriteLine(imageFullPath); } catch (Exception ex) { return(null); } return(imageName); //return imageFullPath; }
public static string ReturnFormattedDateForCalendarFutureDates(string givenDate) { //string _TimeValue = GetCurrentClaimValues.GetCurrentUserTimezone(); //Thread.CurrentThread.CurrentCulture = new CultureInfo(GetCurrentClaimValues.GetCurrentUserCultureInfo()); //DateTime _givenDate; //DateTime.TryParse(givenDate, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out _givenDate); //TimeZoneInfo _TimeZone = TimeZoneInfo.FindSystemTimeZoneById(_TimeValue); //string convertedDateTime = TimeZoneInfo.ConvertTime(_givenDate, _TimeZone). // ToString(ReturnUserDateFormat(mobile)); string _givenDate = DateTime.Parse(givenDate).ToString(GetCurrentClaimValues.GetCurrentUserDateFormat()); //string[] splitConvertedDateTime = givenDate.Split(' '); //string convertedDate = splitConvertedDateTime[0]; return(_givenDate); }
public static DateTime GetCustomerTimeZones(string connectionString, bool mobile) { if (mobile == false) { string _TimeValue = GetCurrentClaimValues.GetCurrentUserTimezone(); Thread.CurrentThread.CurrentCulture = new CultureInfo(GetCurrentClaimValues.GetCurrentUserCultureInfo()); DateTime _Now = DateTime.Now; TimeZoneInfo _TimeZone = TimeZoneInfo.FindSystemTimeZoneById(_TimeValue); return(TimeZoneInfo.ConvertTime(_Now, _TimeZone)); } else { string _TimeValue = GetNeededTimezone(connectionString); Thread.CurrentThread.CurrentCulture = new CultureInfo(GetNeededCultureInfo(connectionString)); DateTime _Now = DateTime.Now; TimeZoneInfo _TimeZone = TimeZoneInfo.FindSystemTimeZoneById(_TimeValue); return(TimeZoneInfo.ConvertTime(_Now, _TimeZone)); } }
public void DeleteImageFromBlob(string imageFullPath) { try { CloudStorageAccount cloudStorageAccount = StorageConnectionString.GetConnectionString(); CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); // as usual, depending on where the user came from, container is gonna be different string userEmployer = GetCurrentClaimValues.GetCurrentUserEmployer(); CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference(CommonPaths.ReturnContainerPath() + userEmployer); var splitPath = imageFullPath.Split('/'); CloudBlockBlob _blockBlob = cloudBlobContainer.GetBlockBlobReference(splitPath[splitPath.Length - 1]); //delete blob from container _blockBlob.Delete(); } catch (Exception ex) { //Console.WriteLine(ex); return; } }
public static string ReturnUserDateFormat(bool mobile, string hotelName = "") { string dateFormat = string.Empty; if (mobile == false) { dateFormat = GetCurrentClaimValues.GetCurrentUserDateFormat(); } else { string connectionString = CommonManager.ReturnNeededConnectionStringForHotelWithNameSent(hotelName); string sqlGetDateFormat = "SELECT dateFormat FROM tblCommonData"; using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmdToGetDateFormat = new SqlCommand(sqlGetDateFormat, conn); dateFormat = cmdToGetDateFormat.ExecuteScalar().ToString(); } } return(dateFormat); }