protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new SYS_DATASOURCE();

        if(txtID.Value !="" )
            condObj.Like_OR(SYS_DATASOURCE.Attribute.ID, Convert.ToString(txtID.Value));

        if(txtSourceConnectString.Value !="" )
            condObj.Like_OR(SYS_DATASOURCE.Attribute.SourceConnectString, Convert.ToString(txtSourceConnectString.Value));

        if(txtSourceType.Value !="" )
            condObj.Like_OR(SYS_DATASOURCE.Attribute.SourceType, Convert.ToString(txtSourceType.Value));

        if(txtSourceName.Value !="" )
            condObj.Like_OR(SYS_DATASOURCE.Attribute.SourceName, Convert.ToString(txtSourceName.Value));

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

            listObj = BLLTable<SYS_DATASOURCE>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);
            repList.DataSource = listObj;
            repList.DataBind();
        }
        catch (Exception ex)
        {
             litWarn.Text = ex.Message;
        }
    }
        /// <summary></summary>
        public override ITable af_GetOptionValueSchema()
        {
            SYS_DATASOURCE value = new SYS_DATASOURCE();


            if (BLLTable.IsExistOptionValue(this.TableName(), "ID"))
            {
                value.id_initialized = true;
            }

            if (BLLTable.IsExistOptionValue(this.TableName(), "SourceConnectString"))
            {
                value.sourceconnectstring_initialized = true;
            }

            if (BLLTable.IsExistOptionValue(this.TableName(), "SourceType"))
            {
                value.sourcetype_initialized = true;
            }

            if (BLLTable.IsExistOptionValue(this.TableName(), "SourceName"))
            {
                value.sourcename_initialized = true;
            }

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

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

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

        }
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        title = valObj._ZhName + "��ϸ";
        Page.Title = title;
        if (!IsPostBack)
        {
            try
            {
                if (!string.IsNullOrEmpty(Request["ID"]))
                {

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

                    txtID.Text = Convert.ToString(valObj.ID);//Convert.ToString

                    txtSourceConnectString.Text = Convert.ToString(valObj.SourceConnectString);//Convert.ToString

                    txtSourceType.Text = Convert.ToString(valObj.SourceType);//Convert.ToString

                    txtSourceName.Text = Convert.ToString(valObj.SourceName);//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 aspPager_PageChanged(object sender, EventArgs e)
 {
     try
     {
         recount = aspPager.RecordCount;
         if (hidCondition.Value != "")
         {
             condObj = JsonServiceBase.FromJson<SYS_DATASOURCE>(hidCondition.Value);
         }
         List<SYS_DATASOURCE> listVal = BLLTable<SYS_DATASOURCE>.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 SYS_DATASOURCE();

        if(txtID.Value !="" )
            condObj.Like(SYS_DATASOURCE.Attribute.ID, Convert.ToString(txtID.Value));

        if(txtSourceConnectString.Value !="" )
            condObj.Like(SYS_DATASOURCE.Attribute.SourceConnectString, Convert.ToString(txtSourceConnectString.Value));

        if(txtSourceType.Value !="" )
            condObj.Like(SYS_DATASOURCE.Attribute.SourceType, Convert.ToString(txtSourceType.Value));

        if(txtSourceName.Value !="" )
            condObj.Like(SYS_DATASOURCE.Attribute.SourceName, Convert.ToString(txtSourceName.Value));

        hidCondition.Value = condObj.ToJson(20);

        BindList(condObj, 1);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region//Ĭ�����ص���
        //hideTableColumnList = new List<AttributeItem>();
        //hideTableColumnList.Add(SYS_DATASOURCE.Attribute.EXP1);
        //hideTableColumnList.Add(SYS_DATASOURCE.Attribute.EXP2);
        //hideTableColumnList.Add(SYS_DATASOURCE.Attribute.EXP3);
        //valObj.LoadAllAttributes(true);//��ʱ�Ӵ˴��룬�Ժ��ܸ��½�����Ҫ
        //valObj.Remove(hideTableColumnList);

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

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

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

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

        }
    }
        /// <summary></summary>
        public override ITable af_GetOptionValueSchema()
        {
            SYS_DATASOURCE value = new SYS_DATASOURCE();

            if(BLLTable.IsExistOptionValue(this.TableName(),"ID"))
                value.id_initialized = true;

            if(BLLTable.IsExistOptionValue(this.TableName(),"SourceConnectString"))
                value.sourceconnectstring_initialized = true;

            if(BLLTable.IsExistOptionValue(this.TableName(),"SourceType"))
                value.sourcetype_initialized = true;

            if(BLLTable.IsExistOptionValue(this.TableName(),"SourceName"))
                value.sourcename_initialized = true;

            return value;
        }
 /// <summary>����Դ���� ���һ��ʵ��</summary>
 public static SYS_DATASOURCE GetOneInstance()
 {
     SYS_DATASOURCE value = new SYS_DATASOURCE();
     return value;
 }
Exemple #12
0
        /// <summary>数据源管理 获得一个实例</summary>
        public static SYS_DATASOURCE GetOneInstance()
        {
            SYS_DATASOURCE value = new SYS_DATASOURCE();

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

            if(txtID.Value !="" )
                valObj.ID = Convert.ToString(txtID.Value);

            if(txtSourceConnectString.Value !="" )
                valObj.SourceConnectString = Convert.ToString(txtSourceConnectString.Value);

            if(txtSourceType.Value !="" )
                valObj.SourceType = Convert.ToString(txtSourceType.Value);

            if(txtSourceName.Value !="" )
                valObj.SourceName = Convert.ToString(txtSourceName.Value);

            if (keyid != "")
            {
                valObj.ID = Convert.ToString(keyid);
                count = BLLTable<SYS_DATASOURCE>.Factory(conn).Update(valObj, SYS_DATASOURCE.Attribute.ID);
            }
            else
            {
                count = BLLTable<SYS_DATASOURCE>.Factory(conn).Insert(valObj, SYS_DATASOURCE.Attribute.ID);
                keyid = valObj.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", "if (window.opener){window.opener.returnValue = '" + dataStr + "';}else{window.returnValue = '" + dataStr + "';}window.close();", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true);
                    }
                }
                else
                {

                    txtID.Value ="";

                    txtSourceConnectString.Value ="";

                    txtSourceType.Value ="";

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

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

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

                    txtID.Value = Convert.ToString(valObj.ID);//Convert.ToString

                    txtSourceConnectString.Value = Convert.ToString(valObj.SourceConnectString);//Convert.ToString

                    txtSourceType.Value = Convert.ToString(valObj.SourceType);//Convert.ToString

                    txtSourceName.Value = Convert.ToString(valObj.SourceName);//Convert.ToString
                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }
    private void BindList(SYS_DATASOURCE condObj, int curPage)
    {
        if (condObj.af_PageByAttributeItem == null)//����������û�����ķ�ҳ�������ԣ�����������������
            condObj.af_PageBy(SYS_DATASOURCE.Attribute.ID, Order.Desc);

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

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

        listObj = BLLTable<SYS_DATASOURCE>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, curPage, ref recount);
        repList.DataSource = listObj;
        repList.DataBind();
        aspPager.RecordCount = recount;
    }