예제 #1
0
파일: cfg.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取排序最新一碼
    //''' </summary>
    //''' <param name="TableNme">Table 名稱</param>
    //''' <param name="SrtNme">排序欄位名稱</param>
    //''' <param name="Typ">A:全欄位,B:前幾碼,"":不選</param>
    //''' <param name="TypFdNme">篩選欄位</param>
    //''' <param name="TypFdVal">篩選資料</param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public Int32 getNextSrt(string TableNme, string SrtNme, string Typ = "", string TypFdNme = "", string TypFdVal = "")
    {
        int          Tmp          = 1;
        IzDataSource IzDataSource = new IzDataSource();

        if (Typ == "A")
        { //'全欄位
            IzDataSource.SelectString = "select top 1 " + SrtNme + " from " + TableNme + " where " + TypFdNme + "='" + TypFdVal + "' order by " + SrtNme + " desc";
        }
        else if (Typ == "B")
        { //'前幾碼
            int Num = TypFdVal.Length;
            IzDataSource.SelectString = "select top 1 " + SrtNme + " from " + TableNme + " where left(" + TypFdNme + "," + Num + ")='" + TypFdVal + "' order by " + SrtNme + " desc";
        }
        else
        {
            IzDataSource.SelectString = "select top 1 " + SrtNme + " from " + TableNme + " order by " + SrtNme + " desc";
        }

        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        if (tb.Rows.Count > 0)
        {
            Tmp = Convert.ToInt32(tb.Rows[0][0]) + 10;
        }
        tb.Dispose();
        IzDataSource.Dispose();

        return(Tmp);
    }
예제 #2
0
파일: cfg.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 產生下一位數類別編號
    //''' </summary>
    //''' <param name="Tid">前三碼</param>
    //''' <param name="TidNum">數字位數</param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public String getTypNexTid(String Tid, int TidNum)
    {
        IZCls.StringAccess StringAccess = new IZCls.StringAccess();
        String             StrTmp       = "";
        IzDataSource       IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select top 1 tbTypTid from tbTyp where left(tbTypTid," + Tid.Length + ")=@tbTypTopCde order by tbTypTid desc";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("tbTypTopCde", Tid);
        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        if (tb.Rows.Count > 0)
        {
            //String TidTNum  =  Right("" & tb.Rows(0).Item("tbTypTid"), Len("" & tb.Rows(0).Item("tbTypTid")) - Len(Tid));
            String TidTNum = tb.Rows[0]["tbTypTid"].ToString().Substring(tb.Rows[0]["tbTypTid"].ToString().IndexOf(Tid) + Tid.Length);
            if (StringAccess.IsNum(TidTNum) == true)
            {
                StrTmp = Tid + StringAccess.addZeroBfStr(Convert.ToInt32(TidTNum) + 1, TidNum);
            }
            else
            {
                StrTmp = Tid + StringAccess.addZeroBfStr(1, TidNum);
            }
        }
        else
        {
            StrTmp = Tid + StringAccess.addZeroBfStr(1, TidNum);
        }
        tb.Dispose();
        IzDataSource.Dispose();
        return(StrTmp);
    }
예제 #3
0
파일: cfg.cs 프로젝트: xin1231/test
    //''' <summary>
    //'''  取得指定類別的類別名稱組(以逗號分開)忽略啟用
    //''' </summary>
    //''' <param name="TopCdeS">TYP(前置三碼)</param>
    //''' <param name="TypTidStr">T001,T002,T003(可複選)</param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public String getTypSubA(String TopCdeS, String TypTidStr)
    {
        IZCls.WebFormBase WebFormBase = new IZCls.WebFormBase();
        IZCls.DataAccess  DataAccess  = new IZCls.DataAccess();
        TypTidStr = DataAccess.ClsSqlChr(TypTidStr);
        String TypTidSql = WebFormBase.DotToSqlStr(TypTidStr);


        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select tbTypSub from tbTyp where left(tbTypCde,3)=@TopCdeS and tbTypTid in (" + TypTidSql + ")";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("TopCdeS", TopCdeS);
        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        String StrTmp            = "";

        for (int i = 0; i < tb.Rows.Count; i++)
        {
            if (StrTmp == "")
            {
                StrTmp = tb.Rows[i]["tbTypSub"].ToString();
            }
            else
            {
                StrTmp += "," + tb.Rows[i]["tbTypSub"].ToString();
            }
        }
        tb.Dispose();
        IzDataSource.Dispose();
        return(StrTmp);
    }
