private static GenericValidator ValidateControl(LeaseType model) { var gVal = new GenericValidator(); try { if (string.IsNullOrEmpty(model.Name.Trim())) { gVal.Error = "Please enter Lease Type Name."; gVal.Code = 0; return(gVal); } //if (string.IsNullOrEmpty(model.Description.Trim())) //{ // gVal.Error = "Please provide Incident Description."; // gVal.Code = 0; // return gVal; //} gVal.Code = 1; return(gVal); } catch (Exception) { gVal.Error = "Process validation failed. Please supply all required fields and try again."; gVal.Code = 0; return(gVal); } }
internal Lease(BinaryReader bR) { switch (bR.ReadByte()) { case 1: _type = (LeaseType)bR.ReadByte(); _clientIdentifier = DhcpOption.Parse(bR.BaseStream) as ClientIdentifierOption; _clientIdentifier.ParseOptionValue(); _hostName = bR.ReadShortString(); if (_hostName == "") { _hostName = null; } _hardwareAddress = bR.ReadBuffer(); _address = IPAddressExtension.Parse(bR); _leaseObtained = bR.ReadDate(); _leaseExpires = bR.ReadDate(); break; default: throw new InvalidDataException("Lease data format version not supported."); } }
public int AddLeaseTypeCheckDuplicate(LeaseType leaseType) { try { if (leaseType == null) { return(-2); } using (var db = new DPRDataMigrationEngineDBEntities()) { if (db.LeaseTypes.Any()) { if (db.LeaseTypes.Count(m => m.Name.ToLower().Replace(" ", string.Empty) == leaseType.Name.ToLower().Replace(" ", string.Empty)) > 0) { return(-3); } } var processedItem = db.LeaseTypes.Add(leaseType); db.SaveChanges(); return(processedItem.LeaseTypeId); } } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public int GetLeaseTypeIdByName(string leaseTypeName) { try { using (var db = new DPRDataMigrationEngineDBEntities()) { var myObj = db.LeaseTypes.Where(s => s.Name.Trim().ToLower().Replace(" ", "") == leaseTypeName.Trim().ToLower().Replace(" ", "")).ToList(); if (!myObj.Any()) { var newLeaseType = new LeaseType { Name = leaseTypeName }; var processedLeaseType = db.LeaseTypes.Add(newLeaseType); db.SaveChanges(); return(processedLeaseType.LeaseTypeId); } return(myObj[0].LeaseTypeId); } } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); return(0); } }
private IEnumerator <IAsyncResult> AcquireLeaseImpl(LeaseType leaseType, TimeSpan leaseDuration, Guid?proposedLeaseId, IContainerCondition condition, bool updateLastModificationTime, bool useContainerNotFoundError, AsyncIteratorContext <NoResults> context) { IAsyncResult asyncResult; try { asyncResult = this.InternalContainer.BeginAcquireLease(leaseType, leaseDuration, proposedLeaseId, Helpers.Convert(condition), updateLastModificationTime, useContainerNotFoundError, context.GetResumeCallback(), context.GetResumeState("BaseBlobContainer.AcquireLeaseImpl")); } catch (Exception exception) { StorageStamp.TranslateException(exception); throw; } yield return(asyncResult); try { this.InternalContainer.EndAcquireLease(asyncResult); } catch (Exception exception1) { StorageStamp.TranslateException(exception1); throw; } }
public int UpdateLeaseTypeCheckDuplicate(LeaseType leaseType) { try { if (leaseType == null) { return(-2); } using (var db = new DPRDataMigrationEngineDBEntities()) { if (db.LeaseTypes.Any()) { if (db.LeaseTypes.Count(m => m.Name.ToLower().Replace(" ", string.Empty) == leaseType.Name.ToLower().Replace(" ", string.Empty) && m.LeaseTypeId != leaseType.LeaseTypeId) > 0) { return(-3); } } db.LeaseTypes.Attach(leaseType); db.Entry(leaseType).State = EntityState.Modified; return(db.SaveChanges()); } } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); return(0); } }
private IEnumerator <IAsyncResult> RenewLeaseImpl(LeaseType leaseType, Guid leaseId, TimeSpan leaseDuration, IBlobObjectCondition condition, AsyncIteratorContext <NoResults> context) { IAsyncResult asyncResult; try { asyncResult = this.blob.BeginRenewLease(leaseType, leaseId, leaseDuration, Helpers.Convert(condition), context.GetResumeCallback(), context.GetResumeState("BaseBlobObject.RenewLeaseImpl")); } catch (Exception exception) { StorageStamp.TranslateException(exception); throw; } yield return(asyncResult); try { this.blob.EndRenewLease(asyncResult); } catch (Exception exception1) { StorageStamp.TranslateException(exception1); throw; } }
public IAsyncResult BeginAcquireLease(LeaseType leaseType, TimeSpan leaseDuration, Guid?proposedLeaseId, IContainerCondition condition, bool updateLastModificationTime, bool useContainerNotFoundError, AsyncCallback callback, object state) { AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("BaseBlobContainer.AcquireLease", callback, state); asyncIteratorContext.Begin(this.AcquireLeaseImpl(leaseType, leaseDuration, proposedLeaseId, condition, updateLastModificationTime, useContainerNotFoundError, asyncIteratorContext)); return(asyncIteratorContext); }
public IAsyncResult BeginRenewLease(LeaseType leaseType, Guid leaseId, TimeSpan leaseDuration, IBlobObjectCondition condition, AsyncCallback callback, object state) { AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("RealBlobObject.RenewLease", callback, state); asyncIteratorContext.Begin(this.RenewLeaseImpl(leaseType, leaseId, leaseDuration, condition, asyncIteratorContext)); return(asyncIteratorContext); }
private void LeaseTypeComboBox_SelectionChangedHandler(object sender, SelectionChangedEventArgs e) { FrameworkElement selectedItem = LeaseTypeComboBox.SelectedItem as FrameworkElement; LeaseTypeComboBox.ToolTip = selectedItem?.ToolTip ?? "Unknown Selection"; string data = selectedItem?.DataContext as string; LeaseType previousLeaseType = Settings.LeaseType; switch (data) { case nameof(LeaseType.CloudSqlStorage): Settings.LeaseType = LeaseType.CloudSqlStorage; break; case nameof(LeaseType.LocalDiskStorage): Settings.LeaseType = LeaseType.LocalDiskStorage; break; default: Settings.LeaseType = LeaseType.AzureStorageAccount; break; } if (previousLeaseType != Settings.LeaseType) { RestartReaders(); } }
public static IList <LeaseType> GetLeaseTypes() { DataGateWay access = new DataGateWay(connectionName); IList <LeaseType> Types = new List <LeaseType>(); string sql = @"use InlandMarina SELECT * FROM LeaseType"; LeaseType type = null; try { using (var reader = access.ExecuteQuery(sql, null, CommandType.Text)) { while (reader.Read()) { type = new LeaseType() { ID = reader.GetInt32(reader.GetOrdinal("ID")), Name = reader.GetString(reader.GetOrdinal("Name")), StandardRateAmount = reader.GetDecimal(reader.GetOrdinal("StandardRateAmount")) }; Types.Add(type); } } } catch (Exception ex) { throw new Exception("Error retrieving data from database !", ex); } return(Types); }
public ActionResult DeleteLeaseType(int id) { var incidentType = new LeaseType(); try { if (id < 1) { incidentType.Error = "Invalid Selection"; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } if (new LeaseTypeServices().DeleteLeaseTypeCheckReferences(id)) { incidentType.Error = "Lease Type Information was successfully deleted."; incidentType.ErrorCode = 1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } incidentType.Error = "Process Failed! Please try again later"; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); incidentType.Error = "An unknown error was encountered. Please contact the Administrator or try again later."; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditLeaseType(int id) { var incidentType = new LeaseType(); try { if (id < 1) { incidentType.Error = "Invalid Selection!"; incidentType.ErrorCode = -1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } var myViewObj = new LeaseTypeServices().GetLeaseType(id); if (myViewObj == null || myViewObj.LeaseTypeId < 1) { incidentType.Error = "Lease Type Information could not be retrieved."; incidentType.ErrorCode = -1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } Session["_product"] = myViewObj; myViewObj.ErrorCode = myViewObj.LeaseTypeId; return(Json(myViewObj, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); incidentType.Error = "An unknown error was LeaseType Information could not be retrieved."; incidentType.ErrorCode = -1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } }
private void SetLeaseState() { switch (this.m_container.LeaseState) { case 0: { this.m_LeaseState = new LeaseState?(LeaseState.Available); this.m_LeaseType = LeaseType.None; return; } case 1: { if (this.m_container.LeaseEndTime.Value <= this.m_InfoValidAt) { this.m_LeaseState = new LeaseState?(LeaseState.Expired); this.m_LeaseType = LeaseType.None; return; } this.m_LeaseState = new LeaseState?(LeaseState.Leased); this.m_LeaseType = LeaseType.ReadWrite; return; } case 2: { this.m_LeaseState = new LeaseState?(LeaseState.Expired); this.m_LeaseType = LeaseType.None; return; } case 3: { if (this.m_container.LeaseEndTime.Value <= this.m_InfoValidAt) { this.m_LeaseState = new LeaseState?(LeaseState.Broken); this.m_LeaseType = LeaseType.None; return; } this.m_LeaseState = new LeaseState?(LeaseState.Breaking); this.m_LeaseType = LeaseType.ReadWrite; return; } case 4: { this.m_LeaseState = new LeaseState?(LeaseState.Broken); this.m_LeaseType = LeaseType.None; return; } default: { return; } } }
internal Lease(LeaseType type, ClientIdentifierOption clientIdentifier, string hostName, byte[] hardwareAddress, IPAddress address, uint leaseTime) { _type = type; _clientIdentifier = clientIdentifier; _hostName = hostName; _hardwareAddress = hardwareAddress; _address = address; _leaseObtained = DateTime.UtcNow; ExtendLease(leaseTime); }
public ActionResult AddLeaseType(LeaseType leaseType) { ModelState.Clear(); ViewBag.LoadStatus = "0"; try { if (!ModelState.IsValid) { leaseType.Error = "Please supply all required fields and try again"; leaseType.ErrorCode = -1; return(Json(leaseType, JsonRequestBehavior.AllowGet)); } var wx = ValidateControl(leaseType); if (wx.Code < 1) { leaseType.Error = wx.Error; leaseType.ErrorCode = -1; return(Json(leaseType, JsonRequestBehavior.AllowGet)); } leaseType.Name = leaseType.Name; var k = new LeaseTypeServices().AddLeaseTypeCheckDuplicate(leaseType); if (k < 1) { if (k == -3) { leaseType.Error = "Lease Type already exists"; leaseType.ErrorCode = -3; return(Json(leaseType, JsonRequestBehavior.AllowGet)); } leaseType.Error = "Process Failed! Please contact the Admin or try again later"; leaseType.ErrorCode = 0; return(Json(leaseType, JsonRequestBehavior.AllowGet)); } leaseType.Error = "Record was added successfully"; leaseType.ErrorCode = 1; leaseType.LeaseTypeId = k; return(Json(leaseType, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); leaseType.Error = "An unknown error was encountered. Request could not be serviced. Please try again later."; leaseType.ErrorCode = 0; return(Json(leaseType, JsonRequestBehavior.AllowGet)); } }
public Room AddRoom( int advertId, string title, string description, RoomType roomType, IEnumerable <string> urls, LeaseType leaseType, decimal rentalFee) { var advert = Load(advertId); var room = advert.House.AddRoom(title, description, roomType, leaseType, rentalFee); foreach (var url in urls) { room.AddRoomImage(url); } return(room); }
private IEnumerator <IAsyncResult> RenewLeaseImpl(LeaseType leaseType, Guid leaseId, TimeSpan leaseDuration, IContainerCondition condition, bool updateLastModificationTime, AsyncIteratorContext <NoResults> context) { // // Current member / type: System.Collections.Generic.IEnumerator`1<System.IAsyncResult> Microsoft.WindowsAzure.DevelopmentStorage.Store.DbBlobContainer::RenewLeaseImpl(Microsoft.Cis.Services.Nephos.Common.Storage.LeaseType,System.Guid,System.TimeSpan,Microsoft.Cis.Services.Nephos.Common.Storage.IContainerCondition,System.Boolean,AsyncHelper.AsyncIteratorContext`1<AsyncHelper.NoResults>) // File path: C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\Microsoft.Azure.DevelopmentStorage.Store.dll // // Product version: 2017.3.1005.3 // Exception in: System.Collections.Generic.IEnumerator<System.IAsyncResult> RenewLeaseImpl(Microsoft.Cis.Services.Nephos.Common.Storage.LeaseType,System.Guid,System.TimeSpan,Microsoft.Cis.Services.Nephos.Common.Storage.IContainerCondition,System.Boolean,AsyncHelper.AsyncIteratorContext<AsyncHelper.NoResults>) // // The given key was not present in the dictionary. // at System.Collections.Generic.Dictionary`2.get_Item(TKey key) // at ..() in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\GotoElimination\GotoCancelation.cs:line 61 // at ..() in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\GotoElimination\GotoCancelation.cs:line 35 // at ..(DecompilationContext , ) in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\GotoElimination\GotoCancelation.cs:line 26 // at ..(MethodBody , , ILanguage ) in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 88 // at ..(MethodBody , ILanguage ) in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 70 // at Telerik.JustDecompiler.Decompiler.Extensions.( , ILanguage , MethodBody , DecompilationContext& ) in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 95 // at Telerik.JustDecompiler.Decompiler.Extensions.(MethodBody , ILanguage , DecompilationContext& , ) in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 58 // at ..(ILanguage , MethodDefinition , ) in C:\Builds\556\Behemoth\ReleaseBranch Production Build NT\Sources\OpenSource\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 117 // // mailto: [email protected] }
internal Lease(BinaryReader bR) { byte version = bR.ReadByte(); switch (version) { case 1: case 2: _type = (LeaseType)bR.ReadByte(); _clientIdentifier = DhcpOption.Parse(bR.BaseStream) as ClientIdentifierOption; _clientIdentifier.ParseOptionValue(); _hostName = bR.ReadShortString(); if (string.IsNullOrWhiteSpace(_hostName)) { _hostName = null; } _hardwareAddress = bR.ReadBuffer(); _address = IPAddressExtension.Parse(bR); if (version >= 2) { _comments = bR.ReadShortString(); if (string.IsNullOrWhiteSpace(_comments)) { _comments = null; } } _leaseObtained = bR.ReadDateTime(); _leaseExpires = bR.ReadDateTime(); break; default: throw new InvalidDataException("Lease data format version not supported."); } }
public abstract IAsyncResult BeginAcquireBlobLease(IAccountIdentifier identifier, string account, string container, string blob, LeaseType leaseType, TimeSpan leaseDuration, Guid?proposedLeaseId, BlobObjectCondition condition, TimeSpan timeout, RequestContext requestContext, AsyncCallback callback, object state);
internal Lease(LeaseType type, string hostName, DhcpMessageHardwareAddressType hardwareAddressType, string hardwareAddress, IPAddress address, string comments) : this(type, hostName, hardwareAddressType, ParseHardwareAddress(hardwareAddress), address, comments) { }
internal Lease(LeaseType type, string hostName, DhcpMessageHardwareAddressType hardwareAddressType, byte[] hardwareAddress, IPAddress address, string comments) : this(type, new ClientIdentifierOption((byte)hardwareAddressType, hardwareAddress), hostName, hardwareAddress, address, comments, 0) { }
IAsyncResult Microsoft.Cis.Services.Nephos.Common.Storage.IBaseBlobContainer.BeginRenewLease(LeaseType leaseType, Guid leaseId, TimeSpan leaseDuration, IContainerCondition condition, bool updateLastModificationTime, bool useContainerNotFoundError, AsyncCallback callback, object state) { AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("DbBlobContainer.RenewLease", callback, state); asyncIteratorContext.Begin(this.RenewLeaseImpl(leaseType, leaseId, leaseDuration, condition, updateLastModificationTime, asyncIteratorContext)); return(asyncIteratorContext); }
internal void ConvertToReserved() { _type = LeaseType.Reserved; }
internal void ConvertToDynamic() { _type = LeaseType.Dynamic; }
internal Lease(LeaseType type, string hostName, byte[] hardwareAddress, IPAddress address) : this(type, new ClientIdentifierOption(1, hardwareAddress), hostName, hardwareAddress, address, 0) { }
public ActionResult EditLeaseType(LeaseType incidentType) { ModelState.Clear(); ViewBag.LoadStatus = "0"; try { if (Session["_product"] == null) { incidentType.Error = "Session has expired"; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } var oldLeaseType = Session["_product"] as LeaseType; if (oldLeaseType == null || oldLeaseType.LeaseTypeId < 1) { incidentType.Error = "Session has expired"; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } if (!ModelState.IsValid) { incidentType.Error = "Please supply all required fields and try again"; incidentType.ErrorCode = -1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } var wx = ValidateControl(incidentType); if (wx.Code < 1) { incidentType.Error = wx.Error; incidentType.ErrorCode = -1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } oldLeaseType.Name = incidentType.Name.Trim(); oldLeaseType.Description = incidentType.Description.Trim(); var k = new LeaseTypeServices().UpdateLeaseTypeCheckDuplicate(oldLeaseType); if (k < 1) { if (k == -3) { incidentType.Error = "Lease Type already exists"; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } incidentType.Error = "Process Failed! Please contact the Admin or try again later"; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } incidentType.Error = "Lease Type Information was successfully updated"; incidentType.ErrorCode = 1; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); incidentType.Error = "An unknown error was encountered. Request could not be serviced. Please try again later."; incidentType.ErrorCode = 0; return(Json(incidentType, JsonRequestBehavior.AllowGet)); } }
internal Lease(LeaseType type, string hostName, string hardwareAddress, IPAddress address) : this(type, hostName, ParseHardwareAddress(hardwareAddress), address) { }
public abstract IAsyncResult BeginRenewContainerLease(IAccountIdentifier identifier, string account, string container, LeaseType leaseType, Guid leaseId, TimeSpan leaseDuration, ContainerCondition condition, TimeSpan timeout, RequestContext requestContext, AsyncCallback callback, object state);