예제 #1
0
        private void btnSaveAsLayout_Click(object sender, EventArgs e)
        {
            if (_selectedDatasource == null)
                return;

            Views.Main.ChooseSaveNameDlg dlg = new Main.ChooseSaveNameDlg();

            if (dlg.ShowDialog() != DialogResult.OK)
                return;
            try
            {
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                pivotGridControlMain.SaveLayoutToStream(ms, DevExpress.Utils.OptionsLayoutBase.FullLayout);
                int NewId = (int)Classes.QueryLayout.InsertLayout(_selectedDatasource.DatasourceID, dlg.SavingName, ms.ToArray());
                lueLayout.EditValue = NewId;
            }
            catch (Exception ex)
            {
                MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex);
                Classes.Core.LogException(Logger, ex, Classes.Core.ExceptionLevelEnum.General, Classes.Managers.UserManager.defaultInstance.User.UserId);
            }
            
        }
예제 #2
0
        private void btnSaveLayout_Click(object sender, EventArgs e)
        {
            if (_selectedDatasource == null)//|| FXFW.SqlDB.IsNullOrEmpty(lueLayout.EditValue)
                return;
            int Datasource = _selectedDatasource.DatasourceID;

            Views.Main.ChooseSaveNameDlg dlg = null;
            if (FXFW.SqlDB.IsNullOrEmpty(lueLayout.EditValue))// Save As New
            {
                dlg = new Main.ChooseSaveNameDlg();
                if (dlg.ShowDialog() != DialogResult.OK)
                    return;
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                pivotGridControlMain.SaveLayoutToStream(ms, DevExpress.Utils.OptionsLayoutBase.FullLayout);
                int NewLayoutId = (int)Classes.QueryLayout.InsertLayout(Datasource, dlg.SavingName, ms.ToArray());
                LSMSLayout.Reload(); lueLayout.EditValue = NewLayoutId;
            }
            else// Update
            {
                NICSQLTools.Data.Linq.vAppDatasourceLayout_LUE row = (NICSQLTools.Data.Linq.vAppDatasourceLayout_LUE)lueLayout.GetSelectedDataRow();
                if (!Classes.Managers.UserManager.defaultInstance.User.IsAdmin && row.UserIn != Classes.Managers.UserManager.defaultInstance.User.UserId)
                {
                    MsgDlg.Show("Can't Edit Item you do not owen", MsgDlg.MessageType.Error);
                    return;
                }

                dlg = new Main.ChooseSaveNameDlg(row.DatasourceLayoutName);
                if (dlg.ShowDialog() != DialogResult.OK)
                    return;
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                pivotGridControlMain.SaveLayoutToStream(ms, DevExpress.Utils.OptionsLayoutBase.FullLayout);
                Classes.QueryLayout.UpdateDatasourceLayout(row.DatasourceLayoutId, Datasource, dlg.SavingName, ms.ToArray());
                LSMSLayout.Reload();
            }
            
        }