コード例 #1
0
        private WorkingDay_Info GenerateObject(DataRow row)
        {
            if (row == null)
            {
                throw new Exception("Data row does not null or empty");
            }
            WorkingDay_Info wi = new WorkingDay_Info();

            if (row["TransDate"] != DBNull.Value)
            {
                wi.TransDate = Convert.ToDateTime(row["TransDate"]);
            }
            if (row["BeginOfTime"] != DBNull.Value)
            {
                wi.BeginOfTime = Convert.ToDateTime(row["BeginOfTime"]);
            }
            if (row["EndOfTime"] != DBNull.Value)
            {
                wi.EndOfTime = Convert.ToDateTime(row["EndOfTime"]);
            }
            if (row["IsEOD"] != DBNull.Value)
            {
                wi.IsEOD = Convert.ToBoolean(row["IsEOD"]);
            }
            return(wi);
        }
コード例 #2
0
 public SqlCommand CreateOneWorkingDay(WorkingDay_Info objWorkingDays_Info)
 {
     try
     {
         SqlCommand command = new SqlCommand("Insert Into WorkingDays(TransDate, BeginOfTime, EndOfTime, IsEOD) Values(@TransDate, @BeginOfTime, @EndOfTime, @IsEOD)");
         command.CommandType = CommandType.Text;
         //command.Parameters.Add("@ID", SqlDbType.Decimal).Value = objWorkingDays_Info.ID;
         command.Parameters.Add("@TransDate", SqlDbType.DateTime).Value   = objWorkingDays_Info.TransDate;
         command.Parameters.Add("@BeginOfTime", SqlDbType.DateTime).Value = objWorkingDays_Info.BeginOfTime;
         command.Parameters.Add("@EndOfTime", SqlDbType.DateTime).Value   = objWorkingDays_Info.EndOfTime;
         command.Parameters.Add("@IsEOD", SqlDbType.Bit).Value            = objWorkingDays_Info.IsEOD;
         this.AddCommand(command);
         return(command);
     }
     catch (Exception ex)
     { Logger.Error(ex); throw ex; }
 }
コード例 #3
0
 public SqlCommand EditOneWorkingDay(WorkingDay_Info objWorkingDays_Info)
 {
     try
     {
         SqlCommand command = new SqlCommand("Update WorkingDays Set TransDate=@TransDate, "
                                             + "BeginOfTime=@BeginOfTime, EndOfTime=@EndOfTime, IsEOD=@IsEOD Where TransDate=@TransDate");
         command.CommandType = CommandType.Text;
         //command.Parameters.Add("@ID", SqlDbType.Decimal).Value = objWorkingDays_Info.ID;
         command.Parameters.Add("@TransDate", SqlDbType.DateTime).Value   = objWorkingDays_Info.TransDate;
         command.Parameters.Add("@BeginOfTime", SqlDbType.DateTime).Value = objWorkingDays_Info.BeginOfTime;
         command.Parameters.Add("@EndOfTime", SqlDbType.DateTime).Value   = objWorkingDays_Info.EndOfTime;
         command.Parameters.Add("@IsEOD", SqlDbType.Bit).Value            = objWorkingDays_Info.IsEOD;
         this.AddCommand(command);
         return(command);
     }
     catch (Exception ex)
     { Logger.Error(ex); throw ex; }
 }