/// <summary> /// View model mock. /// </summary> public VehicleRevisionMockViewModel() { DataExpire expire = new DataExpire(); expire.Value = DateTime.Now; RevisionObject list0 = new RevisionObject() { Text = "Revision 1", Expire = expire, DataExpirePath = "Value" }; RevisionObject list1 = new RevisionObject() { Text = "Revision 2", Expire = expire, DataExpirePath = "Value" }; RevisionObject list2 = new RevisionObject() { Text = "Revision 3", Expire = expire, DataExpirePath = "Value" }; _revisionListObject.Add(list0); _revisionListObject.Add(list1); _revisionListObject.Add(list2); }
public bool Remove(RevisionObject revision) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Revision_DELETE", CreateParameter("@revID", SqlDbType.UniqueIdentifier, revision.RevID, ParameterDirection.Input) ); return(true); } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
public void Save(RevisionObject revision) { try { CheckTransaction(); new RevisionDataService(Transaction).Save(revision); if (IsOwner) { Transaction.Commit(); } } catch (Exception exception1) { if (IsOwner) { Transaction.Rollback(); } Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (IsOwner) { Connection.Close(); } } }
private BWebServiceResponse GetRevisionInfo(Action <string> _ErrorMessageAction) { if (!CommonMethods.TryGettingModelInfo( DatabaseService, RequestedModelID, out JObject _, true, out ModelDBEntry Model, out BWebServiceResponse FailureResponse, _ErrorMessageAction)) { return(FailureResponse); } if (!CommonMethods.DoesRevisionExist( Model, RequestedRevisionIndex, out Revision RevisionObject, out int _)) { return(BWebResponse.NotFound("Revision does not exist.")); } RevisionObject.Prune_NonGettableProperties(); return(BWebResponse.StatusOK("Get revision operation has succeeded.", JObject.Parse(JsonConvert.SerializeObject(RevisionObject)))); }
public void Save(RevisionObject revision) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Revision_SAVE", CreateParameter("@revID", SqlDbType.UniqueIdentifier, revision.RevID, ParameterDirection.InputOutput), CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, revision.MaterialCategory == null ? Guid.Empty : revision.MaterialCategory.MatcatID), CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, revision.MaterialType == null ? Guid.Empty : revision.MaterialType.MatTypID), CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, revision.MaterialSubType == null ? Guid.Empty : revision.MaterialSubType.MatStypID), CreateParameter("@Revision", SqlDbType.VarChar, revision.Revision) ); revision.RevID = (Guid)cmd.Parameters["@revID"].Value; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
public static RevisionObject RevisionRowToObject(DataRow Revision) { RevisionObject obj = new RevisionObject(); try { if (Revision != null) { if (RowFunctions.GetValueFromRowToGuid(Revision, RevisionObject.REV_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.RevID = RowFunctions.GetValueFromRowToGuid(Revision, RevisionObject.REV_ID, true, DataRowVersion.Current); obj.MaterialCategory = MaterialCategoryConvertor.MaterialCategoryRowToObject(Revision, ""); obj.MaterialType = MaterialTypeConvertor.MaterialTypeRowToObject(Revision, ""); obj.MaterialSubType = MaterialSubTypeConvertor.MaterialSubTypeRowToObject(Revision, ""); obj.Revision = RowFunctions.GetValueFromRowToString(Revision, RevisionObject.REVISION, false, DataRowVersion.Current); } return obj; } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return obj; }
private void gdvRevision_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e) { try { if (gdvRevision.FocusedRowHandle != DevExpress.XtraGrid.GridControl.AutoFilterRowHandle) { RevisionObject obj = (RevisionObject)gdvRevision.GetRow(gdvRevision.FocusedRowHandle); if (obj != null) { if (MaterialCategoryMember != null) { obj.MaterialCategory = MaterialCategoryMember; } if (MaterialTypeMember != null) { obj.MaterialType = MaterialTypeMember; } if (MaterialSubTypeMember != null) { obj.MaterialSubType = MaterialSubTypeMember; } if (obj.Revision != "") { new BL.Internal.Revision().Save(obj); } } } } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
private void btnRemoveRevision_Click(object sender, EventArgs e) { try { RevisionObject revision = (RevisionObject)gdvRevision.GetRow(gdvRevision.FocusedRowHandle); revision.State = PROF_IT.Common.Enumerations.ObjectState.Deleted; new BL.Internal.Revision().Remove(revision); gdcRevision.DataSource = Revisions.GetActive(); } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
public void Remove(RevisionObject revision) { try { CheckTransaction(); new RevisionDataService(Transaction).Remove(revision); if (IsOwner) Transaction.Commit(); } catch (Exception exception1) { if (IsOwner) Transaction.Rollback(); Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (IsOwner) Connection.Close(); } }
public void Save(RevisionObject revision) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Revision_SAVE", CreateParameter("@revID", SqlDbType.UniqueIdentifier, revision.RevID, ParameterDirection.InputOutput), CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, revision.MaterialCategory == null ? Guid.Empty : revision.MaterialCategory.MatcatID), CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, revision.MaterialType == null ? Guid.Empty : revision.MaterialType.MatTypID), CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, revision.MaterialSubType == null ? Guid.Empty : revision.MaterialSubType.MatStypID), CreateParameter("@Revision", SqlDbType.VarChar, revision.Revision) ); revision.RevID = (Guid)cmd.Parameters["@revID"].Value; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
public bool Remove(RevisionObject revision) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Revision_DELETE", CreateParameter("@revID", SqlDbType.UniqueIdentifier, revision.RevID, ParameterDirection.Input) ); return true; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
private BWebServiceResponse UpdateRevisionInfo(HttpListenerContext _Context, Action <string> _ErrorMessageAction) { if (!CommonMethods.TryParsingRequestFor( _Context, out JObject UpdatedRevisionJson, true, out Revision UpdatedRevision, out BWebServiceResponse FailureResponse, _ErrorMessageAction)) { return(FailureResponse); } if (!CommonMethods.TryGettingModelInfo( DatabaseService, RequestedModelID, out JObject _, true, out ModelDBEntry Model, out FailureResponse, _ErrorMessageAction)) { return(FailureResponse); } if (!CommonMethods.DoesRevisionExist( Model, RequestedRevisionIndex, out Revision RevisionObject, out int _)) { return(BWebResponse.NotFound("Revision does not exist.")); } if (UpdatedRevision.RevisionName != null && UpdatedRevision.RevisionName.Length > 0 && RevisionObject.RevisionName != UpdatedRevision.RevisionName) { //There is a change in the revision name foreach (var CurrentRev in Model.ModelRevisions) { if (CurrentRev.RevisionName.ToUpper() == UpdatedRevision.RevisionName) { return(BWebResponse.Conflict("A revision with same " + Revision.REVISION_NAME_PROPERTY + " already exists.")); } } } RevisionObject.Merge(UpdatedRevisionJson); Model.MRVLastUpdateTime = CommonMethods.GetTimeAsCreationTime(); Controller_DeliveryEnsurer.Get().DB_UpdateItem_FireAndForget( _Context, ModelDBEntry.DBSERVICE_MODELS_TABLE(), ModelDBEntry.KEY_NAME_MODEL_ID, new BPrimitiveType(RequestedModelID), JObject.Parse(JsonConvert.SerializeObject(Model))); Controller_ModelActions.Get().BroadcastModelAction(new Action_ModelRevisionUpdated ( RequestedModelID, RequestedRevisionIndex, Model.ModelOwnerUserID, Model.ModelSharedWithUserIDs, AuthorizedUser.UserID, UpdatedRevisionJson ), _ErrorMessageAction); return(BWebResponse.StatusOK("Revision has been updated.")); }
// Called by RevisionObject when it changes internal void RevisionObjectChanged(RevisionObject Revision) { try { int index = List.IndexOf(Revision); OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void Remove(RevisionObject value) { try { List.Remove(value); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
// Methods. object IBindingList.AddNew() { try { RevisionObject Revision = new RevisionObject(); List.Add(Revision); return Revision; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public int Add(RevisionObject value) { try { return List.Add(value); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }