protected void aspPager_PageChanged(object sender, EventArgs e)
 {
     if (hidCondition.Value != "")
     {
         condObj = JsonServiceBase.FromJson<Ec_field>(hidCondition.Value);
     }
     BindList(condObj, aspPager.CurrentPageIndex);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼
        if (Request["DelFieldid"] != null)
        {
            int re = BLLTable<Ec_field>.Factory(conn).Delete(Ec_field.Attribute.Fieldid, Request["DelFieldid"]);
            if (re > 0)
            {
                Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ
            }
            else
            {
                Response.Write("ɾ��ʧ�ܣ�");
            }
        }

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

        //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ���
        if (Request["saveInfo"] != null)
        {
            Ec_field val = new Ec_field();
            val.Fieldid = 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_field>.Factory(conn).Update(val, Ec_field.Attribute.Fieldid);
            Response.Write("�޸��û���Ϣ�ɹ�");

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

        if(txtFieldid.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Fieldid, Convert.ToInt32(txtFieldid.Value));

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

        if(txtColumnname.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Columnname, Convert.ToString(txtColumnname.Value));

        if(txtTablename.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Tablename, Convert.ToString(txtTablename.Value));

        if(txtGeneratedtype.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Generatedtype, Convert.ToInt32(txtGeneratedtype.Value));

        if(txtUitype.Value !="" )
            condObj.Uitype = Convert.ToString(txtUitype.Value);

        if(txtFieldname.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Fieldname, Convert.ToString(txtFieldname.Value));

        if(txtFieldlabel.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Fieldlabel, Convert.ToString(txtFieldlabel.Value));

        if(txtReadonly.Value !="" )
            condObj.Readonly = Convert.ToInt32(txtReadonly.Value);

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

        if(txtSelected.Value !="" )
            condObj.Selected = Convert.ToInt32(txtSelected.Value);

        if(txtMaximumlength.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Maximumlength, Convert.ToInt32(txtMaximumlength.Value));

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

        if(txtBlock.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Block, Convert.ToInt32(txtBlock.Value));

        if(txtDisplaytype.Value !="" )
            condObj.Displaytype = Convert.ToInt32(txtDisplaytype.Value);

        if(txtTypeofdata.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Typeofdata, Convert.ToString(txtTypeofdata.Value));

        if(txtQuickcreate.Value !="" )
            condObj.Quickcreate = Convert.ToInt32(txtQuickcreate.Value);

        if(txtQuickcreatesequence.Value !="" )
            condObj.Like_OR(Ec_field.Attribute.Quickcreatesequence, Convert.ToInt32(txtQuickcreatesequence.Value));

        if(txtInfo_type.Value !="" )
            condObj.Info_type = Convert.ToString(txtInfo_type.Value);

        if(txtCtrlType.Value !="" )
            condObj.CtrlType = Convert.ToString(txtCtrlType.Value);

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

            listObj = BLLTable<Ec_field>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);
            repList.DataSource = listObj;
            repList.DataBind();
        }
        catch (Exception ex)
        {
             litWarn.Text = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region//Ĭ�����ص���
        //hideTableColumnList = new List<AttributeItem>();
        //hideTableColumnList.Add(Ec_field.Attribute.EXP1);
        //hideTableColumnList.Add(Ec_field.Attribute.EXP2);
        //hideTableColumnList.Add(Ec_field.Attribute.EXP3);
        //valObj.LoadAllAttributes(true);//��ʱ�Ӵ˴��룬�Ժ��ܸ��½�����Ҫ
        //valObj.Remove(hideTableColumnList);

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

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

            if (!string.IsNullOrEmpty(Request["ids"]))
            {
                Ec_field roleOld = new Ec_field();
                roleOld.Where(Ec_field.Attribute.Fieldid, Request["ids"].ToString());
                listObj = BLLTable<Ec_field>.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].Fieldid + "',Name:'" + listObj[i].Fieldid + "'}";//�����Name������ʾ���б��У��������ض��塣
                    hidInitIDS.Value += listObj[i].Fieldid;
                }
            }
            try
            {

                listObj = BLLTable<Ec_field>.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;
            }

        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        try
        {
            Ec_field valObj = new Ec_field();

            if(txtFieldid.Value !="" )
                valObj.Fieldid = Convert.ToInt32(txtFieldid.Value);

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

            if(txtColumnname.Value !="" )
                valObj.Columnname = Convert.ToString(txtColumnname.Value);

            if(txtTablename.Value !="" )
                valObj.Tablename = Convert.ToString(txtTablename.Value);

            if(txtGeneratedtype.Value !="" )
                valObj.Generatedtype = Convert.ToInt32(txtGeneratedtype.Value);

            if(txtUitype.Value !="" )
                valObj.Uitype = Convert.ToString(txtUitype.Value);

            if(txtFieldname.Value !="" )
                valObj.Fieldname = Convert.ToString(txtFieldname.Value);

            if(txtFieldlabel.Value !="" )
                valObj.Fieldlabel = Convert.ToString(txtFieldlabel.Value);

            if(txtReadonly.Value !="" )
                valObj.Readonly = Convert.ToInt32(txtReadonly.Value);

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

            if(txtSelected.Value !="" )
                valObj.Selected = Convert.ToInt32(txtSelected.Value);

            if(txtMaximumlength.Value !="" )
                valObj.Maximumlength = Convert.ToInt32(txtMaximumlength.Value);

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

            if(txtBlock.Value !="" )
                valObj.Block = Convert.ToInt32(txtBlock.Value);

            if(txtDisplaytype.Value !="" )
                valObj.Displaytype = Convert.ToInt32(txtDisplaytype.Value);

            if(txtTypeofdata.Value !="" )
                valObj.Typeofdata = Convert.ToString(txtTypeofdata.Value);

            if(txtQuickcreate.Value !="" )
                valObj.Quickcreate = Convert.ToInt32(txtQuickcreate.Value);

            if(txtQuickcreatesequence.Value !="" )
                valObj.Quickcreatesequence = Convert.ToInt32(txtQuickcreatesequence.Value);

            if(txtInfo_type.Value !="" )
                valObj.Info_type = Convert.ToString(txtInfo_type.Value);

            if(txtCtrlType.Value !="" )
                valObj.CtrlType = Convert.ToString(txtCtrlType.Value);

            if (keyid != "")
            {
                valObj.Fieldid = Convert.ToInt32(keyid);
                count = BLLTable<Ec_field>.Factory(conn).Update(valObj, Ec_field.Attribute.Fieldid);
            }
            else
            {
                count = BLLTable<Ec_field>.Factory(conn).Insert(valObj, Ec_field.Attribute.Fieldid);
                keyid = valObj.Fieldid.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
                {

                    txtFieldid.Value ="";

                    txtTabid.Value ="";

                    txtColumnname.Value ="";

                    txtTablename.Value ="";

                    txtGeneratedtype.Value ="";

                    txtUitype.Value ="";

                    txtFieldname.Value ="";

                    txtFieldlabel.Value ="";

                    txtReadonly.Value ="";

                    txtPresence.Value ="";

                    txtSelected.Value ="";

                    txtMaximumlength.Value ="";

                    txtSequence.Value ="";

                    txtBlock.Value ="";

                    txtDisplaytype.Value ="";

                    txtTypeofdata.Value ="";

                    txtQuickcreate.Value ="";

                    txtQuickcreatesequence.Value ="";

                    txtInfo_type.Value ="";

                    txtCtrlType.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["Fieldid"]))
        {
            keyid = Request["Fieldid"];
        }

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

            txtUitype.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Uitype));
            txtReadonly.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Readonly));
            txtPresence.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Presence));
            txtSelected.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Selected));
            txtDisplaytype.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Displaytype));
            txtQuickcreate.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Quickcreate));
            txtInfo_type.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.Info_type));
            txtCtrlType.Items.AddRange(FormHelper.GetListItem(Ec_field.Attribute.CtrlType));

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

                    txtFieldid.Value = Convert.ToString(valObj.Fieldid);//Convert.ToInt32

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

                    txtColumnname.Value = Convert.ToString(valObj.Columnname);//Convert.ToString

                    txtTablename.Value = Convert.ToString(valObj.Tablename);//Convert.ToString

                    txtGeneratedtype.Value = Convert.ToString(valObj.Generatedtype);//Convert.ToInt32

                    txtUitype.Value=valObj.Uitype.ToString();

                    txtFieldname.Value = Convert.ToString(valObj.Fieldname);//Convert.ToString

                    txtFieldlabel.Value = Convert.ToString(valObj.Fieldlabel);//Convert.ToString

                    txtReadonly.Value=valObj.Readonly.ToString();

                    txtPresence.Value=valObj.Presence.ToString();

                    txtSelected.Value=valObj.Selected.ToString();

                    txtMaximumlength.Value = Convert.ToString(valObj.Maximumlength);//Convert.ToInt32

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

                    txtBlock.Value = Convert.ToString(valObj.Block);//Convert.ToInt32

                    txtDisplaytype.Value=valObj.Displaytype.ToString();

                    txtTypeofdata.Value = Convert.ToString(valObj.Typeofdata);//Convert.ToString

                    txtQuickcreate.Value=valObj.Quickcreate.ToString();

                    txtQuickcreatesequence.Value = Convert.ToString(valObj.Quickcreatesequence);//Convert.ToInt32

                    txtInfo_type.Value=valObj.Info_type.ToString();

                    txtCtrlType.Value=valObj.CtrlType.ToString();
                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        title = valObj._ZhName + "��ϸ";
        Page.Title = title;
        if (!IsPostBack)
        {
            try
            {
                if (!string.IsNullOrEmpty(Request["Fieldid"]))
                {

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

                    txtFieldid.Text = Convert.ToString(valObj.Fieldid);//Convert.ToInt32

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

                    txtColumnname.Text = Convert.ToString(valObj.Columnname);//Convert.ToString

                    txtTablename.Text = Convert.ToString(valObj.Tablename);//Convert.ToString

                    txtGeneratedtype.Text = Convert.ToString(valObj.Generatedtype);//Convert.ToInt32

                    txtUitype.Text=valObj.Uitype.ToString();

                    txtFieldname.Text = Convert.ToString(valObj.Fieldname);//Convert.ToString

                    txtFieldlabel.Text = Convert.ToString(valObj.Fieldlabel);//Convert.ToString

                    txtReadonly.Text=valObj.Readonly.ToString();

                    txtPresence.Text=valObj.Presence.ToString();

                    txtSelected.Text=valObj.Selected.ToString();

                    txtMaximumlength.Text = Convert.ToString(valObj.Maximumlength);//Convert.ToInt32

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

                    txtBlock.Text = Convert.ToString(valObj.Block);//Convert.ToInt32

                    txtDisplaytype.Text=valObj.Displaytype.ToString();

                    txtTypeofdata.Text = Convert.ToString(valObj.Typeofdata);//Convert.ToString

                    txtQuickcreate.Text=valObj.Quickcreate.ToString();

                    txtQuickcreatesequence.Text = Convert.ToString(valObj.Quickcreatesequence);//Convert.ToInt32

                    txtInfo_type.Text=valObj.Info_type.ToString();

                    txtCtrlType.Text=valObj.CtrlType.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 btnFind_Click(object sender, EventArgs e)
    {
        condObj = new Ec_field();

        if(txtFieldid.Value !="" )
            condObj.Like(Ec_field.Attribute.Fieldid, Convert.ToInt32(txtFieldid.Value));

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

        if(txtColumnname.Value !="" )
            condObj.Like(Ec_field.Attribute.Columnname, Convert.ToString(txtColumnname.Value));

        if(txtTablename.Value !="" )
            condObj.Like(Ec_field.Attribute.Tablename, Convert.ToString(txtTablename.Value));

        if(txtGeneratedtype.Value !="" )
            condObj.Like(Ec_field.Attribute.Generatedtype, Convert.ToInt32(txtGeneratedtype.Value));

        if(txtUitype.Value !="" )
            condObj.Uitype = Convert.ToString(txtUitype.Value);

        if(txtFieldname.Value !="" )
            condObj.Like(Ec_field.Attribute.Fieldname, Convert.ToString(txtFieldname.Value));

        if(txtFieldlabel.Value !="" )
            condObj.Like(Ec_field.Attribute.Fieldlabel, Convert.ToString(txtFieldlabel.Value));

        if(txtReadonly.Value !="" )
            condObj.Readonly = Convert.ToInt32(txtReadonly.Value);

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

        if(txtSelected.Value !="" )
            condObj.Selected = Convert.ToInt32(txtSelected.Value);

        if(txtMaximumlength.Value !="" )
            condObj.Like(Ec_field.Attribute.Maximumlength, Convert.ToInt32(txtMaximumlength.Value));

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

        if(txtBlock.Value !="" )
            condObj.Like(Ec_field.Attribute.Block, Convert.ToInt32(txtBlock.Value));

        if(txtDisplaytype.Value !="" )
            condObj.Displaytype = Convert.ToInt32(txtDisplaytype.Value);

        if(txtTypeofdata.Value !="" )
            condObj.Like(Ec_field.Attribute.Typeofdata, Convert.ToString(txtTypeofdata.Value));

        if(txtQuickcreate.Value !="" )
            condObj.Quickcreate = Convert.ToInt32(txtQuickcreate.Value);

        if(txtQuickcreatesequence.Value !="" )
            condObj.Like(Ec_field.Attribute.Quickcreatesequence, Convert.ToInt32(txtQuickcreatesequence.Value));

        if(txtInfo_type.Value !="" )
            condObj.Info_type = Convert.ToString(txtInfo_type.Value);

        if(txtCtrlType.Value !="" )
            condObj.CtrlType = Convert.ToString(txtCtrlType.Value);

        hidCondition.Value = condObj.ToJson(20);

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

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

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

        listObj = BLLTable<Ec_field>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, curPage, ref recount);
        repList.DataSource = listObj;
        repList.DataBind();
        aspPager.RecordCount = recount;
    }
 protected void btnSetPageSize_Click(object sender, EventArgs e)
 {
     aspPager.PageSize = int.Parse(txtPageSize.Value);
     if (hidCondition.Value != "")
     {
         condObj = JsonServiceBase.FromJson<Ec_field>(hidCondition.Value);
     }
     BindList(condObj, aspPager.CurrentPageIndex);
 }