// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// DeleteDirect /// </summary> /// <param name="viewId">viewId</param> /// <param name="companyId">companyId</param> public void DeleteDirect(int viewId, int companyId) { WorkViewDisplay workViewDisplay = new WorkViewDisplay(null); workViewDisplay.DeleteDirect(viewId, companyId); WorkViewCondition workViewCondition = new WorkViewCondition(null); workViewCondition.DeleteDirect(viewId, companyId); WorkViewSort workViewSort = new WorkViewSort(null); workViewSort.DeleteDirect(viewId, companyId); WorkViewGateway workViewGateway = new WorkViewGateway(null); workViewGateway.Delete(viewId, companyId); }
/// <summary> /// SaveForEdit /// </summary> /// <param name="viewId"></param> /// <param name="companyId"></param> /// <param name="workType"></param> public void SaveForEdit(int viewId, int companyId, string workType) { foreach (WorkViewTDS.WorkViewConditionNewRow rowNew in (WorkViewTDS.WorkViewConditionNewDataTable)Data.Tables["WorkViewConditionNew"]) { WorkViewCondition workViewCondition = new WorkViewCondition(null); if (!rowNew.Deleted && !rowNew.InDatabase) { WorkViewConditionGateway workViewConditionGateway = new WorkViewConditionGateway(null); int refId = workViewConditionGateway.GetLastRefIdByViewIdWorkTypeConditionId(viewId, companyId, workType, rowNew.ConditionID); refId = refId + 1; workViewCondition.InsertDirect(viewId, companyId, workType, rowNew.ConditionID, refId, rowNew.Operator, rowNew.ConditionNumber, rowNew.Value_, rowNew.Deleted); } if (!rowNew.Deleted && rowNew.InDatabase) { WorkViewConditionGateway workViewConditionGateway = new WorkViewConditionGateway(); workViewConditionGateway.LoadAllByViewIdWorkTypeConditionIdRefId(viewId, companyId, workType, rowNew.ConditionID, rowNew.RefID); int originalViewId = viewId; int originalCompanyId = companyId; string originalWorkType = workType; int originalConditionId = rowNew.ConditionID; int originalRefId = rowNew.RefID; //workViewConditionGateway.GetRefId(viewId, workType, companyId, rowNew.ConditionID, rowNew.RefID); string originalOperator_ = workViewConditionGateway.GetOperator(viewId, workType, companyId, rowNew.ConditionID, rowNew.RefID); int originalConditionNumber = workViewConditionGateway.GetConditionNumber(viewId, workType, companyId, rowNew.ConditionID, rowNew.RefID); string originalValue_ = workViewConditionGateway.GetValue_(viewId, workType, companyId, rowNew.ConditionID, rowNew.RefID); bool originalDeleted = workViewConditionGateway.GetDeleted(viewId, workType, companyId, rowNew.ConditionID, rowNew.RefID); workViewCondition.UpdateDirect(originalViewId, originalWorkType, originalCompanyId, originalConditionId, originalRefId, originalOperator_, originalConditionNumber, originalValue_, originalDeleted, viewId, workType, companyId, rowNew.ConditionID, rowNew.RefID, rowNew.Operator, rowNew.ConditionNumber, rowNew.Value_, rowNew.Deleted); } if (rowNew.Deleted && rowNew.InDatabase) { workViewCondition.DeleteDirectForEditView(viewId, companyId, workType, rowNew.ConditionID, rowNew.RefID); } } }
/// <summary> /// Save /// </summary> /// <param name="viewId"></param> /// <param name="companyId"></param> /// <param name="workType"></param> public void Save(int viewId, int companyId, string workType) { foreach (WorkViewTDS.WorkViewConditionNewRow rowNew in (WorkViewTDS.WorkViewConditionNewDataTable)Data.Tables["WorkViewConditionNew"]) { if (!rowNew.Deleted) { WorkViewCondition workViewCondition = new WorkViewCondition(null); workViewCondition.InsertDirect(viewId, companyId, workType, rowNew.ConditionID, rowNew.RefID, rowNew.Operator, rowNew.ConditionNumber, rowNew.Value_, rowNew.Deleted); } } }