//-------------------------------------------------------------------------------------------------------------
    private void LoadFormData()
    {
        string strSql = @"
                            select
                            case isnull(c.uid, '') when '' then 0 else 1 end as selected,
                            c.uid,
                            c.Name as 教會名稱,
                            c.Area as 區號,(select  name from codecity where ZipCode=cc.ZipCode ) as 縣市,cc1.Name as 區域,
                            c.Address As 地址,
                            c.priest as 主任牧師,
                            c.Contact as 聯絡窗口
                            --,c.ChurchEmail
                            From Church as c
                            inner join CodeCity cc on c.City = cc.ZipCode
                            inner join CodeCity cc1 on c.Area = cc1.ZipCode
                            where isnull(IsDelete, '') != 'Y'
                        ";

        if (ddlCity.SelectedValue != "")
        {
            strSql += " and City = @City\n";
        }
        if (HFD_Area.Value != "")
        {
            strSql += " and Area = @Area\n";
        }
        if (txtName.Text != "")
        {
            strSql += " and c.Name like @Name\n";
        }

        if (txtpriest.Text != "")
        {
            strSql += " and priest like @priest\n";
        }

        if (txtContact.Text != "")
        {
            strSql += " and Contact like @Contact\n";
        }

        if (txtAddress.Text != "")
        {
            strSql += " and Address like @Address\n";
        }

        strSql += "order BY City,cc.zipcode,CC1.Name \n";
        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("City", ddlCity.SelectedValue);
        dict.Add("Area", HFD_Area.Value);
        dict.Add("Name", "%" + txtName.Text + "%");
        dict.Add("priest", "%" + txtpriest.Text + "%");
        dict.Add("Contact", "%" + txtContact.Text + "%");
        dict.Add("Address", "%" + txtAddress.Text + "%");

        DataTable dt = NpoDB.GetDataTableS(strSql, dict);
        int count = dt.Rows.Count;
        //Grid initial
        //沒有需要特別處理的欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;

        NPOGridViewColumn col;
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("選擇");
        col.ColumnType = NPOColumnType.Checkbox;
        col.ControlKeyColumn.Add("uid");
        col.CaptionWithControl = false;
        col.ControlName.Add("chkSelectLand");
        col.ControlId.Add("chkSelectLand");
        col.ControlValue.Add("0");
        col.ControlText.Add("");
        col.ColumnName.Add("selected");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("教會名稱&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("教會名稱");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("區號");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("區號");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("縣市&nbsp;&nbsp;&nbsp;&nbsp;");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("縣市");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("區域&nbsp;&nbsp;&nbsp;&nbsp;");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("區域");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("地址");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("地址");
        npoGridView.Columns.Add(col);
        //----------------------------------------------------------------------
        col = new NPOGridViewColumn("主任牧師&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("主任牧師");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("聯絡窗口&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("聯絡窗口");
        npoGridView.Columns.Add(col);

        //col = new NPOGridViewColumn("Email");
        //col.ColumnType = NPOColumnType.NormalText;
        //col.ColumnName.Add("ChurchEmail");
        //npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        lblGridList.Text = npoGridView.Render();
    }
Example #2
0
    private void LoadFormData()
    {
        //呼叫資料庫GetDataTable
        DataTable dt = GetDataTable();
        //Grid initial
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.DisableColumn.Add("itemuid");
        npoGridView.DisableColumn.Add("classuid");

        npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
           // npoGridView.EditLink = Util.RedirectByTime("Act_Edit.aspx", "Mode=Edit&Uid=");

        //kuofly20150325調整畫面的cell
        NPOGridViewColumn col;
        col = new NPOGridViewColumn("類別"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("類別"); //使用欄位名稱
        col.CellStyle = "width:200px";
        npoGridView.Columns.Add(col);

        col = new NPOGridViewColumn("項目"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("項目"); //使用欄位名稱
        col.CellStyle = "width:200px";
        npoGridView.Columns.Add(col);

        col = new NPOGridViewColumn("活動日期"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("活動日期"); //使用欄位名稱
        col.CellStyle = "width:50px";
        npoGridView.Columns.Add(col);

        col = new NPOGridViewColumn("人數"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("人數"); //使用欄位名稱
        col.CellStyle = "width:50px";
        npoGridView.Columns.Add(col);

        col = new NPOGridViewColumn("參加者"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("參加者"); //使用欄位名稱
        col.CellStyle = "width:100px;word-wrap: break-word;";
        npoGridView.Columns.Add(col);

        //

        lblGridList.Text = npoGridView.Render();
    }
Example #3
0
    //-------------------------------------------------------------------------------------------------------------
    private void LoadFormData()
    {
        string strSql = @"
                        select a.uid as uid, CName As  姓名,b.Memo as [備註],Phone As 電話, convert(varchar(19), CreateDate,120) as 建檔時間,
                         REVERSE(SUBSTRING(REVERSE(ConsultantMain),CHARINDEX(',',REVERSE(ConsultantMain))+1,LEN(ConsultantMain))) [來電諮詢別(大類)],
                         REVERSE(SUBSTRING(REVERSE(ConsultantItem),CHARINDEX(',',REVERSE(ConsultantItem))+1,LEN(ConsultantItem))) [來電諮詢別(分項)]
            --, ConsultantMain as [來電諮詢別(大類)], ConsultantItem  as [來電諮詢別(分項)]
                        from Consulting a  inner join Member b on a.MemberUID = b.uid
                        where 1=1
                        and isnull(a.IsDelete, '') != 'Y'
                    ";

        if (SessionInfo.GroupName == "系統管理員")
        {
        }
        else
        {
            strSql += " and ServiceUser = @ServiceUser\n";
        }

        if (txtPhone.Text.Trim() != "")
        {
            strSql += " and Phone like @Phone\n";
        }

        if (txtName.Text.Trim() != "")
        {
            strSql += " and CName like @CName\n";
        }

        if (txtBegCreateDate.Text.Trim() != "" && txtEndCreateDate.Text.Trim() != "")
        {
            strSql += " and CONVERT(varchar(100), CreateDate, 111) Between @BegCreateDate And @EndCreateDate\n";
        }
        strSql += " Order by CreateDate desc";
        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("CName", "%" + txtName.Text.Trim() + "%");
        dict.Add("Phone", '%' + txtPhone.Text.Trim() + '%');
        dict.Add("BegCreateDate", txtBegCreateDate.Text.Trim());
        dict.Add("EndCreateDate", txtEndCreateDate.Text.Trim());
        dict.Add("ServiceUser", SessionInfo.UserID.ToString());
        DataTable dt = NpoDB.GetDataTableS(strSql, dict);

        if (dt.Rows.Count == 0)
        {
            lblGridList.Text = "";
            ShowSysMsg("查無資料");
            return;
        }

            //********************************************************************************************
            //自訂欄位
            NPOGridView npoGridView = new NPOGridView();
            //來源種類
            npoGridView.Source = NPOGridViewDataSource.fromDataTable;
            //使用的 DataTable
            npoGridView.dataTable = dt;
            //不要顯示的欄位(可以多個)

            npoGridView.DisableColumn.Add("uid");
            npoGridView.EditLinkTarget = "','target=_blank,help=no,status=yes,resizable=yes,scrollbars=yes,scrolling=yes,scroll=yes,center=yes,width=900px,height=500px";
            npoGridView.EditLink = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");

            //使用的 key 欄位,用在組成 QueryString 的 key 值(EditLink 會用到)
            npoGridView.Keys.Add("uid");

            //如果 GridView 要翻頁, 要設定 CurrentPage 的值
            if (npoGridView.ShowPage == true)
            {
                npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
            }

            NPOGridViewColumn col;
            col = new NPOGridViewColumn("姓名"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("姓名"); //使用欄位名稱
            col.CellStyle = "width:100px";
            npoGridView.Columns.Add(col);

            col = new NPOGridViewColumn("備註"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("備註"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:200px";
            npoGridView.Columns.Add(col);
            //----------------------------------------------
            col = new NPOGridViewColumn("電話"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("電話"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:150px;word-break: break-all;";
            npoGridView.Columns.Add(col);
            // lblGridList.Text = npoGridView.Render();
            //----------------------------------------------------------
            col = new NPOGridViewColumn("建檔時間"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("建檔時間"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:150px";
            npoGridView.Columns.Add(col);
            //----------------------------------------------------------
            col = new NPOGridViewColumn("來電諮詢別(大類)"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("來電諮詢別(大類)"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:200px";
            npoGridView.Columns.Add(col);
            //----------------------------------------------------------
            col = new NPOGridViewColumn("來電諮詢別(分項)"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("來電諮詢別(分項)"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:200px";
            npoGridView.Columns.Add(col);
            lblGridList.Text = npoGridView.Render();
        //----------------------------------------------------------
        //********************************************************************************************
    }
Example #4
0
    //-------------------------------------------------------------------------------------------------------------
    private void LoadFormData()
    {
        //呼叫資料庫GetDataTable
        DataTable dt = GetDataTable();
        if (dt.Rows.Count == 0)
        {
            lblGridList.Text = "";
            ShowSysMsg("查無資料");
            return;
        }

            //********************************************************************************************
            //自訂欄位
            NPOGridView npoGridView = new NPOGridView();
            //來源種類
            npoGridView.Source = NPOGridViewDataSource.fromDataTable;
            //使用的 DataTable
            npoGridView.dataTable = dt;
            //不要顯示的欄位(可以多個)

            npoGridView.DisableColumn.Add("uid");
            npoGridView.EditLinkTarget = "','target=_blank,help=no,status=yes,resizable=yes,scrollbars=yes,scrolling=yes,scroll=yes,center=yes,width=900px,height=500px";
            //npoGridView.EditLink = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");

            //使用的 key 欄位,用在組成 QueryString 的 key 值(EditLink 會用到)
            npoGridView.Keys.Add("uid");

            //如果 GridView 要翻頁, 要設定 CurrentPage 的值
            if (npoGridView.ShowPage == true)
            {
                npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
            }

            NPOGridViewColumn col;
            col = new NPOGridViewColumn("姓名"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("姓名"); //使用欄位名稱
            col.CellStyle = "width:100px";
            npoGridView.Columns.Add(col);

            col = new NPOGridViewColumn("備註"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("備註"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:200px";
            npoGridView.Columns.Add(col);
            //----------------------------------------------
            col = new NPOGridViewColumn("電話"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("電話"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:150px";
            npoGridView.Columns.Add(col);
            // lblGridList.Text = npoGridView.Render();
            //----------------------------------------------------------
            col = new NPOGridViewColumn("建檔時間"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("建檔時間"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:150px";
            npoGridView.Columns.Add(col);
                //----------------------------------------------------------
            col = new NPOGridViewColumn("來電諮詢別(大類)"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("來電諮詢別(大類)"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:200px";
            npoGridView.Columns.Add(col);
            //----------------------------------------------------------
            col = new NPOGridViewColumn("來電諮詢別(分項)"); //產生所需欄位及設定 Title
            col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
            col.ColumnName.Add("來電諮詢別(分項)"); //使用欄位名稱
            col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
            col.CellStyle = "width:200px";
            npoGridView.Columns.Add(col);
            lblGridList.Text = npoGridView.Render();
        //----------------------------------------------------------
        //********************************************************************************************
    }
    //---------------------------------------------------------------------------
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        btnUpdate.Enabled = GetQuarterDateCount("", ""); //該季若個人班表裡沒有資料就不能作編輯(是只該日期區間有沒有資料只要日期區間不用UserID)
        btnAdd.Visible = false;
        Dictionary<string, object> dict = new Dictionary<string, object>();
        string strSql = @"
                          select convert(char(10), SchDate, 111) as SchDate,
                          periodA,periodB,periodC ,UserName,
                          Case when periodA <> '' and periodA is not null then UserName +'('+ periodA +')' end as 上午班,
                          Case when periodB <> '' and periodB is not null then UserName +'('+ periodB +')' end as 下午班,
                          Case when periodC <> '' and periodC is not null then UserName +'('+ periodC +')' end as 晚上班
                          from ScheduleDetail s
                          inner join AdminUser u on s.UserID=u.UserID
                          where 1=1
                         ";
        strSql += "and CONVERT(char(7), SchDate, 111)=@SchDate\n";
        if (ddlVoluntee.SelectedValue != "")
        {
            strSql += "and s.UserID=@UserID\n";
        }
        strSql += "order by SchDate\n";
        dict.Add("UserID", ddlVoluntee.SelectedValue);
        dict.Add("SchDate", GetYearMonth());
        DataTable dt = NpoDB.GetDataTableS(strSql, dict);

        Dictionary<string, ScheduleUser> UserList = new Dictionary<string, ScheduleUser>();
        foreach (DataRow dr in dt.Rows)
        {
            string ScheduleDate = dr["SchDate"].ToString();
            ScheduleUser User;
            if (UserList.ContainsKey(ScheduleDate))
            {
                User = UserList[ScheduleDate];
            }
            else
            {
                User = new ScheduleUser();
                UserList.Add(ScheduleDate, User);
            }
            if (dr["上午班"].ToString() != "")
            {
                User.ScheduleAM += dr["上午班"].ToString() + ",";
            }
            if (dr["下午班"].ToString() != "")
            {
                User.SchedulePM += dr["下午班"].ToString() + ",";
            }
            if (dr["晚上班"].ToString() != "")
            {
                User.ScheduleNM += dr["晚上班"].ToString() + ",";
            }
        }
        dt = CreateQueryTable(UserList);
        //需自訂欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;
        //-----------------------------------------------------------------------
        //欄位為 checkbox
        NPOGridViewColumn col = new NPOGridViewColumn("日期");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("日期");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("星期");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("星期");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("上午班");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("上午班");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("下午班");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("下午班");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("晚上班");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("晚上班");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        lblGridList.Text = npoGridView.Render();
    }
Example #6
0
    //------------------------------------------------------------------------------
    public void GetConsultData()
    {
        string strSql = @"
                        select  a.uid as uid, CName As  姓名,b.Memo as 備註,Phone As 電話, convert(varchar(19), CreateDate,120) as 建檔時間, ConsultantMain as [來電諮詢別(大類)], ConsultantItem  as [來電諮詢別(分項)]
                        from Consulting a  inner join Member b on a.MemberUID = b.uid
                        where 1=1
                        and isnull(a.IsDelete, '') != 'Y' and isnull(b.IsDelete, '') != 'Y'
                        And
                        (((ISNULL(Overseas,'')='' AND ISNULL(city,'')=''))
                        or ((ISNULL(HarassPhone,'') <> '' AND   ISNULL(Special,'') <>'')  AND  (ISNULL(ConsultantMain,'')='' or isnull(ConsultantItem,'')=''))
                        OR ((ISNULL(HarassPhone,'') = '' AND ISNULL(Special,'')='')  AND  (ISNULL(ConsultantMain,'')='' or isnull(ConsultantItem,'')=''))
                        OR( ISNULL(CName,'')='' OR ISNULL(sex,'')='' OR ISNULL(Marry,'')='' OR ISNULL(Christian,'')='' OR ISNULL(Event,'')='' OR  ISNULL(CreateDate,'')='' OR  ISNULL(EndDate,'')='') )
                        ";
        strSql += " And ServiceUser=@ServiceUser ";
        //if (SessionInfo.GroupID != "1")
        //{
        //    strSql += " And ServiceUser=@ServiceUser ";
        //}
        strSql += " Order by CreateDate desc";

        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("ServiceUser", SessionInfo.UserID.ToString());
        DataTable dt = NpoDB.GetDataTableS(strSql, dict);
        int count = dt.Rows.Count;

        //Grid initial
        //沒有需要特別處理的欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        //npoGridView.dataTable = dt;
        //npoGridView.Keys.Add("uid");
        //npoGridView.DisableColumn.Add("uid");
        //npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
        //Response.Write(@"<script>window.parent.location.href='ConsultEdit2.aspx';</script>");
        //npoGridView.EditLinkTarget = "','target=_blank,help=no,status=yes,resizable=yes,scrollbars=yes,scrolling=yes,scroll=yes,center=yes,width=900px,height=500px";
        //npoGridView.EditLink = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");
        //return npoGridView.Render();
         //lblConsult.Text = npoGridView.Render();
        //********************************************************************************************
        //自訂欄位
        //NPOGridView npoGridView = new NPOGridView();
        //來源種類
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        //使用的 DataTable
        npoGridView.dataTable = dt;
        //不要顯示的欄位(可以多個)

        npoGridView.DisableColumn.Add("uid");
        npoGridView.EditLinkTarget = "','target=_blank,help=no,status=yes,resizable=yes,scrollbars=yes,scrolling=yes,scroll=yes,center=yes,width=900px,height=500px";
        npoGridView.EditLink = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");

        //使用的 key 欄位,用在組成 QueryString 的 key 值(EditLink 會用到)
        npoGridView.Keys.Add("uid");

        //如果 GridView 要翻頁, 要設定 CurrentPage 的值
        if (npoGridView.ShowPage == true)
        {
            npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
        }
        NPOGridViewColumn col;
        col = new NPOGridViewColumn("姓名"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("姓名"); //使用欄位名稱
        col.CellStyle = "width:100px";
        npoGridView.Columns.Add(col);

        col = new NPOGridViewColumn("備註"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("備註"); //使用欄位名稱
        col.Link = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");
        col.CellStyle = "width:200px";
        npoGridView.Columns.Add(col);
        //----------------------------------------------
        col = new NPOGridViewColumn("電話"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("電話"); //使用欄位名稱
        col.Link = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");
        col.CellStyle = "width:150px";
        npoGridView.Columns.Add(col);
        // lblGridList.Text = npoGridView.Render();
        //----------------------------------------------------------
        col = new NPOGridViewColumn("建檔時間"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("建檔時間"); //使用欄位名稱
        col.Link = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");
        col.CellStyle = "width:150px";
        npoGridView.Columns.Add(col);
        //----------------------------------------------------------
        col = new NPOGridViewColumn("來電諮詢別(大類)"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("來電諮詢別(大類)"); //使用欄位名稱
        col.Link = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");
        col.CellStyle = "width:200px";
        npoGridView.Columns.Add(col);
        //----------------------------------------------------------
        col = new NPOGridViewColumn("來電諮詢別(分項)"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("來電諮詢別(分項)"); //使用欄位名稱
        col.Link = Util.RedirectByTime("../CaseMgr/ConsultEdit2.aspx", "ConsultingUID=");
        col.CellStyle = "width:200px";
        npoGridView.Columns.Add(col);
        lblConsult.Text = npoGridView.Render();
        //----------------------------------------------------------
        //********************************************************************************************
    }
Example #7
0
    private string LoadConsultQry()
    {
        string strSql = @"
                        select  a.uid as uid, CName As  姓名,b.Memo as [備註] , Phone As 電話, convert(varchar(19), CreateDate,120) as 建檔時間, ConsultantMain as [來電諮詢別(大類)], ConsultantItem  as [來電諮詢別(分項)]
                        from Consulting a  inner join Member b on a.MemberUID = b.uid
                        where 1=1
                        and isnull(a.IsDelete, '') != 'Y'
                        ";
         string Phone = Request.Form["Phone"];
         string Event = Request.Form["Event"];
         string CName = Request.Form["CName"];
         string Marry = Request.Form["Marry"];
         string BegCreateDate = Request.Form["BegCreateDate"];
         string EndCreateDate = Request.Form["EndCreateDate"];
         string City = Request.Form["City"];
         string Address = Request.Form["Address"];
         string ConsultantItem = Request.Form["ConsultantItem"];
         string ZipCode = Request.Form["ZipCode"];
         	 string ServiceUser = Request.Form["ServiceUser"];
         string EditServiceUser = Request.Form["EditServiceUser"];

         if (Phone != "")
         {
         strSql += " and Phone like @Phone\n";
         }

         if (Event != "")
         {
         strSql += " and Event like @Event\n";
         }

         if (CName != "")
         {
         strSql += " and CName like @CName\n";
         }

         if (Marry != "")
         {
         strSql += " and Marry like @Marry\n";
         }

         if (BegCreateDate != "" && EndCreateDate != "")
         {
         strSql += " and CONVERT(varchar(100), CreateDate, 111) Between @BegCreateDate And @EndCreateDate\n";
         }

         if (City != "")
         {
         strSql += " and City = @City\n";
         }
         if (ZipCode != "")
         {
         strSql += " And ZipCode=@ZipCode\n";
         }

         if (Address != "")
         {
         strSql += " and a.Address like @Address\n";
         }
         if (ConsultantItem != "")
         {
         strSql += " And ConsultantItem like @ConsultantItem\n";
         }
         //if (ServiceUser != "")
         //{
         //    strSql += " and ServiceUser like @ServiceUser\n";
         //}
         if (EditServiceUser != "sys")
         {
         if (EditServiceUser != "")
         {
             strSql += " and ServiceUser=@ServiceUser\n";
         }
         }
         strSql += " Order by CreateDate desc";
          Dictionary<string, object> dict = new Dictionary<string, object>();
          dict.Add("CName", "%" + CName + "%");
          dict.Add("Phone", "%" + Phone + "%");
          dict.Add("Event", "%" + Event + "%");
          dict.Add("Marry", "%" + Marry + "%");
          dict.Add("BegCreateDate", "%" + BegCreateDate + "%");
          dict.Add("EndCreateDate", EndCreateDate);
          dict.Add("City", City);
          dict.Add("ZipCode", ZipCode);
          dict.Add("Address", "%" + Address + "%");
          dict.Add("ConsultantItem", "%" + ConsultantItem + "%");
        //dict.Add("ServiceUser",  ServiceUser );
          dict.Add("ServiceUser",  EditServiceUser);

          DataTable dt = NpoDB.GetDataTableS(strSql, dict);
          string Uid = Request.Form["Uid"];
          //********************************************************************************************
          //自訂欄位
          NPOGridView npoGridView = new NPOGridView();
          //來源種類
          npoGridView.Source = NPOGridViewDataSource.fromDataTable;
          //使用的 DataTable
          npoGridView.dataTable = dt;
          //不要顯示的欄位(可以多個)

          npoGridView.TableID = "tblDemo";

          npoGridView.DisableColumn.Add("uid");
          npoGridView.EditLinkTarget = "','target=_blank,help=no,status=yes,resizable=yes,scrollbars=yes,scrolling=yes,scroll=yes,center=yes,width=900px,height=500px";
          npoGridView.EditLink = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");

          //使用的 key 欄位,用在組成 QueryString 的 key 值(EditLink 會用到)
          npoGridView.Keys.Add("uid");
          NPOGridViewColumn col;
          col = new NPOGridViewColumn("姓名"); //產生所需欄位及設定 Title
          col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
          col.ColumnName.Add("姓名"); //使用欄位名稱
          col.CellStyle = "width:100px";
          // col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
          npoGridView.Columns.Add(col);
          //----------------------------------------
          //  npoGridView.Keys.Add("uid");

          col = new NPOGridViewColumn("備註"); //產生所需欄位及設定 Title
          col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
          col.ColumnName.Add("備註"); //使用欄位名稱
          col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
          col.CellStyle = "width:200px";
          npoGridView.Columns.Add(col);
          //----------------------------------------------
          col = new NPOGridViewColumn("電話"); //產生所需欄位及設定 Title
          col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
          col.ColumnName.Add("電話"); //使用欄位名稱
          col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
          col.CellStyle = "width:150px";
          npoGridView.Columns.Add(col);
          // lblGridList.Text = npoGridView.Render();
          //----------------------------------------------------------
          col = new NPOGridViewColumn("建檔時間"); //產生所需欄位及設定 Title
          col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
          col.ColumnName.Add("建檔時間"); //使用欄位名稱
          col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
          col.CellStyle = "width:150px";
          npoGridView.Columns.Add(col);
          //  lblGridList.Text = npoGridView.Render();
          //----------------------------------------------------------
          col = new NPOGridViewColumn("來電諮詢別(大類)"); //產生所需欄位及設定 Title
          col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
          col.ColumnName.Add("來電諮詢別(大類)"); //使用欄位名稱
          col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
          col.CellStyle = "width:200px";
          npoGridView.Columns.Add(col);
          //lblGridList.Text = npoGridView.Render();
          ////----------------------------------------------------------
          col = new NPOGridViewColumn("來電諮詢別(分項)"); //產生所需欄位及設定 Title
          col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
          col.ColumnName.Add("來電諮詢別(分項)"); //使用欄位名稱
          col.Link = Util.RedirectByTime("ConsultEdit2.aspx", "ConsultingUID=");
          col.CellStyle = "width:200px";
          npoGridView.Columns.Add(col);
          //********************************************************************************************
          return npoGridView.Render();
    }
    //----------------------------------------------------------------------------
    public void LoadFormData()
    {
        DataTable dt = CreateTable();

        string UserID = ddlVoluntee.SelectedValue;
        string YearMonth = GetYearMonth();
        DataTable dtSchedule = Util.GetDataTable("ScheduleDetail", "UserID", UserID, "CONVERT(char(7), SchDate, 111)", YearMonth, "SchDate", "");

        foreach (DataRow dr in dtSchedule.Rows)
        {
            DateTime d = (DateTime)dr["SchDate"];
            dt.Rows[d.Day - 1]["上午班"] = dr["periodA"].ToString();
            dt.Rows[d.Day - 1]["下午班"] = dr["periodB"].ToString();
            dt.Rows[d.Day - 1]["晚上班"] = dr["periodC"].ToString();
        }
        //需自訂欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;
        //-----------------------------------------------------------------------
        //欄位為 checkbox
        NPOGridViewColumn col = new NPOGridViewColumn("日期");
        col.ColumnType = NPOColumnType.Textbox;
        col.ControlKeyColumn.Add("uid");
        col.Readonly = true;

        col.ControlName.Add("txtScheduleDate");
        col.ControlId.Add("txtScheduleDate");
        //col.ControlValue.Add("1");
        col.ColumnName.Add("日期");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------

        col = new NPOGridViewColumn("星期");
        col.ColumnType = NPOColumnType.Textbox;
        col.ControlKeyColumn.Add("uid");
        col.Readonly = true;

        col.ControlName.Add("txtDayWeek");
        col.ControlId.Add("txtDayWeek");
        col.ColumnName.Add("星期");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------

        col = new NPOGridViewColumn("上午班");
        col.ColumnType = NPOColumnType.Dropdownlist;
        col.ControlKeyColumn.Add("uid");
        col.ControlName.Add("chkperiodA");
        col.ControlId.Add("chkperiodA");
        col.ColumnName.Add("上午班");
           col.ControlOptionText.Add("");
           col.ControlOptionText.Add("正常班");
           col.ControlOptionText.Add("加班");
           col.ControlOptionText.Add("補班");
           col.ControlOptionText.Add("代班");
           col.ControlOptionValue.Add("");
           col.ControlOptionValue.Add("正常班");
           col.ControlOptionValue.Add("加班");
           col.ControlOptionValue.Add("補班");
           col.ControlOptionValue.Add("代班");
           npoGridView.Columns.Add(col);

        //-------------------------------------------------------------------------
           col = new NPOGridViewColumn("下午班");
           col.ColumnType = NPOColumnType.Dropdownlist;
           col.ControlKeyColumn.Add("uid");
           col.ControlName.Add("chkperiodB");
           col.ControlId.Add("chkperiodB");
           col.ColumnName.Add("下午班");
           col.ControlOptionText.Add("");
           col.ControlOptionText.Add("正常班");
           col.ControlOptionText.Add("加班");
           col.ControlOptionText.Add("補班");
           col.ControlOptionText.Add("代班");
           col.ControlOptionValue.Add("");
           col.ControlOptionValue.Add("正常班");
           col.ControlOptionValue.Add("加班");
           col.ControlOptionValue.Add("補班");
           col.ControlOptionValue.Add("代班");
           npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        //-------------------------------------------------------------------------
           col = new NPOGridViewColumn("晚上班");
           col.ColumnType = NPOColumnType.Dropdownlist;
           col.ControlKeyColumn.Add("uid");
           col.ControlName.Add("chkperiodC");
           col.ControlId.Add("chkperiodC");
           col.ColumnName.Add("晚上班");
           col.ControlOptionText.Add("");
           col.ControlOptionText.Add("正常班");
           col.ControlOptionText.Add("加班");
           col.ControlOptionText.Add("補班");
           col.ControlOptionText.Add("代班");
           col.ControlOptionValue.Add("");
           col.ControlOptionValue.Add("正常班");
           col.ControlOptionValue.Add("加班");
           col.ControlOptionValue.Add("補班");
           col.ControlOptionValue.Add("代班");
           npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        lblGridList.Text = npoGridView.Render();
    }
Example #9
0
    //-------------------------------------------------------------------------------------------------------------
    private void LoadFormData()
    {
        string strSql = @"
                            select Distinct  a.uid , a.CName AS 姓名,a.Memo as 備註 ,a.Phone AS 電話
                            from Member a
                            inner join Consulting b on  a.uid = b.MemberUID
                            where 1=1 and isnull(a.IsDelete, '') != 'Y'  and isnull(b.IsDelete, '') != 'Y'
                          ";

        if (txtServiceUser.Text.Trim()  != "")
        {
            strSql += " and ServiceUser = @ServiceUser\n";
        }

        if (HFD_Marry.Value != "")
        {
            strSql += " and Marry like @Marry\n";
        }

        if (txtEvent.Text.Trim() != "")
        {
            strSql += " and Event like @Event\n";
        }

        if (txtPhone.Text.Trim() != "")
        {
            strSql += " and Phone like @Phone\n";
        }

        if (txtName.Text.Trim() != "")
        {
            strSql += " and CName like @CName\n";
        }

        if (txtBegCreateDate.Text.Trim() != "" && txtEndCreateDate.Text.Trim() != "")
        {
            strSql += " and CONVERT(varchar(100), CreateDate, 111) Between @BegCreateDate And @EndCreateDate\n";
        }

        if (txtZipCode.Text.Trim() != "")
        {
            strSql += " And ZipCode=@ZipCode\n";
        }

        if (ddlCity.SelectedValue != "")
        {
            strSql += " And City=@City\n";
        }

        if (txtAddress.Text.Trim() != "")
        {
            strSql += " and Address like @Address\n";
        }

        if (HFD_ConsultantItem.Value != "")
        {
         strSql += " And ConsultantItem like @ConsultantItem\n";
        }
        //是否為基督徒 20150721新增
        if (rblChristian.SelectedValue == "1")
        {
            strSql += " and  a.Christian = '是'";
        }
        else if (rblChristian.SelectedValue == "2")
        {
            strSql += " and  a.Christian = '否'";
        }
        else
        {
            strSql += " ";
        }

        strSql += " Order by CName desc";

        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("Event", "%" + txtEvent.Text.Trim() + "%");
        dict.Add("CName", "%" + txtName.Text.Trim() + "%");
        dict.Add("Marry",  HFD_Marry.Value.ToString().TrimEnd(',') );
        dict.Add("Phone", '%' + txtPhone.Text.Trim() + '%');
        dict.Add("BegCreateDate", txtBegCreateDate.Text.Trim());
        dict.Add("EndCreateDate", txtEndCreateDate.Text.Trim());
        dict.Add("ServiceUser", txtServiceUser.Text.Trim());
        //dict.Add("EditServiceUser", SessionInfo.UserID.ToString());
        dict.Add("ZipCode", txtZipCode.Text.Trim());
        dict.Add("City", ddlCity.SelectedValue);
        dict.Add("Address", "%" + txtAddress.Text.Trim() + "%");
        dict.Add("ConsultantItem", "%" + HFD_ConsultantItem.Value + "%");
        DataTable dt = NpoDB.GetDataTableS(strSql, dict);

        //int count = dt.Rows.Count;

        HFD_MemberID.Value = "";
        if (dt.Rows.Count == 0)
        {
            lblGridList.Text = "";
            ShowSysMsg  ("查無資料");
            return;
        }
        else
        {
            //int i = dt.Rows.Count;
            //for (i = 0; i <= dt.Rows.Count - 1; i++)
            //{
            //    HFD_MemberID.Value = HFD_MemberID.Value + dt.Rows[i]["memberuid"].ToString() + ",";
            //}
        }
           // dr = dt.Rows[0];

        //lblReport.Text = GetRptHead() + GetReport();   //報表資料
        //Grid initial
        //沒有需要特別處理的欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        //npoGridView.Keys.Add("uid");
        //npoGridView.DisableColumn.Add("uid");
        npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
        //Response.Write(@"<script>window.parent.location.href='ConsultEdit2.aspx';</script>");
        //npoGridView.EditLinkTarget = "','target=_blank,help=no,status=yes,resizable=yes,scrollbars=yes,scrolling=yes,scroll=yes,center=yes,width=900px,height=500px";
        npoGridView.EditLink = Util.RedirectByTime("QryReport.aspx", "uid=");
        //lblGridList.Text = npoGridView.Render();
        //使用的 key 欄位,用在組成 QueryString 的 key 值(EditLink 會用到)
        npoGridView.Keys.Add("uid");

        //如果 GridView 要翻頁, 要設定 CurrentPage 的值
        if (npoGridView.ShowPage == true)
        {
            npoGridView.CurrentPage = Util.String2Number(HFD_CurrentPage.Value);
        }

        NPOGridViewColumn col;
        col = new NPOGridViewColumn("姓名"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("姓名"); //使用欄位名稱
        col.CellStyle = "width:100px";
        npoGridView.Columns.Add(col);

        col = new NPOGridViewColumn("備註"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("備註"); //使用欄位名稱
        npoGridView.EditLink = Util.RedirectByTime("QryReport.aspx", "uid=");
        col.CellStyle = "width:200px";
        npoGridView.Columns.Add(col);
        //----------------------------------------------
        col = new NPOGridViewColumn("電話"); //產生所需欄位及設定 Title
        col.ColumnType = NPOColumnType.NormalText; //設定為純顯示文字
        col.ColumnName.Add("電話"); //使用欄位名稱
        npoGridView.EditLink = Util.RedirectByTime("QryReport.aspx", "uid=");
        col.CellStyle = "width:150px";
        npoGridView.Columns.Add(col);

        lblGridList.Text = npoGridView.Render();

        //if (Util.GetQueryString("menu_id") == "48")
        //{
        //    lblGridList.Text = npoGridView.Render();
        //}
        //else
        //{
        //    lblReport.Text = GetRptHead() + GetReport();   //報表資料
        //}
    }
    //-------------------------------------------------------------------------------------------------------------
    private void LoadFormData()
    {
        string strSql = @"
                        select
                        case isnull(uid, '') when '' then 0 else 1 end as selected  ,
                         uid, CName As  姓名,Memo as 備註,Phone As 電話
                        from Member
                        where 1=1
                        and isnull(IsDelete, '') != 'Y'
                    ";

        if (txtPhone.Text.Trim() != "")
        {
            strSql += " and Phone like @Phone\n";
        }

        if (txtName.Text.Trim() != "")
        {
            strSql += " and CName like @CName\n";
        }

        if (txtMemo.Text.Trim() != "")
        {
            strSql += " and Memo like @Memo\n";
        }

        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("CName", "%" + txtName.Text.Trim() + "%");
        dict.Add("Phone", '%' + txtPhone.Text.Trim() + '%');
        dict.Add("Memo", '%' + txtMemo.Text.Trim() + '%');
        DataTable dt = NpoDB.GetDataTableS(strSql, dict);
        int count = dt.Rows.Count;

        //Grid initial
        //沒有需要特別處理的欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;

        NPOGridViewColumn col;
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("選擇");
        col.ColumnType = NPOColumnType.Checkbox;
        col.ControlKeyColumn.Add("uid");
        col.CaptionWithControl = false;

        col.ControlName.Add("chkSelectUid");
        col.ControlId.Add("chkSelectUid");
        col.ControlValue.Add("0");
        col.ControlText.Add("");
        col.ColumnName.Add("selected");

        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("姓名");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("姓名");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("備註");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("備註");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("電話");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("電話");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------

        lblGridList.Text = npoGridView.Render();
    }
Example #11
0
    //-------------------------------------------------------------------------------------------------------------
    public static string GetLandList(string HouseUID)
    {
        string strSql = @"
                            select ld.uid,
                            ld.LandNo as [�g�a�a��],
                            ld.LandArea as [�v�a���n]
                            from EstateMap m
                            inner join LandData ld on m.LandUID=ld.uid
                            where 1=1
                            and isnull(ld.IsDelete, '') != 'Y'
                            and HouseUID=@HouseUID
                        ";

        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("HouseUID", HouseUID);

        DataTable dt = NpoDB.GetDataTableS(strSql, dict);
        int count = dt.Rows.Count;

        //Grid initial
        //�S���ݭn�S�O�B�z������
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;
        npoGridView.EditLink = Util.RedirectByTime("LandData_Edit.aspx", "LandUID=");

        NPOGridViewColumn col;
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("�g�a�a��");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("�g�a�a��");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("�v�a���n");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("�v�a���n");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------

        return npoGridView.Render();
    }
Example #12
0
    //---------------------------------------------------------------------------
    public static string GetHouseList(string LandUID)
    {
        string strSql = @"
                            select hd.uid,
                            hd.HouseAddress as [�a�W���a�}(��)],
                            hd.HouseNo as [�ظ�]
                            from EstateMap m
                            inner join HouseData hd on m.HouseUID=hd.uid
                            where 1=1
                            and isnull(hd.IsDelete, '') != 'Y'
                            and LandUID=@LandUID
                        ";

        Dictionary<string, object> dict = new Dictionary<string, object>();
        dict.Add("LandUID", LandUID);

        DataTable dt = NpoDB.GetDataTableS(strSql, dict);
        int count = dt.Rows.Count;

        //Grid initial
        //�S���ݭn�S�O�B�z������
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;
        npoGridView.EditLink = Util.RedirectByTime("HouseData_Edit.aspx", "HouseUID=");

        NPOGridViewColumn col;
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("�a�W���a�}(��)");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("�a�W���a�}(��)");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("�ظ�");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("�ظ�");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------

        return npoGridView.Render();
    }
Example #13
0
    //-------------------------------------------------------------------------------------------------------------
    private void LoadFormData()
    {
        string strSql = @"
                            select
                            case isnull(uid, '') when '' then 0 else 1 end as selected,
                            uid, CName as [姓名],
                            Phone as [電話],
                            FileName as [檔案名稱]
                            From Member
                            where isnull(IsDelete, '') != 'Y'
                        ";

        //if (txtFileName.Text != "")
        //{
        //    strSql += " and FileName like @FileName\n";
        //}

        if (txtPhone.Text != "")
        {
            strSql += " and Phone = @Phone\n";
        }

        if (txtName.Text != "")
        {
            strSql += " and CName like @CName\n";
        }

        Dictionary<string, object> dict = new Dictionary<string, object>();
        //dict.Add("FileName", "%" + txtFileName.Text + "%");
        dict.Add("CName", "%" + txtName.Text + "%");
        dict.Add("Phone", txtPhone.Text);

        DataTable dt = NpoDB.GetDataTableS(strSql, dict);
        int count = dt.Rows.Count;

        //Grid initial
        //沒有需要特別處理的欄位時
        NPOGridView npoGridView = new NPOGridView();
        npoGridView.Source = NPOGridViewDataSource.fromDataTable;
        npoGridView.dataTable = dt;
        npoGridView.Keys.Add("uid");
        npoGridView.DisableColumn.Add("uid");
        npoGridView.ShowPage = false;

        NPOGridViewColumn col;
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("選擇");
        col.ColumnType = NPOColumnType.Checkbox ;
        col.ControlKeyColumn.Add("uid");
        col.CaptionWithControl = false;

        col.ControlName.Add("chkSelectLand");
        col.ControlId.Add("chkSelectLand");
        col.ControlValue.Add("0");
        col.ControlText.Add("");
        col.ColumnName.Add("selected");

        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("姓名");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("姓名");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("電話");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("電話");
        npoGridView.Columns.Add(col);
        //-------------------------------------------------------------------------
        col = new NPOGridViewColumn("檔案名稱");
        col.ColumnType = NPOColumnType.NormalText;
        col.ColumnName.Add("檔案名稱");
        npoGridView.Columns.Add(col);

        lblGridList.Text = npoGridView.Render();
    }