Esempio n. 1
0
 public ActionResult addAgent(AgentModel model)
 {
     if (ModelState.IsValid)
     {
         var res = AdminPanelBizLayer.addAgent(model);
     }
     ModelState.Clear();
     ViewBag.Message = "Agent Addition Successful! <a href=\"/Admin\">Go to Home page</a>";
     return View("Success");
 }
Esempio n. 2
0
        public static bool addAgent(AgentModel model)
        {
            SqlDatabase travelMSysDB = new SqlDatabase(ConnString.DBConnectionString);

            SqlCommand insertCmmnd = new SqlCommand("INSERT INTO AGENTS(Agent_ID,Password,Agent_Name,Creator_Admin_ID,Phone_Num,Address) VALUES (@Agent_ID,@Password,@Agent_Name,@Creator_Admin_ID,@Phone_Num,@Address)");
            insertCmmnd.CommandType = CommandType.Text;

            insertCmmnd.Parameters.AddWithValue("@Agent_ID", model.Agent_ID);
            insertCmmnd.Parameters.AddWithValue("@Password", "12d5ba628f5af19b9c8d5ccfe9283430");
            //insertCmmnd.Parameters.AddWithValue("@Access_Status",model.Access_Status);
            insertCmmnd.Parameters.AddWithValue("@Agent_Name", model.Agent_Name);
            insertCmmnd.Parameters.AddWithValue("@Creator_Admin_ID", model.Creator_Admin_ID);
            insertCmmnd.Parameters.AddWithValue("@Phone_Num", model.Phone_Num);
            insertCmmnd.Parameters.AddWithValue("@Address", model.Address);

            int rowsAffected = travelMSysDB.ExecuteNonQuery(insertCmmnd);
            Console.Write("rowsAffected " + rowsAffected);
            if (rowsAffected == 1)
                return true;
            return false;
        }
Esempio n. 3
0
 public static bool addAgent(AgentModel model)
 {
     return AdminPanelDALayer.addAgent(model);
 }