示例#1
0
    /// <summary>
    /// 取得Calendar假日資料
    /// </summary>
    /// <param name="model">畫面model</param>
    /// <param name="datas">回傳資料</param>
    /// <param name="msg">回傳訊息</param>
    /// <returns>bool</returns>
    public static bool LoadHoliday(WorkTimeViewModel model, out List <CalendarListMobel> datas, out string msg)
    {
        bool result = false;

        msg   = "";
        datas = new List <CalendarListMobel>();
        try
        {
            using (var conn = new SqlConnection()
            {
                ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString
            })
            {
                try
                {
                    if (model.WorkSite != "台灣")
                    {
                        datas = conn.Query <CalendarListMobel>(WorkTimeSql.LoadOverSeaHoliday(), model).ToList();
                    }
                    else
                    {
                        datas = conn.Query <CalendarListMobel>(WorkTimeSql.LoadHoliday(), model).ToList();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            result = true;
        }
        catch (Exception ex)
        {
            msg = ex.Message;
        }
        return(result);
    }