예제 #4
0
파일: mnuDA.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取功能權限字串
    //''' </summary>
    //''' <param name="UsrCde"></param>
    //''' <param name="MnuCde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public String GetPow(String UsrCde, String MnuCde)
    {
        String tmp = "";

        if (UsrCde == "USR00000000000000001")
        {
            tmp = "BOW01,BOW02,BOW03,ADD,EDIT,DEL";
        }
        else
        {
            IzDataSource IzDataSource = new IzDataSource();

            IzDataSource.SelectString = "select * from rlGrpMnu where tbMnuCde=@tbMnuCde and tbGrpCde in (select tbGrpCde from rlUsrGrp where tbUsrCde=@tbUsrCde)";
            IzDataSource.ParametersClear();
            IzDataSource.ParametersAdd("tbMnuCde", MnuCde);
            IzDataSource.ParametersAdd("tbUsrCde", UsrCde);

            System.Data.DataTable tb = IzDataSource.SelectDataTable();
            for (int i = 0; i < tb.Rows.Count; i++)
            {
                tmp += "" + tb.Rows[i]["tbMnuPow"].ToString().Trim() + ",";
            }
            tb.Dispose();
            IzDataSource.Dispose();
        }


        return(tmp);
    }
예제 #5
0
파일: mnuDA.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 檢查帳號是否已存在
    //''' </summary>
    //''' <param name="Uid"></param>
    //''' <param name="CurrentCde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    Boolean ChkUsrUidExist(String Uid, String CurrentCde)
    {
        IzDataSource IzDataSource = new IzDataSource();
        Boolean      Tmp          = false;

        if (CurrentCde == "")
        {
            IzDataSource.SelectString = "select tbUsrCde from tbUsr where tbUsrUid=@tbUsrUid";
            IzDataSource.ParametersAdd("tbUsrUid", Uid);
            System.Data.DataTable tb = IzDataSource.SelectDataTable();
            if (tb.Rows.Count > 0)
            {
                Tmp = true;
            }
            tb.Dispose();
        }
        else
        {
            IzDataSource.SelectString = "select tbUsrCde from tbUsr where tbUsrUid=@tbUsrUid and tbUsrCde<>@tbUsrCde";
            IzDataSource.ParametersAdd("tbUsrUid", Uid);
            IzDataSource.ParametersAdd("tbUsrCde", CurrentCde);
            System.Data.DataTable tb = IzDataSource.SelectDataTable();
            if (tb.Rows.Count > 0)
            {
                Tmp = true;
            }
            tb.Dispose();
        }

        IzDataSource.Dispose();
        return(Tmp);
    }
예제 #6
0
파일: LoginUsr.cs 프로젝트: xin1231/test
    /// <summary>
    /// 修改密碼
    /// </summary>
    /// <param name="Pwd"></param>
    public void UpdatePwd(String Pwd)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.UpdateCommand = "update tbUsr set tbUsrPwd=@tbUsrPwd where tbUsrCde=@tbUsrCde";
        IzDataSource.UpdateParameters.Add("tbUsrPwd", Pwd);
        IzDataSource.UpdateParameters.Add("tbUsrCde", UsrCde);
        IzDataSource.Update();
        IzDataSource.Dispose();
    }
