Example #1
0
        public void InitState(BP.Sys.Contrast c)
        {
            if (c.KeyVal1 == "" || c.KeyVal1 == null)
            {
                return;
            }

            this.DDL_ContrastKey.SetSelectItem(c.ContrastKey);
            this.DDL_M1.SetSelectItem(c.KeyVal1);
            this.DDL_M2.SetSelectItem(c.KeyVal2);
            this.DDL_Key.SetSelectItem(c.SortBy);
            this.DDL_GroupField.SetSelectItem(c.KeyOfNum);
            this.DDL_GroupWay.SetSelectItem(c.GroupWay);
            this.DDL_OrderWay.SetSelectItem(c.OrderWay);
        }
Example #2
0
        /// <summary>
        /// 保存当前的状态
        /// </summary>
        public void SaveState()
        {
            BP.Sys.Contrast c = new BP.Sys.Contrast();
            c.MyPK = this.EnsName + BP.Web.WebUser.No;

            c.ContrastKey = this.DDL_ContrastKey.SelectedItemStringVal;
            c.KeyVal1     = this.DDL_M1.SelectedItemStringVal;
            c.KeyVal2     = this.DDL_M2.SelectedItemStringVal;

            c.SortBy   = this.DDL_Key.SelectedItemStringVal;
            c.KeyOfNum = this.DDL_GroupField.SelectedItemStringVal;


            c.GroupWay = this.DDL_GroupWay.SelectedItemIntVal;
            c.OrderWay = this.DDL_OrderWay.SelectedItemIntVal;

            int i = c.Update();

            if (i == 0)
            {
                c.Insert();
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            UAC uac = this.HisEn.HisUAC;

            if (uac.IsView == false)
            {
                throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限.");
            }

            if (this.IsPostBack == false)
            {
                BP.Sys.Contrast c = new BP.Sys.Contrast();
                c.MyPK = this.EnsName + WebUser.No;
                if (c.RetrieveFromDBSources() == 0)
                {
                    c.ContrastKey = this.Request.QueryString["ContrastKey"];
                }
                try
                {
                    #region 设置tool bar 1 的contral

                    #region 判断权限
                    if (uac.IsView == false)
                    {
                        throw new Exception("@对不起,您没有查看的权限!");
                    }
                    #endregion

                    // 比较对象。
                    Map    map        = this.HisEn.EnMap;
                    string NoShowCont = "@FK_Dot@FK_Rate@";
                    //  string NoShowCont = SystemConfig.GetConfigXmlEns("NoShowContrast", this.EnsName);
                    foreach (Attr attr in map.Attrs)
                    {
                        if (attr.MyFieldType == FieldType.FK ||
                            attr.MyFieldType == FieldType.PKFK)
                        {
                            if (NoShowCont.Contains(attr.Key))
                            {
                                continue;
                            }
                            this.DDL_ContrastKey.Items.Add(new ListItem(attr.Desc, attr.Key));
                        }
                    }

                    this.DDL_ContrastKey.SetSelectItem(c.ContrastKey);
                    foreach (Attr attr in map.Attrs)
                    {
                        if (attr.IsPK)
                        {
                            continue;
                        }

                        if (attr.UIContralType == UIContralType.TB == false)
                        {
                            continue;
                        }

                        if (attr.MyFieldType == FieldType.FK)
                        {
                            continue;
                        }

                        if (attr.MyFieldType == FieldType.Enum)
                        {
                            continue;
                        }

                        if (attr.MyFieldType == FieldType.PKEnum)
                        {
                            continue;
                        }

                        if (attr.Key == "OID" || attr.Key == "WorkID" || attr.Key == "MID")
                        {
                            continue;
                        }

                        switch (attr.MyDataType)
                        {
                        case DataType.AppDouble:
                        case DataType.AppFloat:
                        case DataType.AppInt:
                        case DataType.AppMoney:
                        case DataType.AppRate:
                            this.DDL_GroupField.Items.Add(new ListItem(attr.Desc, attr.Key));
                            break;

                        default:
                            break;
                        }
                    }

                    this.DDL_GroupField.SetSelectItem(this.ContrastObj);


                    this.DDL_GroupWay.Items.Add(new ListItem("求和", "0"));
                    this.DDL_GroupWay.Items.Add(new ListItem("求平均", "1"));

                    this.DDL_OrderWay.Items.Add(new ListItem("降序", "0"));
                    this.DDL_OrderWay.Items.Add(new ListItem("升序", "1"));

                    if (this.Request.QueryString["OperateCol"] != null)
                    {
                        string[] strs = this.Request.QueryString["OperateCol"].Split('_');
                        this.DDL_GroupField.SetSelectItem(strs[0]);
                        this.DDL_GroupWay.SetSelectItem(strs[1]);
                    }
                    #endregion

                    this.ToolBar1.InitByMapV2(this.HisEn.EnMap, 1);
                    this.BindContrastKey(map);
                    InitState(c);
                    this.SetDGData();
                }
                catch (Exception ex)
                {
                    this.HisEns.DoDBCheck(DBCheckLevel.High);
                    throw new Exception("@装载出现错误:" + ex.Message);
                }
            }

            //this.ToolBar1.ButtonClick += new System.EventHandler(this.ToolBar1_ButtonClick);
            string lab = SystemConfig.GetConfigXmlEns("Contrast", this.EnsName);
            if (lab == null)
            {
                lab = this.HisEn.EnMap.EnDesc;
            }

            this.Label2.Text = this.ContrastLab + "1";
            this.Label3.Text = this.ContrastLab + "2";

            this.Label1.Text = this.GenerCaption(lab);
            //  this.Label1.Controls.Add(this.GenerLabel("<img src='../Img/Btn/DataGroup.gif' border=0  />" + lab));
            this.DDL_ContrastKey.AutoPostBack          = true;
            this.DDL_ContrastKey.SelectedIndexChanged += new EventHandler(DDL_ContrastKey_SelectedIndexChanged);
            this.BindDDLMore();
        }