ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 학원관리 DB WorkSchedule 관리 예제 소스
    업무용 소스 예제 2021. 8. 22. 16:34
    728x90
    반응형
    728x90

    학원관리 DB WorkSchedule 관리 예제 소스

     

    GetWorkScheduleSelect, GetWorkScheduleSelect_Day, GetScheduleSelect

     

    public static List<WorkSetInfo> GetWorkScheduleSelect(int UserKey, DateTime RegDate)
            {
                List<WorkSetInfo> results = new List<WorkSetInfo>();
    
                SqlHelper sql = new SqlHelper(_dbIP, _dbPort, _dbID, _dbPW, _dbName);
    
                try
                {
                    if (!sql.Connect()) return results;
    
                    string strProc = "SP_Work_Schedule_Select";
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}", strProc));
    
                    List<SqlParameter> parameters = new List<SqlParameter>();
                    parameters.Add(new SqlParameter("@UserKey", UserKey));
                    parameters.Add(new SqlParameter("@RegDate", RegDate.ToString("yyyy-MM-dd")));
                    parameters.Add(new SqlParameter("@Code", VARS_LOGIN_ACCOUNT.VARS_LOGIN_ACADEMYINFO.code));
    
                    DataTable tbl = sql.ExecuteProcedure(strProc, parameters);
                    if (tbl == null) return results;
    
                    foreach (DataRow row in tbl.Rows)
                    {
                        WorkSetInfo i = new WorkSetInfo();
                        i.InTime = Convert.ToInt32(row["InTime"]);
                        i.OutTime = Convert.ToInt32(row["OutTime"]);
                        i.Date = Convert.ToDateTime(row["Date"]);
                        results.Add(i);
                    }
                }
                catch (Exception ee)
                {
                    TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                }
                finally
                {
                    sql.DisConnect();
                }
                return results;
            }
    
            public static List<WorkSetInfo> GetWorkScheduleSelect_Day(int UserKey, string RegDate)
            {
                List<WorkSetInfo> results = new List<WorkSetInfo>();
    
                SqlHelper sql = new SqlHelper(_dbIP, _dbPort, _dbID, _dbPW, _dbName);
    
                try
                {
                    if (!sql.Connect()) return results;
    
                    string strProc = "SP_Work_Schedule_Select_Day";
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}", strProc));
    
                    List<SqlParameter> parameters = new List<SqlParameter>();
                    parameters.Add(new SqlParameter("@UserKey", UserKey));
                    parameters.Add(new SqlParameter("@RegDate", RegDate));
                    parameters.Add(new SqlParameter("@Code", VARS_LOGIN_ACCOUNT.VARS_LOGIN_ACADEMYINFO.code));
    
                    DataTable tbl = sql.ExecuteProcedure(strProc, parameters);
                    if (tbl == null) return results;
    
                    foreach (DataRow row in tbl.Rows)
                    {
                        WorkSetInfo i = new WorkSetInfo();
                        i.InTime = Convert.ToInt32(row["InTime"]);
                        i.OutTime = Convert.ToInt32(row["OutTime"]);
                        i.Date = Convert.ToDateTime(row["Date"]);
                        results.Add(i);
                    }
                }
                catch (Exception ee)
                {
                    TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                }
                finally
                {
                    sql.DisConnect();
                }
                return results;
            }
    
            public static List<ScheduleSelectInfo> GetScheduleSelect(string UserID, DateTime RegDate)
            {
                List<ScheduleSelectInfo> results = new List<ScheduleSelectInfo>();
    
                SqlHelper sql = new SqlHelper(_dbIP, _dbPort, _dbID, _dbPW, _dbName);
    
                try
                {
                    if (!sql.Connect()) return results;
    
                    string strProc = "SP_Schedule_Select";
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}", strProc));
    
                    List<SqlParameter> parameters = new List<SqlParameter>();
                    parameters.Add(new SqlParameter("@UserID", UserID));
                    parameters.Add(new SqlParameter("@RegDate", RegDate));
    
                    DataTable tbl = sql.ExecuteProcedure(strProc, parameters);
                    if (tbl == null) return results;
    
                    foreach (DataRow row in tbl.Rows)
                    {
                        ScheduleSelectInfo i = new ScheduleSelectInfo();
                        i.ScheduleDiv = Convert.ToString(row["ScheduleDiv"]);
                        i.UserID = Convert.ToString(row["UserID"]);
                        i.ScheduleDate = Convert.ToDateTime(row["ScheduleDate"]);
                        i.Idx = Convert.ToInt32(row["Idx"]);
                        i.Title = Convert.ToString(row["Title"]);
                        i.Contents = Convert.ToString(row["Contents"]);
                        i.ImageIndex = Convert.ToInt32(row["ImageIndex"]);
                        if (row["EndDate"] != DBNull.Value)
                        {
                            i.EndDate = row["EndDate"] == DBNull.Value ? i.EndDate : Convert.ToDateTime(row["EndDate"]);
                            i.UnlimitedLoop = row["UnlimitedLoop"] == DBNull.Value ? i.UnlimitedLoop : Convert.ToBoolean(row["UnlimitedLoop"]);
                            i.LoopValue1 = row["LoopValue1"] == DBNull.Value ? i.LoopValue1 : Convert.ToInt32(row["LoopValue1"]);
                            i.LoopValue2 = row["LoopValue2"] == DBNull.Value ? i.LoopValue2 : Convert.ToInt32(row["LoopValue2"]);
                            i.LoopValue3 = row["LoopValue3"] == DBNull.Value ? i.LoopValue3 : Convert.ToInt32(row["LoopValue3"]);
                            i.LoopDiv = row["LoopDiv"] == DBNull.Value ? i.LoopDiv : Convert.ToString(row["LoopDiv"]);
                        }
    
                        results.Add(i);
                    }
                }
                catch (Exception ee)
                {
                    TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                }
                finally
                {
                    sql.DisConnect();
                }
                return results;
            }
    728x90
    반응형

    댓글

Designed by Tistory.