/** * Creates a new Empparticipation model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($id) { $model = new Empparticipation(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'event_no' => $model->event_no, 'employee_no' => $model->employee_no]); } else { $connection = Yii::$app->db; $command1 = $connection->createCommand("SELECT start_date_time,end_date_time from event where event.event_no=:id"); $command1->bindParam(":id", $id); $row1 = $command1->queryAll(); $command = $connection->createCommand("call Assign3(':Sdate',':Edate')"); // $command2->bindParam(":id", $id); $command->bindParam(":Sdate", $row1['start_date_time']); $command->bindParam(":Edate", $row1['end_date_time']); $row = $command->queryAll(); $c = $row; if ($c != null) { $command2 = $connection->createCommand("Update event SET Seen='YES' where event_no=:id"); $command2->bindParam(":id", $id); $command2->execute(); return $this->render('create', ['model' => $model, 'id' => $row]); } else { $connection = Yii::$app->db; $command1 = $connection->createCommand("SELECT name,mobile_no,home_no from customer inner join customer_order where customer.nic=customer_order.customer_id where order_id=:id"); $command1->bindParam(":id", $id); $row1 = $command1->queryAll(); return $this->render('OutofStaff', ['model' => $model]); } } }