예제 #7
0
파일: cfg.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取備註非空值清單
    //''' </summary>
    //''' <param name="TopCdeS"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public System.Data.DataTable getTypLstByHasNot(String TopCdeS)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select * from tbTyp where left(tbTypCde,3)=@TopCdeS  and not(tbTypNot is null) and  not(tbTypNot like '')  order by tbTypSrt";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("TopCdeS", TopCdeS);
        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        IzDataSource.Dispose();
        return(tb);
    }
예제 #8
0
파일: cfg.cs 프로젝트: xin1231/test
    //'''類別處理函數##############################################################

    //''' <summary>
    //''' 取類別清單
    //''' </summary>
    //''' <param name="TopCdeS">類別編號前三碼</param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public System.Data.DataTable getTypLst(String TopCdeS)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select * from tbTyp where tbTypFlg=1 and left(tbTypCde,3)=@TopCdeS order by tbTypSrt";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("TopCdeS", TopCdeS);
        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        IzDataSource.Dispose();
        return(tb);
    }
예제 #9
0
파일: mnuDA.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取單筆資料
    //''' </summary>
    //''' <param name="Cde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public System.Data.DataTable MnuSelectOne(String Cde)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and tbMnuCde=@tbMnuCde";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("tbMnuCde", Cde);

        System.Data.DataTable tb = IzDataSource.SelectDataTable();

        IzDataSource.Dispose();

        return(tb);
    }
예제 #10
0
파일: cfg.cs 프로젝트: xin1231/test
    /// <summary>
    /// 取置頂圖片
    /// </summary>
    /// <param name="GrpCde"></param>
    /// <param name="isTop"></param>
    /// <returns></returns>
    public System.Data.DataTable selectFlePicByGrp(String GrpCde, Boolean isTop)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select tbFleCde,tbGrpCde,tbFleSub,tbFleCon,tbFleNot,tbFleNme,tbFleTpf,tbFleSiz,tbFleExt,tbFleUtp,tbFlePath,tbFleClk,tbFleFlg,tbFleCdt,tbFleMdt,tbFleCid,tbFleMid,tbFleCip,tbFleMip from tbFle where tbFleFlg=1 and tbFleTop=1 and tbGrpCde=@tbGrpCde and (tbFleExt='png' or tbFleExt='jpg' or tbFleExt='jpeg' or tbFleExt='gif') order by tbFleCdt";
        IzDataSource.ParametersAdd("tbGrpCde", GrpCde);

        System.Data.DataTable tb = IzDataSource.SelectDataTable();

        tb.Dispose();
        IzDataSource.Dispose();

        return(tb);
    }
예제 #11
0
파일: mnuDA.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取單筆使用者群組資料
    //''' </summary>
    //''' <param name="UsrCde"></param>
    //''' <param name="GrpCde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public System.Data.DataTable UsrGrpSelectOne(String UsrCde, String GrpCde)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select * from rlUsrGrp where tbGrpCde=@tbGrpCde and tbUsrCde=@tbUsrCde";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("tbGrpCde", GrpCde);
        IzDataSource.ParametersAdd("tbUsrCde", UsrCde);

        System.Data.DataTable tb = IzDataSource.SelectDataTable();

        IzDataSource.Dispose();

        return(tb);
    }
