示例#1
0
 public void SetFormMode(string title, int colCount, int rowCount, string tableName = "", string colName = "", string rowName      = "",
                         InputFormType inputFormType = InputFormType.GenericDouble, int colWidth         = 48, int rowHeadersWidth = 64,
                         bool onlyTable = true, bool nocolNum = false, bool noRowNum = false, object initData = null)
 {
     hideSingle           = onlyTable;
     this.colCount        = colCount;
     this.rowCount        = rowCount;
     this.title           = title;
     this.tableName       = tableName;
     this.colName         = colName;
     this.rowName         = rowName;
     this.nocolNum        = nocolNum;
     this.noRowNum        = noRowNum;
     this.colWidth        = colWidth;
     this.rowHeadersWidth = rowHeadersWidth;
     this.inputFormType   = inputFormType;
     CreateData(initData);
 }
 public void SetFormMode(string title, int colCount, int rowCount, string tableName = "", string colName = "", string rowName = "",
                         int colWidth   = 48, int rowHeadersWidth = 64,
                         bool onlyTable = true, bool nocolNum     = false, bool noRowNum = false, object initData = null)
 {
     hideSingle           = onlyTable;
     this.colCount        = colCount;
     this.rowCount        = rowCount;
     this.title           = title;
     this.tableName       = tableName;
     this.colName         = colName;
     this.rowName         = rowName;
     this.nocolNum        = nocolNum;
     this.noRowNum        = noRowNum;
     this.colWidth        = colWidth;
     this.rowHeadersWidth = rowHeadersWidth;
     this.inputFormType   = inputFormType;
     this.inputData       = initData as RiverSimulationProfile.SideFlowObject;
     this.p             = RiverSimulationProfile.profile;
     tabControl.Enabled = true;
     CreateData(inputData.flowData);
 }
    private void UpdateDataView()
    {
        lbError.Visible = false;
        InputFormType type = InputFormType.GetByKey(inputFormTypeCode);

        if (type != null)
        {
            // Get input form type
            lblTitle.Text = "New exclusion rule for input form type " + type.Name + " [" + type.Code + "]";

            // Build collection with all possible container types (not used in exclusion rule)
            ContainerTypeList containerTypes = GetPossibleContainerTypes();

            if (containerTypes.Count > 0)
            {
                dg.DataSource = containerTypes;
                Utils.InitGridSort(ref dg, false);
                dg.DataBind();
                dg.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.No;
            }
            else
            {
                dg.Visible       = false;
                lbError.Text     = "No container types";
                lbError.CssClass = "hc_success";
                lbError.Visible  = true;
                UITools.HideToolBarButton(uwToolbar, "Save");
                UITools.HideToolBarSeparator(uwToolbar, "SaveSep");
            }
        }
        else
        {
            // Wrong request data
            lbError.CssClass = "hc_error";
            lbError.Text     = "Error: exclusion rule of input form type is null";
            lbError.Visible  = true;
        }
    }
        private void CreateData(Object d)
        {
            RiverSimulationProfile p = RiverSimulationProfile.profile;

            RiverSimulationProfile.TwoInOne o  = d as RiverSimulationProfile.TwoInOne;
            RiverSimulationProfile.TwoInOne _d = null;
            //第1, 3種:亞臨界流、均一值/逐點給、定量流
            if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow &&
                p.IsConstantFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.TwoDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 2;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type1;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = null;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue2D(colCount, rowCount);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type3;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 2);
                    }
                }
            }
            //第2, 4種:亞臨界流、均一值/逐點給、變量流
            else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow &&
                     p.IsVariableFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.ThreeDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 1;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type2;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue3D(colCount, rowCount, 2);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type4;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 2);
                    }
                }
            }
            //第5, 7種:超臨界流、均一值/逐點給、定量流
            else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SuperCriticalFlow &&
                     p.IsConstantFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.TwoDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 3;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type5;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = null;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue2D(colCount, rowCount);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type7;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = tabControl;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";
                    tabPage3.Text   = "水位(m)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 3);
                    }
                }
            }
            //第6, 8種:超臨界流、均一值/逐點給、變量流
            else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SuperCriticalFlow &&
                     p.IsVariableFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.ThreeDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 1;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type6;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = tabControl;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";
                    tabPage3.Text   = "水位(m)";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue3D(colCount, rowCount, 3);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type8;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = tabControl;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";
                    tabPage3.Text   = "水位(m)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 3);
                    }
                }
            }
        }