Ejemplo n.º 1
0
        private void btAdd4_Click(object sender, EventArgs e)
        {
            if (cbMasterTable.SelectedIndex == -1)
            {
                return;
            }
            DataItem item = (DataItem)cbMasterTable.SelectedItem;
            CTable   tb   = (CTable)item.Data;

            if (cbMasterColumn4.SelectedIndex == -1)
            {
                MessageBox.Show("请选择字段!");
                return;
            }
            if (cbSign4.SelectedIndex == -1)
            {
                MessageBox.Show("请选择比较符号!");
                return;
            }
            if (txtVal4.Text.Trim() == "")
            {
                MessageBox.Show("请输入字段值!");
                return;
            }

            DataItem item2 = (DataItem)cbMasterColumn4.SelectedItem;
            CColumn  col   = (CColumn)item2.Data;

            CViewFilter vf = new CViewFilter();

            vf.Ctx          = Program.Ctx;
            vf.UI_View_id   = m_View.Id;
            vf.AndOr        = (cbAndOr.SelectedIndex == 0) ? "and" : "or";
            vf.FW_Table_id  = tb.Id;
            vf.FW_Column_id = col.Id;
            vf.Sign         = (CompareSign)cbSign4.SelectedIndex;
            vf.Val          = txtVal4.Text.Trim();
            m_View.ViewFilterMgr.AddNew(vf);

            dataGridView4.Rows.Add(1);
            DataGridViewRow rowNew = dataGridView4.Rows[dataGridView4.Rows.Count - 1];

            rowNew.Cells[0].Value = vf.AndOr;
            rowNew.Cells[1].Value = col.Name;
            rowNew.Cells[2].Value = vf.GetSignName();
            rowNew.Cells[3].Value = vf.Val;
            rowNew.Tag            = vf;

            txtVal4.Text = "";
        }
Ejemplo n.º 2
0
    void GetData()
    {
        string sData  = "";
        int    iCount = 0;

        if (Session["ViewFilterMgr"] != null)
        {
            SortedList <Guid, CViewFilterMgr> sortObj = (SortedList <Guid, CViewFilterMgr>)Session["ViewFilterMgr"];
            if (sortObj.ContainsKey(m_View.Id))
            {
                CViewFilterMgr ViewFilterMgr = sortObj[m_View.Id];
                ViewFilterMgr.IsLoad = true; //避免从数据库装载
                List <CBaseObject> lstObj = ViewFilterMgr.GetList();
                foreach (CBaseObject obj in lstObj)
                {
                    CViewFilter ViewFilter = (CViewFilter)obj;

                    CColumn col = (CColumn)m_Table.ColumnMgr.Find(ViewFilter.FW_Column_id);
                    if (col == null)
                    {
                        continue;
                    }

                    sData += string.Format("{{ \"id\": \"{0}\",\"AndOr\":\"{1}\",\"Column\":\"{2}\",\"Sign\":\"{3}\", \"Val\":\"{4}\" }},"
                                           , ViewFilter.Id
                                           , ViewFilter.AndOr.Equals("and", StringComparison.OrdinalIgnoreCase) ? "与" : "或"
                                           , col.Name
                                           , ViewFilter.GetSignName()
                                           , ViewFilter.Val);

                    iCount++;
                }
            }
        }
        sData = sData.TrimEnd(",".ToCharArray());
        sData = "[" + sData + "]";
        string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}"
                                     , sData, iCount);

        Response.Write(sJson);
    }
    void GetData()
    {
        string sData  = "";
        int    iCount = 0;

        List <CBaseObject> lstObj  = m_View.ViewFilterMgr.GetList();
        List <CViewFilter> sortObj = new List <CViewFilter>();

        foreach (CBaseObject obj in lstObj)
        {
            CViewFilter ViewFilter = (CViewFilter)obj;
            sortObj.Add(ViewFilter);
        }
        sortObj.Sort();

        foreach (CViewFilter ViewFilter in sortObj)
        {
            CColumn col = (CColumn)m_MTable.ColumnMgr.Find(ViewFilter.FW_Column_id);
            if (col == null)
            {
                continue;
            }

            sData += string.Format("{{ \"id\": \"{0}\",\"AndOr\":\"{1}\",\"Column\":\"{2}\",\"Sign\":\"{3}\", \"Val\":\"{4}\" }},"
                                   , ViewFilter.Id
                                   , ViewFilter.AndOr.Equals("and", StringComparison.OrdinalIgnoreCase)?"与":"或"
                                   , col.Name
                                   , ViewFilter.GetSignName()
                                   , ViewFilter.Val);

            iCount++;
        }

        sData = sData.TrimEnd(",".ToCharArray());
        sData = "[" + sData + "]";
        string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}"
                                     , sData, iCount);

        Response.Write(sJson);
    }
Ejemplo n.º 4
0
        void LoadGridView4()
        {
            if (cbMasterTable.SelectedIndex == -1)
            {
                return;
            }
            DataItem item = (DataItem)cbMasterTable.SelectedItem;
            CTable   tb   = (CTable)item.Data;

            txtMasterTable4.Text = tb.Name;
            List <CBaseObject> lstObj  = m_View.ViewFilterMgr.GetList();
            List <CViewFilter> sortObj = new List <CViewFilter>();

            foreach (CBaseObject obj in lstObj)
            {
                CViewFilter vf = (CViewFilter)obj;
                sortObj.Add(vf);
            }
            sortObj.Sort();

            dataGridView4.Rows.Clear();
            foreach (CViewFilter vf in sortObj)
            {
                CColumn column = (CColumn)tb.ColumnMgr.Find(vf.FW_Column_id);
                if (column == null)
                {
                    continue;
                }

                dataGridView4.Rows.Add(1);
                DataGridViewRow rowNew = dataGridView4.Rows[dataGridView4.Rows.Count - 1];
                rowNew.Cells[0].Value = vf.AndOr;
                rowNew.Cells[1].Value = column.Name;
                rowNew.Cells[2].Value = vf.GetSignName();
                rowNew.Cells[3].Value = vf.Val;
                rowNew.Tag            = vf;
            }
        }