Exemplo n.º 1
0
        private void PublishUnpublish(long id, AvrTreeElementType type, bool isPublish)
        {
            switch (type)
            {
            case AvrTreeElementType.Query:
                using (var service = new Query_DB())
                {
                    service.PublishUnpublish(id, isPublish);
                }
                break;

            case AvrTreeElementType.Layout:
                using (var service = new WebLayoutDB())
                {
                    service.PublishUnpublish(id, isPublish);
                }
                break;

            case AvrTreeElementType.Folder:
                using (var service = new Folder_DB())
                {
                    service.PublishUnpublish(id, isPublish);
                }
                break;

            default:
                throw new AvrException("Unsupported AvrTreeElementType " + type);
            }
        }
Exemplo n.º 2
0
        public ActionResult QueryLayoutTreeDeletePartial(long id)
        {
            //все проверки в CanDelete
            List <AvrTreeElement> tree = GetQueryTree();
            AvrTreeElement        node = tree.FirstOrDefault(c => c.ID == id);
            string errStr = String.Empty;

            try
            {
                if (node != null)
                {
                    if (node.IsFolder)
                    {
                        //AvrQueryLayoutTreeDbHelper.DeleteFolder(node.ID);
                        using (var avrDbService = new Folder_DB())
                        {
                            avrDbService.Delete(node.ID);
                        }
                    }
                    else if (node.IsLayout)
                    {
                        using (var avrDbService = new WebLayoutDB())
                        {
                            avrDbService.Delete(node.ID);
                        }
                    }

                    RefreshTree();
                }
            }
            catch (Exception exc)
            {
                errStr = exc.Message;
            }
            return(PartialView("QueryLayoutTreePartial", GetQueryTree()));

            /*
             * return new JsonResult
             * {
             *  JsonRequestBehavior = JsonRequestBehavior.AllowGet,
             *  Data = new
             *  {
             *      result = errStr.Length == 0 ? "OK" : "ERROR",
             *      errorString = errStr
             *  }
             * };
             */
        }
Exemplo n.º 3
0
        public static AvrPivotGridModel FillData(ref long queryId, long layoutId)
        {
            var service        = new WebLayoutDB();
            var sessionDataSet = (LayoutDetailDataSet)service.GetDetail(layoutId);

            if (queryId <= 0)
            {
                queryId = ((LayoutDetailDataSet.LayoutRow)sessionDataSet.Layout.Rows[0]).idflQuery;
            }
            var helper = new LayoutHelper(sessionDataSet);

            var settings = new AvrPivotSettings(queryId, layoutId);

            helper.InitAvrPivotSettings(settings);
            bool isNewObject;

            string       errorMessage;
            AvrDataTable data = LayoutPivotGridHelper.GetPivotData(
                helper.LayoutDataSet,
                queryId,
                layoutId,
                settings.UseArchiveData,
                settings.ApplyFilter ? settings.FilterCriteriaString :string.Empty,
                out isNewObject, out errorMessage);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                throw new AvrException(errorMessage);
            }

            settings.Fields = AvrPivotGridHelper.CreateFields <WebPivotGridField>(data);
            helper.PrepareWebFields(settings);
            List <IAvrPivotGridField> fields = settings.Fields.Cast <IAvrPivotGridField>().ToList();
            LayoutValidateResult      result = helper.LoadPivotFromDB(new AvrPivotGridData(data), fields, isNewObject);
            var model = new AvrPivotGridModel(settings, data);

            if (result.IsCancelOrUserDialogCancel())
            {
                model.HideDataForComplexLayout();
            }
            return(model);
        }
Exemplo n.º 4
0
        public bool SaveData(AvrPivotSettings settings)
        {
            List <IAvrPivotGridField> fields = settings.Fields.Cast <IAvrPivotGridField>().ToList();

            AvrPivotGridHelper.PrepareLayoutSearchFieldsBeforePost(fields,
                                                                   LayoutDataSet.LayoutSearchField, settings.QueryId, settings.LayoutId);
            var db = new WebLayoutDB();

            db.SetQueryID(settings.QueryId);
            LayoutRow.idfsDefaultGroupDate           = settings.DefaultGroupInterval;
            LayoutRow.blnShowColsTotals              = settings.ShowColumnTotals;
            LayoutRow.blnShowRowsTotals              = settings.ShowRowTotals;
            LayoutRow.blnShowColGrandTotals          = settings.ShowColumnGrandTotals;
            LayoutRow.blnShowRowGrandTotals          = settings.ShowRowGrandTotals;
            LayoutRow.blnShowForSingleTotals         = settings.ShowTotalsForSingleValues;
            LayoutRow.blnShowMissedValuesInPivotGrid = settings.ShowMissedValues;
            LayoutRow.blnApplyPivotGridFilter        = settings.ApplyFilter;
            LayoutRow.blnCompactPivotGrid            = settings.CompactLayout;
            LayoutRow.blnFreezeRowHeaders            = settings.FreezeRowHeaders;
            LayoutRow.blnUseArchivedData             = settings.UseArchiveData;
            LayoutRow.strPivotGridSettings           = settings.FilterCriteriaString;
            LayoutRow.blnShowDataInPivotGrid         = settings.ShowDataInPivot;
            return(db.PostDetail(m_DataSet, (int)PostType.FinalPosting));
        }