Ejemplo n.º 1
0
        public void AddPlanData(PlanData data)
        {
            try
            {
                OpenConnection();
                SqlCeCommand cmd = new SqlCeCommand(@"INSERT INTO [Plan]
                ([Name],[PlanDateModel],[PlanDate],[PlanDateStep],[PlanTimeModel],[PlanTime],
                [PlanTimeStep],[Enable],[PlanDayStep],[PlanWeek],[Working],[LastSuccessTime])
                VALUES(@Name,@PlanDateModel,@PlanDate,
                @PlanDateStep,@PlanTimeModel,@PlanTime,@PlanTimeStep,
                @Enable,@PlanDayStep,@PlanWeek,@Working,@LastSuccessTime);", con);
                cmd.Parameters.AddWithValue("Name", data.Name);
                cmd.Parameters.AddWithValue("PlanDateModel", (int)data.PlanDateModel);
                cmd.Parameters.AddWithValue("PlanDate", data.PlanDate);
                cmd.Parameters.AddWithValue("PlanDateStep", data.PlanDateStep);
                cmd.Parameters.AddWithValue("PlanTimeModel", (int)data.PlanTimeModel);
                cmd.Parameters.AddWithValue("PlanTime", data.PlanTime);
                cmd.Parameters.AddWithValue("PlanTimeStep", data.PlanTimeStep);
                cmd.Parameters.AddWithValue("Enable", data.Enable);
                cmd.Parameters.AddWithValue("PlanDayStep", data.PlanDayStep);
                cmd.Parameters.AddWithValue("PlanWeek", data.PlanWeek);
                cmd.Parameters.AddWithValue("Working", data.Working);
                cmd.Parameters.AddWithValue("LastSuccessTime", data.LastSuccessTime);

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //Suppress All Exceptions
            }
            finally
            {
                CloseConnection();
            }
        }
Ejemplo n.º 2
0
        public void UpdatePlanData(PlanData data)
        {
            try
            {
                OpenConnection();
                SqlCeCommand cmd = new SqlCeCommand(@"UPDATE [Plan] 
                       SET [Name] = @Name
                          ,[PlanDateModel] = @PlanDateModel
                          ,[PlanDate] = @PlanDate
                          ,[PlanDateStep] = @PlanDateStep
                          ,[PlanTimeModel] = @PlanTimeModel
                          ,[PlanTime] = @PlanTime
                          ,[PlanTimeStep] = @PlanTimeStep
                          ,[Enable] = @Enable
                          ,[PlanDayStep] = @PlanDayStep
                          ,[PlanWeek] = @PlanWeek
                          ,[Working] = @Working
                          ,[LastSuccessTime]=@LastSuccessTime
                     WHERE ID=@ID", con);
                cmd.Parameters.AddWithValue("ID", data.ID);
                cmd.Parameters.AddWithValue("Name", data.Name);
                cmd.Parameters.AddWithValue("PlanDateModel", (int)data.PlanDateModel);
                cmd.Parameters.AddWithValue("PlanDate", data.PlanDate);
                cmd.Parameters.AddWithValue("PlanDateStep", data.PlanDateStep);
                cmd.Parameters.AddWithValue("PlanTimeModel", (int)data.PlanTimeModel);
                cmd.Parameters.AddWithValue("PlanTime", data.PlanTime);
                cmd.Parameters.AddWithValue("PlanTimeStep", data.PlanTimeStep);
                cmd.Parameters.AddWithValue("Enable", data.Enable);
                cmd.Parameters.AddWithValue("PlanDayStep", data.PlanDayStep);
                cmd.Parameters.AddWithValue("PlanWeek", data.PlanWeek);
                cmd.Parameters.AddWithValue("Working", data.Working);
                cmd.Parameters.AddWithValue("LastSuccessTime", data.LastSuccessTime);

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //Suppress All Exceptions
            }
            finally
            {
                CloseConnection();
            }
        }
Ejemplo n.º 3
0
        public void DeletePlanData(PlanData data)
        {
            try
            {
                OpenConnection();
                SqlCeCommand cmd = new SqlCeCommand(@"DELETE FROM [Plan] WHERE [ID]=@ID;", con);
                cmd.Parameters.AddWithValue("ID", data.ID);

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //Suppress All Exceptions
            }
            finally
            {
                CloseConnection();
            }
        }