예제 #12
0
파일: LoginUsr.cs 프로젝트: xin1231/test
    // ''' <summary>
    //''' 檢查帳號密碼
    //''' </summary>
    //''' <param name="UID"></param>
    //''' <param name="PWD"></param>
    //''' <remarks></remarks>

    public void chkUidPwd(String UIDt, String PWDt)
    {
        if (UIDt == "")
        {
            WebFormBase.ShowJavaScriptMsgBack(context.Response, "請填帳號", "");
        }
        if (PWDt == "")
        {
            WebFormBase.ShowJavaScriptMsgBack(context.Response, "請填密碼", "");
        }
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select * from tbUsr where tbUsrFlg=1 and tbUsrStu=1 and tbUsrUid=@tbUsrUid and tbUsrPwd=@tbUsrPwd";
        IzDataSource.ParametersAdd("tbUsrUid", UIDt);
        IzDataSource.ParametersAdd("tbUsrPwd", PWDt);
        System.Data.DataTable tbUsr = IzDataSource.SelectDataTable();
        if (tbUsr.Rows.Count > 0)
        {
            //'加到session及cookie
            context.Session["UsrCde"] = tbUsr.Rows[0]["tbUsrCde"].ToString();
            context.Session["UsrNme"] = tbUsr.Rows[0]["tbUsrNme"].ToString();
            context.Session["UsrUid"] = tbUsr.Rows[0]["tbUsrUid"].ToString();
            context.Session["UsrEml"] = tbUsr.Rows[0]["tbUsrEml"].ToString();

            IZCls.Cookie CookieVar = new IZCls.Cookie();
            CookieVar.AddValue("UsrCde", context.Session["UsrCde"].ToString());
            CookieVar.AddValue("UsrNme", context.Session["UsrNme"].ToString());
            CookieVar.AddValue("UsrUid", context.Session["UsrUid"].ToString());
            CookieVar.AddValue("UsrEml", context.Session["UsrEml"].ToString());

            CookieVar.SetCookieValue(context.Response, CookieName, CookieVar.GetStr(), 3); //'寫入cookie



            //'寫入登入紀錄
            //IzDataSource.ExecuteSQLNoneQuery("insert into tbLog(tbUsrCde,tbLogLdt,tbLogLip) values('" & context.Session("UsrCde") & "',getdate(),'" & context.Request.UserHostAddress & "')")

            //Dim tbUsrLcn As System.Data.DataTable = IzDataSource.GenDataTable("select count(*) from tbLog where tbUsrCde='" & context.Session("UsrCde") & "'")
            //IzDataSource.ExecuteSQLNoneQuery("update tbUsr set tbUsrLcn=" & tbUsrLcn.Rows(0).Item(0) & " where tbUsrCde='" & context.Session("UsrCde") & "'")
            //tbUsrLcn.Dispose()
        }
        else
        {
            WebFormBase.ShowJavaScriptMsgBack(context.Response, "帳號密碼錯誤!", "");
        }
        tbUsr.Dispose();
        IzDataSource.Dispose();
    }
예제 #13
0
파일: cfg.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取上層類別名稱
    //''' </summary>
    //''' <param name="TopCde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public String getTypTopNme(String TopCde)
    {
        String       StrTmp       = "";
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select tbTypTopSub from tbTypTop where tbTypTopFlg=1 and tbTypTopCde=@tbTypTopCde ";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("tbTypTopCde", TopCde);
        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        if (tb.Rows.Count > 0)
        {
            StrTmp = tb.Rows[0]["tbTypTopSub"].ToString();
        }
        tb.Dispose();
        IzDataSource.Dispose();
        return(StrTmp);
    }
예제 #14
0
파일: cfg.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 依Tid取得Typ單一欄位資料
    //''' </summary>
    //''' <param name="TopCdeS">前三碼</param>
    //''' <param name="TypTid">TID</param>
    //''' <param name="BackFieldNme">傳回的欄位值</param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public String getTypFeldByTid(String TopCdeS, String TypTid, String BackFieldNme)
    {
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select * from tbTyp where tbTypFlg=1 and left(tbTypCde,3)=@TopCdeS and tbTypTid=@tbTypTid";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("TopCdeS", TopCdeS);
        IzDataSource.ParametersAdd("tbTypTid", TypTid);
        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        String StrTmp            = "";

        if (tb.Rows.Count > 0)
        {
            StrTmp = tb.Rows[0][BackFieldNme].ToString();
        }
        tb.Dispose();
        IzDataSource.Dispose();
        return(StrTmp);
    }
