Пример #1
0
        public Boolean Update(call_center_employee id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_CALL_CENTER_EMPLOYEE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@call_center_employee_id", id.call_center_employee_id);
                cmd.Parameters.AddWithValue("@call_center_id", id.call_center_id);
                cmd.Parameters.AddWithValue("@employee_id", id.employee_id);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
 public call_center_employee Insert(call_center_employee id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_CALL_CENTER_EMPLOYEE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@call_center_id", id.call_center_id);
     cmd.Parameters.AddWithValue("@employee_id", id.employee_id);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_CALL_CENTER_EMPLOYEE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@call_center_id", id.call_center_id);
     cmd.Parameters.AddWithValue("@employee_id", id.employee_id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.call_center_employee_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
Пример #3
0
        public call_center_employee Select(int id)
        {
            call_center_employee call_center_employee = new call_center_employee();
            string        ConnectionString            = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_CALL_CENTER_EMPLOYEE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@call_center_employee_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        call_center_employee.call_center_employee_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        call_center_employee.call_center_employee_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        call_center_employee.call_center_id = rdr.GetInt32(1);
                    }
                    else
                    {
                        call_center_employee.call_center_id = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        call_center_employee.employee_id = rdr.GetInt32(2);
                    }
                    else
                    {
                        call_center_employee.employee_id = 0;
                    }
                }
                else
                {
                    call_center_employee.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                call_center_employee.SetColumnDefaults();
                return(call_center_employee);
            }
            finally
            {
                con.Close();
            }
            return(call_center_employee);
        }
Пример #4
0
        public call_center_employee Insert(call_center_employee id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_CALL_CENTER_EMPLOYEE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@call_center_id", id.call_center_id);
                cmd.Parameters.AddWithValue("@employee_id", id.employee_id);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_CALL_CENTER_EMPLOYEE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@call_center_id", id.call_center_id);
                cmd.Parameters.AddWithValue("@employee_id", id.employee_id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.call_center_employee_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
 public call_center_employee Select(int id)
 {
     call_center_employee call_center_employee = new call_center_employee();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_CALL_CENTER_EMPLOYEE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@call_center_employee_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             call_center_employee.call_center_employee_id = rdr.GetInt32(0);
         }
         else
         {
             call_center_employee.call_center_employee_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             call_center_employee.call_center_id = rdr.GetInt32(1);
         }
         else
         {
             call_center_employee.call_center_id = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             call_center_employee.employee_id = rdr.GetInt32(2);
         }
         else
         {
             call_center_employee.employee_id = 0;
         }
         }
         else
         {
             call_center_employee.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     call_center_employee.SetColumnDefaults();
     return call_center_employee;
     }
     finally
     {
     con.Close();
     }
     return call_center_employee;
 }
 public Boolean Update(call_center_employee id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_CALL_CENTER_EMPLOYEE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@call_center_employee_id", id.call_center_employee_id);
     cmd.Parameters.AddWithValue("@call_center_id", id.call_center_id);
     cmd.Parameters.AddWithValue("@employee_id", id.employee_id);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }