Esempio n. 1
0
    public static bool CheckSeqApproved(string Empcode, string Costcenter, string formId)//Check User ว่ามี Approved list ใน Form หรือไม่
    {
        ClassFunction_Eform.ConnectDatabase fn = new ClassFunction_Eform.ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString);
        string[] Paraname  = new string[] { "@Current_user", "@Cost_Center", "@Flow_ID" };
        string[] Paravalue = new string[] { Empcode, Costcenter, formId };
        fn.OpenDatabase();
        DataTable dt = fn.GetDataStored_Para("sps_GetMaxApprover", Paraname, Paravalue);

        fn.CloseDatabase();
        if (dt.Rows.Count > 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 2
0
    /*-----------------------------------------------------------------------------
    | Function GetDataTable: Return DataTable
    |  -----------------------------------------------------------------------------*/
    public static DataTable GetDataTable(string strSQL)
    {
        DataTable Returndt = null;
        DataTable dt       = new DataTable();

        ClassFunction_Eform.ConnectDatabase Conn = new ClassFunction_Eform.ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString);

        try
        {
            Conn.OpenDatabase();
            dt = Conn.GetData(strSQL);

            if ((dt == null))
            {
                dt = null;
            }
            else
            {
                if (dt.Rows.Count == 0)
                {
                    Returndt = null;
                }
                else
                {
                    Returndt = dt;
                }
            }
        }
        catch (Exception ex)
        {
            Conn.RollbackDatabase();
            throw ex;
        }
        finally
        {
            Conn.CloseDatabase();
        }
        return(Returndt);
    }
Esempio n. 3
0
    /*-----------------------------------------------------------------------------
    | Function GetDataTable: Return DataTable
    |  -----------------------------------------------------------------------------*/
    public static DataTable GetDataTableSchema(string strSQL)
    {
        DataTable dt = new DataTable();

        ClassFunction_Eform.ConnectDatabase Conn = new ClassFunction_Eform.ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString);

        try
        {
            Conn.OpenDatabase();
            dt = Conn.GetData(strSQL);
        }
        catch (Exception ex)
        {
            Conn.RollbackDatabase();
            throw ex;
        }
        finally
        {
            Conn.CloseDatabase();
        }
        return(dt);
    }
Esempio n. 4
0
    public static bool CheckDateHoliday(string Mydate, string Working_Location)//Check ว่าวันที่ลาตรงกับวันหยุดหรือไม่
    {
        string name = System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag;

        System.Globalization.CultureInfo inputCultureInfo = new System.Globalization.CultureInfo(name);
        inputCultureInfo.DateTimeFormat.Calendar = new System.Globalization.GregorianCalendar();
        System.Globalization.CultureInfo displayCultureInfo = new System.Globalization.CultureInfo("en-US");

        DateTime Dttime = DateTime.Parse(Mydate, inputCultureInfo);
        string   sql    = @"select Holiday from M_Holiday 
                       WHERE Holiday='" + Dttime.ToString("yyyyMMdd", inputCultureInfo) + "' AND Working_Location = '" + Working_Location + "'";

        ClassFunction_Eform.ConnectDatabase fn = new ClassFunction_Eform.ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString);
        fn.OpenDatabase();
        DataTable dt = fn.GetData(sql);

        fn.CloseDatabase();
        if (dt.Rows.Count > 0)//Retrun true= ตรงกลับวันหยุดประจำปี หรือเสาร์-อาทิตย์
        {
            return(true);
        }
        switch (Dttime.DayOfWeek)
        {
        case DayOfWeek.Saturday: return(true);

            break;

        case DayOfWeek.Sunday: return(true);

            break;

        default: return(false);

            break;
        }
    }