protected void aspPager_PageChanged(object sender, EventArgs e)
 {
     if (hidCondition.Value != "")
     {
         condObj = JsonServiceBase.FromJson<Ec_relatedlists>(hidCondition.Value);
     }
     BindList(condObj, aspPager.CurrentPageIndex);
 }
 protected void aspPager_PageChanged(object sender, EventArgs e)
 {
     if (hidCondition.Value != "")
     {
         condObj = JsonServiceBase.FromJson <Ec_relatedlists>(hidCondition.Value);
     }
     BindList(condObj, aspPager.CurrentPageIndex);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        title      = valObj._ZhName + "±à¼­";
        Page.Title = title;
        if (!string.IsNullOrEmpty(Request["Relation_id"]))
        {
            keyid = Request["Relation_id"];
        }

        if (!string.IsNullOrEmpty(Request["KeyID"]))
        {
            keyid = Request["KeyID"];
        }
        if (!IsPostBack)
        {
            this.txtRelation_id.Disabled            = true; this.txtRelation_id.Value = "0";
            this.txtRelation_id.Attributes["class"] = "dis";
            try
            {
                if (keyid != "")
                {
                    valObj = BLLTable <Ec_relatedlists> .Factory(conn).GetRowData(Ec_relatedlists.Attribute.Relation_id, keyid);

                    if (valObj == null)
                    {
                        return;
                    }


                    txtRelation_id.Value = Convert.ToString(valObj.Relation_id);                   //Convert.ToInt32

                    txtTabid.Value = Convert.ToString(valObj.Tabid);                               //Convert.ToInt32

                    txtRelated_tabid.Value = Convert.ToString(valObj.Related_tabid);               //Convert.ToInt32

                    txtName.Value = Convert.ToString(valObj.Name);                                 //Convert.ToString

                    txtSequence.Value = Convert.ToString(valObj.Sequence);                         //Convert.ToInt32

                    txtLabel.Value = Convert.ToString(valObj.Label);                               //Convert.ToString

                    txtPresence.Value = Convert.ToString(valObj.Presence);                         //Convert.ToInt32

                    txtTabTableName.Value = Convert.ToString(valObj.TabTableName);                 //Convert.ToString

                    txtColumnName_PK.Value = Convert.ToString(valObj.ColumnName_PK);               //Convert.ToString

                    txtColumnName_FK.Value = Convert.ToString(valObj.ColumnName_FK);               //Convert.ToString

                    txtRelated_tabTableName.Value = Convert.ToString(valObj.Related_tabTableName); //Convert.ToString
                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }
 protected void btnSetPageSize_Click(object sender, EventArgs e)
 {
     aspPager.PageSize = int.Parse(txtPageSize.Value);
     if (hidCondition.Value != "")
     {
         condObj = JsonServiceBase.FromJson <Ec_relatedlists>(hidCondition.Value);
     }
     BindList(condObj, aspPager.CurrentPageIndex);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region//默认隐藏的列
        //hideTableColumnList = new List<AttributeItem>();
        //hideTableColumnList.Add(Ec_relatedlists.Attribute.EXP1);
        //hideTableColumnList.Add(Ec_relatedlists.Attribute.EXP2);
        //hideTableColumnList.Add(Ec_relatedlists.Attribute.EXP3);
        //valObj.LoadAllAttributes(true);//暂时加此代码,以后框架更新将不需要
        //valObj.Remove(hideTableColumnList);

        //hideFindColumnList = new List<AttributeItem>();
        //hideFindColumnList.Add(Ec_relatedlists.Attribute.EXP1);
        //hideFindColumnList.Add(Ec_relatedlists.Attribute.EXP2);
        //hideFindColumnList.Add(Ec_relatedlists.Attribute.EXP3);
        #endregion
        condObj.OrderBy(Ec_relatedlists.Attribute.Relation_id, Order.Desc);

        if (!IsPostBack)
        {
            btnFind.Text              = LanguageService.GetLanguageString("btnFind", "查询");
            aspPager.PageSize         = 10;
            aspPager.CurrentPageIndex = 1;

            if (!string.IsNullOrEmpty(Request["ids"]))
            {
                Ec_relatedlists roleOld = new Ec_relatedlists();
                roleOld.Where(Ec_relatedlists.Attribute.Relation_id, Request["ids"].ToString());
                listObj = BLLTable <Ec_relatedlists> .Factory(conn).Select(valObj, roleOld);

                for (int i = 0; i < listObj.Count; i++)
                {
                    if (i > 0)
                    {
                        hidOld.Value     += ",";
                        hidInitIDS.Value += ",";
                    }
                    hidOld.Value     += "{ID:'" + listObj[i].Relation_id + "',Name:'" + listObj[i].Relation_id + "'}";//这里的Name用于显示在列表中,请自行重定义。
                    hidInitIDS.Value += listObj[i].Relation_id;
                }
            }
            try
            {
                listObj = BLLTable <Ec_relatedlists> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);

                repList.DataSource = listObj;
                repList.DataBind();
                aspPager.RecordCount = recount;
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录
        if (Request["DelRelation_id"] != null)
        {
            int re = BLLTable <Ec_relatedlists> .Factory(conn).Delete(Ec_relatedlists.Attribute.Relation_id, Request["DelRelation_id"]);

            if (re > 0)
            {
                Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示
            }
            else
            {
                Response.Write("删除失败!");
            }
        }

        //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录
        if (Request["DelKeyIDS"] != null)
        {
            Ec_relatedlists cond = new Ec_relatedlists();
            cond.In(Ec_relatedlists.Attribute.Relation_id, Request["DelKeyIDS"]);
            int re = BLLTable <Ec_relatedlists> .Factory(conn).Delete(cond);

            if (re > 0)
            {
                Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示
            }
            else
            {
                Response.Write("删除失败!");
            }
        }

        //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新
        if (Request["saveInfo"] != null)
        {
            Ec_relatedlists val = new Ec_relatedlists();
            val.Relation_id = int.Parse(Request["FieldKeyID"]);
            List <AttributeItem> lstCol = val.af_AttributeItemList;
            for (int i = 0; i < lstCol.Count; i++)
            {
                if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName]))
                {
                    val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]);
                }
            }

            BLLTable <Ec_relatedlists> .Factory(conn).Update(val, Ec_relatedlists.Attribute.Relation_id);

            Response.Write("修改用户信息成功");
        }
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼
        if (Request["DelRelation_id"] != null)
        {
            int re = BLLTable<Ec_relatedlists>.Factory(conn).Delete(Ec_relatedlists.Attribute.Relation_id, Request["DelRelation_id"]);
            if (re > 0)
            {
                Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ
            }
            else
            {
                Response.Write("ɾ��ʧ�ܣ�");
            }
        }

        //���б�������ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��������¼
        if (Request["DelKeyIDS"] != null)
        {
            Ec_relatedlists cond = new Ec_relatedlists();
            cond.In(Ec_relatedlists.Attribute.Relation_id, Request["DelKeyIDS"]);
            int re = BLLTable<Ec_relatedlists>.Factory(conn).Delete(cond);
            if (re > 0)
            {
                Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ
            }
            else
            {
                Response.Write("ɾ��ʧ�ܣ�");
            }
        }

        //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ���
        if (Request["saveInfo"] != null)
        {
            Ec_relatedlists val = new Ec_relatedlists();
            val.Relation_id = int.Parse(Request["FieldKeyID"]);
            List<AttributeItem> lstCol = val.af_AttributeItemList;
            for (int i = 0; i < lstCol.Count; i++)
            {
                if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) {
                    val.SetValue(lstCol[i].FieldName,Request["txt" + lstCol[i].FieldName]);
                }
            }

            BLLTable<Ec_relatedlists>.Factory(conn).Update(val, Ec_relatedlists.Attribute.Relation_id);
            Response.Write("�޸��û���Ϣ�ɹ�");

        }
        Response.End();
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new Ec_relatedlists();

        if(txtRelation_id.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Relation_id, Convert.ToInt32(txtRelation_id.Value));

        if(txtTabid.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Tabid, Convert.ToInt32(txtTabid.Value));

        if(txtRelated_tabid.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Related_tabid, Convert.ToInt32(txtRelated_tabid.Value));

        if(txtName.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Name, Convert.ToString(txtName.Value));

        if(txtSequence.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Sequence, Convert.ToInt32(txtSequence.Value));

        if(txtLabel.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Label, Convert.ToString(txtLabel.Value));

        if(txtPresence.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Presence, Convert.ToInt32(txtPresence.Value));

        if(txtTabTableName.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.TabTableName, Convert.ToString(txtTabTableName.Value));

        if(txtColumnName_PK.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.ColumnName_PK, Convert.ToString(txtColumnName_PK.Value));

        if(txtColumnName_FK.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.ColumnName_FK, Convert.ToString(txtColumnName_FK.Value));

        if(txtRelated_tabTableName.Value !="" )
            condObj.Like_OR(Ec_relatedlists.Attribute.Related_tabTableName, Convert.ToString(txtRelated_tabTableName.Value));

        try
        {
            hidCondition.Value = condObj.ToJson(20);

            listObj = BLLTable<Ec_relatedlists>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);
            repList.DataSource = listObj;
            repList.DataBind();
        }
        catch (Exception ex)
        {
             litWarn.Text = ex.Message;
        }
    }
    protected void aspPager_PageChanged(object sender, EventArgs e)
    {
        try
        {
            if (hidCondition.Value != "")
            {
                condObj = JsonServiceBase.FromJson <Ec_relatedlists>(hidCondition.Value);
            }
            listObj = BLLTable <Ec_relatedlists> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount);

            repCus.DataSource = listObj;
            repCus.DataBind();
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
    private void BindList(Ec_relatedlists condObj, int curPage)
    {
        if (condObj.af_PageByAttributeItem == null)//如果不存在用户定义的分页排序属性,则用主键属性排序
        {
            condObj.af_PageBy(Ec_relatedlists.Attribute.Relation_id, Order.Desc);
        }

        #region//数据权限条件

        #endregion
        //condObj.PID = decimal.Parse(pid);

        listObj = BLLTable <Ec_relatedlists> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, curPage, ref recount);

        repList.DataSource = listObj;
        repList.DataBind();
        aspPager.RecordCount = recount;
    }
    protected void aspPager_PageChanged(object sender, EventArgs e)
    {
        try
        {
            if (hidCondition.Value != "")
            {
                condObj = JsonServiceBase.FromJson<Ec_relatedlists>(hidCondition.Value);
            }
            listObj = BLLTable<Ec_relatedlists>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount);

            repCus.DataSource = listObj;
            repCus.DataBind();
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new Ec_relatedlists();

        if(txtRelation_id.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Relation_id, Convert.ToInt32(txtRelation_id.Value));

        if(txtTabid.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Tabid, Convert.ToInt32(txtTabid.Value));

        if(txtRelated_tabid.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Related_tabid, Convert.ToInt32(txtRelated_tabid.Value));

        if(txtName.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Name, Convert.ToString(txtName.Value));

        if(txtSequence.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Sequence, Convert.ToInt32(txtSequence.Value));

        if(txtLabel.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Label, Convert.ToString(txtLabel.Value));

        if(txtPresence.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Presence, Convert.ToInt32(txtPresence.Value));

        if(txtTabTableName.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.TabTableName, Convert.ToString(txtTabTableName.Value));

        if(txtColumnName_PK.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.ColumnName_PK, Convert.ToString(txtColumnName_PK.Value));

        if(txtColumnName_FK.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.ColumnName_FK, Convert.ToString(txtColumnName_FK.Value));

        if(txtRelated_tabTableName.Value !="" )
            condObj.Like(Ec_relatedlists.Attribute.Related_tabTableName, Convert.ToString(txtRelated_tabTableName.Value));

        hidCondition.Value = condObj.ToJson(20);

        BindList(condObj, 1);
    }
    private void BindList(Ec_relatedlists condObj, int curPage)
    {
        if (condObj.af_PageByAttributeItem == null)//����������û�����ķ�ҳ�������ԣ�����������������
            condObj.af_PageBy(Ec_relatedlists.Attribute.Relation_id, Order.Desc);

        #region//����Ȩ������

        #endregion
        //condObj.PID = decimal.Parse(pid);

        listObj = BLLTable<Ec_relatedlists>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, curPage, ref recount);
        repList.DataSource = listObj;
        repList.DataBind();
        aspPager.RecordCount = recount;
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new Ec_relatedlists();


        if (txtRelation_id.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Relation_id, Convert.ToInt32(txtRelation_id.Value));
        }


        if (txtTabid.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Tabid, Convert.ToInt32(txtTabid.Value));
        }


        if (txtRelated_tabid.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Related_tabid, Convert.ToInt32(txtRelated_tabid.Value));
        }


        if (txtName.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Name, Convert.ToString(txtName.Value));
        }


        if (txtSequence.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Sequence, Convert.ToInt32(txtSequence.Value));
        }


        if (txtLabel.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Label, Convert.ToString(txtLabel.Value));
        }


        if (txtPresence.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Presence, Convert.ToInt32(txtPresence.Value));
        }


        if (txtTabTableName.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.TabTableName, Convert.ToString(txtTabTableName.Value));
        }


        if (txtColumnName_PK.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.ColumnName_PK, Convert.ToString(txtColumnName_PK.Value));
        }


        if (txtColumnName_FK.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.ColumnName_FK, Convert.ToString(txtColumnName_FK.Value));
        }


        if (txtRelated_tabTableName.Value != "")
        {
            condObj.Like_OR(Ec_relatedlists.Attribute.Related_tabTableName, Convert.ToString(txtRelated_tabTableName.Value));
        }

        try
        {
            hidCondition.Value = condObj.ToJson(20);

            listObj = BLLTable <Ec_relatedlists> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);

            repList.DataSource = listObj;
            repList.DataBind();
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
 protected void btnSetPageSize_Click(object sender, EventArgs e)
 {
     aspPager.PageSize = int.Parse(txtPageSize.Value);
     if (hidCondition.Value != "")
     {
         condObj = JsonServiceBase.FromJson<Ec_relatedlists>(hidCondition.Value);
     }
     BindList(condObj, aspPager.CurrentPageIndex);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        title = valObj._ZhName + "��ϸ";
        Page.Title = title;
        if (!IsPostBack)
        {
            try
            {
                if (!string.IsNullOrEmpty(Request["Relation_id"]))
                {

                    valObj = BLLTable<Ec_relatedlists>.Factory(conn).GetRowData(Ec_relatedlists.Attribute.Relation_id, Request["Relation_id"]);
                    if(valObj==null) return ;

                    txtRelation_id.Text = Convert.ToString(valObj.Relation_id);//Convert.ToInt32

                    txtTabid.Text = Convert.ToString(valObj.Tabid);//Convert.ToInt32

                    txtRelated_tabid.Text = Convert.ToString(valObj.Related_tabid);//Convert.ToInt32

                    txtName.Text = Convert.ToString(valObj.Name);//Convert.ToString

                    txtSequence.Text = Convert.ToString(valObj.Sequence);//Convert.ToInt32

                    txtLabel.Text = Convert.ToString(valObj.Label);//Convert.ToString

                    txtPresence.Text = Convert.ToString(valObj.Presence);//Convert.ToInt32

                    txtTabTableName.Text = Convert.ToString(valObj.TabTableName);//Convert.ToString

                    txtColumnName_PK.Text = Convert.ToString(valObj.ColumnName_PK);//Convert.ToString

                    txtColumnName_FK.Text = Convert.ToString(valObj.ColumnName_FK);//Convert.ToString

                    txtRelated_tabTableName.Text = Convert.ToString(valObj.Related_tabTableName);//Convert.ToString

                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }

            if (Request["ajax"] != null)
            {
                Response.Clear();
                Response.Buffer = true;
                Response.Charset = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");//�����������������
                //Response.ContentType = "html/text";

                this.EnableViewState = false;
                System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
                System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
                System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
                divC.RenderControl(oHtmlTextWriter);

                Response.Write(oStringWriter.ToString());
                Response.End();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        title      = valObj._ZhName + "详细";
        Page.Title = title;
        if (!IsPostBack)
        {
            try
            {
                if (!string.IsNullOrEmpty(Request["Relation_id"]))
                {
                    valObj = BLLTable <Ec_relatedlists> .Factory(conn).GetRowData(Ec_relatedlists.Attribute.Relation_id, Request["Relation_id"]);

                    if (valObj == null)
                    {
                        return;
                    }


                    txtRelation_id.Text = Convert.ToString(valObj.Relation_id);//Convert.ToInt32


                    txtTabid.Text = Convert.ToString(valObj.Tabid);//Convert.ToInt32


                    txtRelated_tabid.Text = Convert.ToString(valObj.Related_tabid);//Convert.ToInt32


                    txtName.Text = Convert.ToString(valObj.Name);//Convert.ToString


                    txtSequence.Text = Convert.ToString(valObj.Sequence);//Convert.ToInt32


                    txtLabel.Text = Convert.ToString(valObj.Label);//Convert.ToString


                    txtPresence.Text = Convert.ToString(valObj.Presence);//Convert.ToInt32


                    txtTabTableName.Text = Convert.ToString(valObj.TabTableName);//Convert.ToString


                    txtColumnName_PK.Text = Convert.ToString(valObj.ColumnName_PK);//Convert.ToString


                    txtColumnName_FK.Text = Convert.ToString(valObj.ColumnName_FK);//Convert.ToString


                    txtRelated_tabTableName.Text = Convert.ToString(valObj.Related_tabTableName);//Convert.ToString
                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }

            if (Request["ajax"] != null)
            {
                Response.Clear();
                Response.Buffer          = true;
                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");//设置输出流为简体中文
                //Response.ContentType = "html/text";

                this.EnableViewState = false;
                System.Globalization.CultureInfo myCItrad        = new System.Globalization.CultureInfo("ZH-CN", true);
                System.IO.StringWriter           oStringWriter   = new System.IO.StringWriter(myCItrad);
                System.Web.UI.HtmlTextWriter     oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
                divC.RenderControl(oHtmlTextWriter);

                Response.Write(oStringWriter.ToString());
                Response.End();
            }
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        try
        {
            Ec_relatedlists valObj = new Ec_relatedlists();


            if (txtRelation_id.Value != "")
            {
                valObj.Relation_id = Convert.ToInt32(txtRelation_id.Value);
            }


            if (txtTabid.Value != "")
            {
                valObj.Tabid = Convert.ToInt32(txtTabid.Value);
            }


            if (txtRelated_tabid.Value != "")
            {
                valObj.Related_tabid = Convert.ToInt32(txtRelated_tabid.Value);
            }


            if (txtName.Value != "")
            {
                valObj.Name = Convert.ToString(txtName.Value);
            }


            if (txtSequence.Value != "")
            {
                valObj.Sequence = Convert.ToInt32(txtSequence.Value);
            }


            if (txtLabel.Value != "")
            {
                valObj.Label = Convert.ToString(txtLabel.Value);
            }


            if (txtPresence.Value != "")
            {
                valObj.Presence = Convert.ToInt32(txtPresence.Value);
            }


            if (txtTabTableName.Value != "")
            {
                valObj.TabTableName = Convert.ToString(txtTabTableName.Value);
            }


            if (txtColumnName_PK.Value != "")
            {
                valObj.ColumnName_PK = Convert.ToString(txtColumnName_PK.Value);
            }


            if (txtColumnName_FK.Value != "")
            {
                valObj.ColumnName_FK = Convert.ToString(txtColumnName_FK.Value);
            }


            if (txtRelated_tabTableName.Value != "")
            {
                valObj.Related_tabTableName = Convert.ToString(txtRelated_tabTableName.Value);
            }

            if (keyid != "")
            {
                valObj.Relation_id = Convert.ToInt32(keyid);
                count = BLLTable <Ec_relatedlists> .Factory(conn).Update(valObj, Ec_relatedlists.Attribute.Relation_id);
            }
            else
            {
                count = BLLTable <Ec_relatedlists> .Factory(conn).Insert(valObj, Ec_relatedlists.Attribute.Relation_id);

                keyid = valObj.Relation_id.ToString();
            }
            if (count > 0)
            {
                StringBuilder        sbData = new StringBuilder("{valObj:''");
                List <AttributeItem> lstCol = valObj.af_AttributeItemList;
                for (int i = 0; i < lstCol.Count; i++)
                {
                    object val = valObj.GetValue(lstCol[i]);
                    if (val != null)
                    {
                        sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'");
                    }
                }
                sbData.Append("}");
                if (ViewState["sbData"] == null)
                {
                    ViewState["sbData"] = sbData.ToString();
                }
                else
                {
                    ViewState["sbData"] += "," + sbData.ToString();
                }
                Button btn = (Button)sender;
                if (btn.ID.IndexOf("btnOK") != -1)
                {
                    if (ViewState["sbData"] == null)
                    {
                        string dataStr = "[" + ViewState["sbData"].ToString() + "]";
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "window.returnValue=\"" + dataStr + "\";window.close();", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "window.returnValue=\"re\";window.close();", true);
                    }
                }
                else
                {
                    txtRelation_id.Value = "";


                    txtTabid.Value = "";


                    txtRelated_tabid.Value = "";


                    txtName.Value = "";


                    txtSequence.Value = "";


                    txtLabel.Value = "";


                    txtPresence.Value = "";


                    txtTabTableName.Value = "";


                    txtColumnName_PK.Value = "";


                    txtColumnName_FK.Value = "";


                    txtRelated_tabTableName.Value = "";
                }
            }
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new Ec_relatedlists();



        if (txtRelation_id.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Relation_id, Convert.ToInt32(txtRelation_id.Value));
        }


        if (txtTabid.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Tabid, Convert.ToInt32(txtTabid.Value));
        }


        if (txtRelated_tabid.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Related_tabid, Convert.ToInt32(txtRelated_tabid.Value));
        }


        if (txtName.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Name, Convert.ToString(txtName.Value));
        }


        if (txtSequence.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Sequence, Convert.ToInt32(txtSequence.Value));
        }


        if (txtLabel.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Label, Convert.ToString(txtLabel.Value));
        }


        if (txtPresence.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Presence, Convert.ToInt32(txtPresence.Value));
        }


        if (txtTabTableName.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.TabTableName, Convert.ToString(txtTabTableName.Value));
        }


        if (txtColumnName_PK.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.ColumnName_PK, Convert.ToString(txtColumnName_PK.Value));
        }


        if (txtColumnName_FK.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.ColumnName_FK, Convert.ToString(txtColumnName_FK.Value));
        }


        if (txtRelated_tabTableName.Value != "")
        {
            condObj.Like(Ec_relatedlists.Attribute.Related_tabTableName, Convert.ToString(txtRelated_tabTableName.Value));
        }

        hidCondition.Value = condObj.ToJson(20);

        BindList(condObj, 1);
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        try
        {
            Ec_relatedlists valObj = new Ec_relatedlists();

            if(txtRelation_id.Value !="" )
                valObj.Relation_id = Convert.ToInt32(txtRelation_id.Value);

            if(txtTabid.Value !="" )
                valObj.Tabid = Convert.ToInt32(txtTabid.Value);

            if(txtRelated_tabid.Value !="" )
                valObj.Related_tabid = Convert.ToInt32(txtRelated_tabid.Value);

            if(txtName.Value !="" )
                valObj.Name = Convert.ToString(txtName.Value);

            if(txtSequence.Value !="" )
                valObj.Sequence = Convert.ToInt32(txtSequence.Value);

            if(txtLabel.Value !="" )
                valObj.Label = Convert.ToString(txtLabel.Value);

            if(txtPresence.Value !="" )
                valObj.Presence = Convert.ToInt32(txtPresence.Value);

            if(txtTabTableName.Value !="" )
                valObj.TabTableName = Convert.ToString(txtTabTableName.Value);

            if(txtColumnName_PK.Value !="" )
                valObj.ColumnName_PK = Convert.ToString(txtColumnName_PK.Value);

            if(txtColumnName_FK.Value !="" )
                valObj.ColumnName_FK = Convert.ToString(txtColumnName_FK.Value);

            if(txtRelated_tabTableName.Value !="" )
                valObj.Related_tabTableName = Convert.ToString(txtRelated_tabTableName.Value);

            if (keyid != "")
            {
                valObj.Relation_id = Convert.ToInt32(keyid);
                count = BLLTable<Ec_relatedlists>.Factory(conn).Update(valObj, Ec_relatedlists.Attribute.Relation_id);
            }
            else
            {
                count = BLLTable<Ec_relatedlists>.Factory(conn).Insert(valObj, Ec_relatedlists.Attribute.Relation_id);
                keyid = valObj.Relation_id.ToString();

            }
            if (count > 0)
            {
                StringBuilder sbData = new StringBuilder("{valObj:''");
                List<AttributeItem> lstCol = valObj.af_AttributeItemList;
                for (int i = 0; i < lstCol.Count; i++)
                {
                    object val = valObj.GetValue(lstCol[i]);
                    if (val != null)
                    {
                        sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'");
                    }
                }
                sbData.Append("}");
                if (ViewState["sbData"] == null)
                {
                    ViewState["sbData"] = sbData.ToString();
                }
                else {
                    ViewState["sbData"] += ","+sbData.ToString();
                }
                Button btn = (Button)sender;
                if (btn.ID.IndexOf("btnOK")!=-1)
                {
                    if (ViewState["sbData"] == null)
                    {
                        string dataStr = "[" + ViewState["sbData"] .ToString()+ "]";
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "window.returnValue=\"" + dataStr + "\";window.close();", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "window.returnValue=\"re\";window.close();", true);
                    }
                }
                else
                {

                    txtRelation_id.Value ="";

                    txtTabid.Value ="";

                    txtRelated_tabid.Value ="";

                    txtName.Value ="";

                    txtSequence.Value ="";

                    txtLabel.Value ="";

                    txtPresence.Value ="";

                    txtTabTableName.Value ="";

                    txtColumnName_PK.Value ="";

                    txtColumnName_FK.Value ="";

                    txtRelated_tabTableName.Value ="";
                }
            }
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        title = valObj._ZhName + "�༭";
        Page.Title = title;
        if (!string.IsNullOrEmpty(Request["Relation_id"]))
        {
            keyid = Request["Relation_id"];
        }

        if (!string.IsNullOrEmpty(Request["KeyID"]))
        {
            keyid = Request["KeyID"];
        }
        if (!IsPostBack)
        {

            this.txtRelation_id.Disabled = true; this.txtRelation_id.Value = "0";
            this.txtRelation_id.Attributes["class"] = "dis";
            try
            {
                if (keyid != "")
                {
                    valObj = BLLTable<Ec_relatedlists>.Factory(conn).GetRowData(Ec_relatedlists.Attribute.Relation_id, keyid);
                    if(valObj==null) return ;

                    txtRelation_id.Value = Convert.ToString(valObj.Relation_id);//Convert.ToInt32

                    txtTabid.Value = Convert.ToString(valObj.Tabid);//Convert.ToInt32

                    txtRelated_tabid.Value = Convert.ToString(valObj.Related_tabid);//Convert.ToInt32

                    txtName.Value = Convert.ToString(valObj.Name);//Convert.ToString

                    txtSequence.Value = Convert.ToString(valObj.Sequence);//Convert.ToInt32

                    txtLabel.Value = Convert.ToString(valObj.Label);//Convert.ToString

                    txtPresence.Value = Convert.ToString(valObj.Presence);//Convert.ToInt32

                    txtTabTableName.Value = Convert.ToString(valObj.TabTableName);//Convert.ToString

                    txtColumnName_PK.Value = Convert.ToString(valObj.ColumnName_PK);//Convert.ToString

                    txtColumnName_FK.Value = Convert.ToString(valObj.ColumnName_FK);//Convert.ToString

                    txtRelated_tabTableName.Value = Convert.ToString(valObj.Related_tabTableName);//Convert.ToString
                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region//Ĭ�����ص���
        //hideTableColumnList = new List<AttributeItem>();
        //hideTableColumnList.Add(Ec_relatedlists.Attribute.EXP1);
        //hideTableColumnList.Add(Ec_relatedlists.Attribute.EXP2);
        //hideTableColumnList.Add(Ec_relatedlists.Attribute.EXP3);
        //valObj.LoadAllAttributes(true);//��ʱ�Ӵ˴��룬�Ժ��ܸ��½�����Ҫ
        //valObj.Remove(hideTableColumnList);

        //hideFindColumnList = new List<AttributeItem>();
        //hideFindColumnList.Add(Ec_relatedlists.Attribute.EXP1);
        //hideFindColumnList.Add(Ec_relatedlists.Attribute.EXP2);
        //hideFindColumnList.Add(Ec_relatedlists.Attribute.EXP3);
        #endregion
        condObj.OrderBy(Ec_relatedlists.Attribute.Relation_id, Order.Desc);

        if (!IsPostBack)
        {
            btnFind.Text = LanguageService.GetLanguageString("btnFind", "��ѯ");
            aspPager.PageSize = 10;
            aspPager.CurrentPageIndex = 1;

            if (!string.IsNullOrEmpty(Request["ids"]))
            {
                Ec_relatedlists roleOld = new Ec_relatedlists();
                roleOld.Where(Ec_relatedlists.Attribute.Relation_id, Request["ids"].ToString());
                listObj = BLLTable<Ec_relatedlists>.Factory(conn).Select(valObj, roleOld);
                for (int i = 0; i < listObj.Count; i++)
                {
                    if (i > 0)
                    {
                        hidOld.Value += ",";
                        hidInitIDS.Value += ",";
                    }
                    hidOld.Value += "{ID:'" + listObj[i].Relation_id + "',Name:'" + listObj[i].Relation_id + "'}";//�����Name������ʾ���б��У��������ض��塣
                    hidInitIDS.Value += listObj[i].Relation_id;
                }
            }
            try
            {

                listObj = BLLTable<Ec_relatedlists>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);
                repList.DataSource = listObj;
                repList.DataBind();
                aspPager.RecordCount = recount;
            }
            catch (Exception ex)
            {
                 litWarn.Text = ex.Message;
            }

        }
    }