예제 #1
0
        /// <summary>
        /// SaveForEdit
        /// </summary>
        public void SaveForEdit()
        {
            foreach (FmViewTDS.FmViewSortTempRow rowViewSort in (FmViewTDS.FmViewSortTempDataTable)Data.Tables["FmViewSortTemp"])
            {
                FmViewSort fmViewSort = new FmViewSort(null);

                if (!rowViewSort.Deleted && !rowViewSort.InDatabase && rowViewSort.Selected)
                {
                    fmViewSort.InsertDirect(rowViewSort.ViewID, rowViewSort.FmType, rowViewSort.COMPANY_ID, rowViewSort.SortID, rowViewSort.Order_, rowViewSort.Deleted);
                }

                if (!rowViewSort.Deleted && rowViewSort.InDatabase && rowViewSort.Selected)
                {
                    FmViewSortGateway fmViewSortGateway = new FmViewSortGateway();
                    fmViewSortGateway.LoadAllByViewIdFmTypeSortId(rowViewSort.ViewID, rowViewSort.FmType, rowViewSort.COMPANY_ID, rowViewSort.SortID);

                    int originalViewId = rowViewSort.ViewID;
                    string originalFmType = rowViewSort.FmType;
                    int originalCompanyId = rowViewSort.COMPANY_ID;
                    int originalSortId = rowViewSort.SortID;
                    int originalOrder = fmViewSortGateway.GetOrder(rowViewSort.ViewID, rowViewSort.FmType, rowViewSort.COMPANY_ID, rowViewSort.SortID);
                    bool originalDeleted = fmViewSortGateway.GetDeleted(rowViewSort.ViewID, rowViewSort.FmType, rowViewSort.COMPANY_ID, rowViewSort.SortID);

                    fmViewSort.UpdateDirect(originalViewId, originalFmType, originalCompanyId, originalSortId, originalOrder, originalDeleted, rowViewSort.ViewID, rowViewSort.FmType, rowViewSort.COMPANY_ID, rowViewSort.SortID, rowViewSort.Order_, rowViewSort.Deleted);
                }

                if (rowViewSort.Deleted && rowViewSort.InDatabase && !rowViewSort.Selected)
                {
                    fmViewSort.DeleteDirectForEditView(rowViewSort.ViewID, rowViewSort.FmType, rowViewSort.COMPANY_ID, rowViewSort.SortID);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// UpdateForEdit
        /// </summary>
        /// <param name="viewId">viewId</param>
        /// <param name="fmType">fmType</param>
        /// <param name="companyId">companyId</param>
        public void UpdateForEdit(int viewId, string fmType, int companyId)
        {
            foreach (FmViewTDS.LFS_FM_TYPE_VIEW_SORTRow row in (FmViewTDS.LFS_FM_TYPE_VIEW_SORTDataTable)Table)
            {
                if ((row.FmType == fmType) && (row.COMPANY_ID == companyId))
                {
                    FmViewSort fmViewSort = new FmViewSort();
                    fmViewSort.LoadByViewIdFmTypeSortId(viewId, fmType, companyId, row.SortID);
                    FmViewSortGateway fmViewSortGateway = new FmViewSortGateway(fmViewSort.Data);

                    if (fmViewSort.ExistsByViewIDFmTypeCompanyIdSortId(viewId, fmType, companyId, row.SortID))
                    {
                        row.Selected = true;
                        row.Order_ = fmViewSortGateway.GetOrder(viewId, fmType, companyId, row.SortID);
                    }
                    else
                    {
                        row.Selected = false;
                        row.SetOrder_Null();
                    }
                }
            }
        }