예제 #15
0
파일: mnuDA.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取姓名
    //''' </summary>
    //''' <param name="Cde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public String getUsrNme(String Cde)
    {
        String       Tmp          = "";
        IzDataSource IzDataSource = new IzDataSource();

        IzDataSource.SelectString = "select tbUsrNme from tbUsr where tbUsrFlg=1 and tbUsrCde=@tbUsrCde";
        IzDataSource.ParametersClear();
        IzDataSource.ParametersAdd("tbUsrCde", Cde);

        System.Data.DataTable tb = IzDataSource.SelectDataTable();
        if (tb.Rows.Count > 0)
        {
            Tmp = "" + tb.Rows[0]["tbUsrNme"].ToString();
        }
        tb.Dispose();
        IzDataSource.Dispose();

        return(Tmp);
    }
예제 #16
0
파일: mnuDA.cs 프로젝트: xin1231/test
    //''' <summary>
    //''' 取有權限的選單
    //''' </summary>
    //''' <param name="TopCde"></param>
    //''' <param name="UsrCde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public System.Data.DataTable MnuSelectUsrGrp(String TopCde, String UsrCde)
    {
        IzDataSource IzDataSource = new IzDataSource();

        if (UsrCde == "USR00000000000000001")
        {
            if (TopCde == "")
            {
                IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and (tbMnuTopCde is null or tbMnuTopCde='') order by tbMnuSrt";
                IzDataSource.ParametersClear();
            }
            else
            {
                IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and tbMnuTopCde=@tbMnuTopCde  order by tbMnuSrt";
                IzDataSource.ParametersClear();
                IzDataSource.ParametersAdd("tbMnuTopCde", TopCde);
            }
            IzDataSource.ParametersAdd("tbUsrCde", UsrCde);
        }
        else
        {
            if (TopCde == "")
            {
                IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and (tbMnuTopCde is null or tbMnuTopCde='') and tbMnuCde in (select tbMnuCde from rlGrpMnu where tbGrpCde in(select tbGrpCde from rlUsrGrp where tbUsrCde=@tbUsrCde)) order by tbMnuSrt";
                IzDataSource.ParametersClear();
            }
            else
            {
                IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and tbMnuTopCde=@tbMnuTopCde and tbMnuCde in (select tbMnuCde from rlGrpMnu where tbGrpCde in(select tbGrpCde from rlUsrGrp where tbUsrCde=@tbUsrCde)) order by tbMnuSrt";
                IzDataSource.ParametersClear();
                IzDataSource.ParametersAdd("tbMnuTopCde", TopCde);
            }
            IzDataSource.ParametersAdd("tbUsrCde", UsrCde);
        }

        System.Data.DataTable tb = IzDataSource.SelectDataTable();

        IzDataSource.Dispose();

        return(tb);
    }
예제 #17
0
파일: mnuDA.cs 프로젝트: xin1231/test
    // ''' <summary>
    //''' 取得選單清單
    //''' </summary>
    //''' <param name="TopCde"></param>
    //''' <returns></returns>
    //''' <remarks></remarks>
    public System.Data.DataTable MnuSelect(String TopCde)
    {
        IzDataSource IzDataSource = new IzDataSource();

        if (TopCde == "")
        {
            IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and (tbMnuTopCde is null or tbMnuTopCde='') order by tbMnuSrt";
            IzDataSource.ParametersClear();
        }
        else
        {
            IzDataSource.SelectString = "select * from tbMnu where tbMnuFlg=1 and tbMnuTopCde=@tbMnuTopCde order by tbMnuSrt";
            IzDataSource.ParametersClear();
            IzDataSource.ParametersAdd("tbMnuTopCde", TopCde);
        }
        System.Data.DataTable tb = IzDataSource.SelectDataTable();

        IzDataSource.Dispose();

        return(tb);
    }