// //////////////////////////////////////////////////////////////////////// // 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> public void SaveForEdit() { foreach (WorkViewTDS.WorkViewSortTempRow rowViewSort in (WorkViewTDS.WorkViewSortTempDataTable)Data.Tables["WorkViewSortTemp"]) { WorkViewSort workViewSort = new WorkViewSort(null); if (!rowViewSort.Deleted && !rowViewSort.InDatabase && rowViewSort.Selected) { workViewSort.InsertDirect(rowViewSort.ViewID, rowViewSort.WorkType, rowViewSort.COMPANY_ID, rowViewSort.SortID, rowViewSort.Order_, rowViewSort.Deleted); } if (!rowViewSort.Deleted && rowViewSort.InDatabase && rowViewSort.Selected) { WorkViewSortGateway workViewSortGateway = new WorkViewSortGateway(); workViewSortGateway.LoadAllByViewIdWorkTypeSortId(rowViewSort.ViewID, rowViewSort.WorkType, rowViewSort.COMPANY_ID, rowViewSort.SortID); int originalViewId = rowViewSort.ViewID; string originalWorkType = rowViewSort.WorkType; int originalCompanyId = rowViewSort.COMPANY_ID; int originalSortId = rowViewSort.SortID; int originalOrder = workViewSortGateway.GetOrder(rowViewSort.ViewID, rowViewSort.WorkType, rowViewSort.COMPANY_ID, rowViewSort.SortID); bool originalDeleted = workViewSortGateway.GetDeleted(rowViewSort.ViewID, rowViewSort.WorkType, rowViewSort.COMPANY_ID, rowViewSort.SortID); workViewSort.UpdateDirect(originalViewId, originalWorkType, originalCompanyId, originalSortId, originalOrder, originalDeleted, rowViewSort.ViewID, rowViewSort.WorkType, rowViewSort.COMPANY_ID, rowViewSort.SortID, rowViewSort.Order_, rowViewSort.Deleted); } if (rowViewSort.Deleted && rowViewSort.InDatabase && !rowViewSort.Selected) { workViewSort.DeleteDirectForEditView(rowViewSort.ViewID, rowViewSort.WorkType, rowViewSort.COMPANY_ID, rowViewSort.SortID); } } }
/// <summary> /// Save /// </summary> /// <param name="viewId">viewId</param> /// <param name="workType">workType</param> /// <param name="companyId">companyId</param> public void Save(int viewId, string workType, int companyId) { foreach (WorkViewTDS.WorkViewSortTempRow rowViewSort in (WorkViewTDS.WorkViewSortTempDataTable)Data.Tables["WorkViewSortTemp"]) { WorkViewSort workViewSort = new WorkViewSort(null); workViewSort.InsertDirect(viewId, workType, companyId, rowViewSort.SortID, rowViewSort.Order_, rowViewSort.Deleted); } }
/// <summary> /// ProcessForEdit /// </summary> /// <param name="viewId">viewId</param> /// <param name="workType">workType</param> /// <param name="companyId">companyId</param> public void ProcessForEdit(int viewId, string workType, int companyId) { foreach (WorkViewTDS.LFS_WORK_TYPE_VIEW_SORTRow rowViewSort in (WorkViewTDS.LFS_WORK_TYPE_VIEW_SORTDataTable)Data.Tables["LFS_WORK_TYPE_VIEW_SORT"]) { WorkViewSort workViewSort = new WorkViewSort(); workViewSort.LoadAllByViewIdWorkTypeSortId(viewId, workType, companyId, rowViewSort.SortID); WorkViewSortGateway workViewSortGateway = new WorkViewSortGateway(workViewSort.Data); if (workViewSort.ExistsByViewIDWorkTypeCompanyIdSortId(viewId, workType, companyId, rowViewSort.SortID)) { if (rowViewSort.Selected) { Insert(viewId, workType, companyId, rowViewSort.SortID, rowViewSort.Order_, true, true, false); } else { // delete Insert(viewId, workType, companyId, rowViewSort.SortID, 0, false, true, true); } } else { if (rowViewSort.Selected) { Insert(viewId, workType, companyId, rowViewSort.SortID, rowViewSort.Order_, true, false, false); } } } }
/// <summary> /// UpdateForEdit /// </summary> /// <param name="viewId">viewId</param> /// <param name="workType">workType</param> /// <param name="companyId">companyId</param> public void UpdateForEdit(int viewId, string workType, int companyId) { foreach (WorkViewTDS.LFS_WORK_TYPE_VIEW_SORTRow row in (WorkViewTDS.LFS_WORK_TYPE_VIEW_SORTDataTable)Table) { if ((row.WorkType == workType) && (row.COMPANY_ID == companyId)) { WorkViewSort workViewSort = new WorkViewSort(); workViewSort.LoadByViewIdWorkTypeSortId(viewId, workType, companyId, row.SortID); WorkViewSortGateway workViewSortGateway = new WorkViewSortGateway(workViewSort.Data); if (workViewSort.ExistsByViewIDWorkTypeCompanyIdSortId(viewId, workType, companyId, row.SortID)) { row.Selected = true; row.Order_ = workViewSortGateway.GetOrder(viewId, workType, companyId, row.SortID); } else { row.Selected = false; row.SetOrder_Null(); } } } }