public int CreateActionPlan(IActionPlan actionPlan) { IActionPlanDto actionPlanDto = DataHandlerFactory.DataHandlerFactory.GetActionPlanDto(); actionPlanDto.AccountID = actionPlan.AccountID; actionPlanDto.PlanTitle = actionPlan.PlanTitle; actionPlanDto.PlanMessage = actionPlan.PlanMessage; actionPlanDto.PlanCategory = actionPlan.PlanCategory; actionPlanDto.PlanDateCreated = actionPlan.PlanDateCreated; int rowcount = db.CreateActionPlan(actionPlanDto); return(rowcount); }
public int CreateActionPlan(IActionPlanDto actionPlanDto) { string command = "INSERT INTO `actionplan` (`AccountID`, `PlanTitle`, `PlanMessage`, `PlanCategory`, `PlanDateCreated`) VALUES ({0}, '{1}', '{2}', '{3}', '{4}');"; using (MySqlConnection conn = Connection.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand(string.Format(command, actionPlanDto.AccountID, actionPlanDto.PlanTitle, actionPlanDto.PlanMessage, actionPlanDto.PlanCategory, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), conn); int rowcount = cmd.ExecuteNonQuery(); return(rowcount); } }