Beispiel #1
0
 public vendor Delete_vendor_select(int ID)
 {
     vendor = vendor.Select(ID);
     Delete_vendor_id_txt_lbl.Text              = Convert.ToString(vendor.vendor_id);
     Delete_vendor_name_txt_lbl.Text            = Convert.ToString(vendor.vendor_name);
     Delete_phone_num_txt_lbl.Text              = Convert.ToString(vendor.phone_num);
     Delete_email_txt_lbl.Text                  = Convert.ToString(vendor.email);
     Delete_address_id_txt_lbl.Text             = Convert.ToString(vendor.address_id);
     Delete_Vendor_address2_txt_lbl.Text        = Convert.ToString(vendor.Vendor_address2);
     Delete_vendor_job_assign_txt_lbl.Text      = Convert.ToString(vendor.vendor_job_assign);
     Delete_vendor_start_date_txt_lbl.Text      = Convert.ToString(vendor.vendor_start_date);
     Delete_vendor_end_date_txt_lbl.Text        = Convert.ToString(vendor.vendor_end_date);
     Delete_vendor_meth_of_contact_txt_lbl.Text = Convert.ToString(vendor.vendor_meth_of_contact);
     Delete_vendor_status_txt_lbl.Text          = Convert.ToString(vendor.vendor_status);
     Delete_vendor_meth_of_pay_txt_lbl.Text     = Convert.ToString(vendor.vendor_meth_of_pay);
     Delete_vendor_type_txt_lbl.Text            = Convert.ToString(vendor.vendor_type);
     Delete_vendor_comments_txt_lbl.Text        = Convert.ToString(vendor.vendor_comments);
     Delete_primary_fName_txt_lbl.Text          = Convert.ToString(vendor.primary_fName);
     Delete_primary_lName_txt_lbl.Text          = Convert.ToString(vendor.primary_lName);
     Delete_primary_phone_txt_lbl.Text          = Convert.ToString(vendor.primary_phone);
     Delete_sec_fName_txt_lbl.Text              = Convert.ToString(vendor.sec_fName);
     Delete_sec_lName_txt_lbl.Text              = Convert.ToString(vendor.sec_lName);
     Delete_sec_phone_txt_lbl.Text              = Convert.ToString(vendor.sec_phone);
     return(vendor);
 }
 public vendor Delete_vendor_select(int ID)
 {
     vendor = vendor.Select(ID);
     Delete_vendor_id_txt_lbl.Text = Convert.ToString(vendor.vendor_id);
     Delete_vendor_name_txt_lbl.Text = Convert.ToString(vendor.vendor_name);
     Delete_phone_num_txt_lbl.Text = Convert.ToString(vendor.phone_num);
     Delete_email_txt_lbl.Text = Convert.ToString(vendor.email);
     Delete_address_id_txt_lbl.Text = Convert.ToString(vendor.address_id);
     Delete_Vendor_address2_txt_lbl.Text = Convert.ToString(vendor.Vendor_address2);
     Delete_vendor_job_assign_txt_lbl.Text = Convert.ToString(vendor.vendor_job_assign);
     Delete_vendor_start_date_txt_lbl.Text = Convert.ToString(vendor.vendor_start_date);
     Delete_vendor_end_date_txt_lbl.Text = Convert.ToString(vendor.vendor_end_date);
     Delete_vendor_meth_of_contact_txt_lbl.Text = Convert.ToString(vendor.vendor_meth_of_contact);
     Delete_vendor_status_txt_lbl.Text = Convert.ToString(vendor.vendor_status);
     Delete_vendor_meth_of_pay_txt_lbl.Text = Convert.ToString(vendor.vendor_meth_of_pay);
     Delete_vendor_type_txt_lbl.Text = Convert.ToString(vendor.vendor_type);
     Delete_vendor_comments_txt_lbl.Text = Convert.ToString(vendor.vendor_comments);
     Delete_primary_fName_txt_lbl.Text = Convert.ToString(vendor.primary_fName);
     Delete_primary_lName_txt_lbl.Text = Convert.ToString(vendor.primary_lName);
     Delete_primary_phone_txt_lbl.Text = Convert.ToString(vendor.primary_phone);
     Delete_sec_fName_txt_lbl.Text = Convert.ToString(vendor.sec_fName);
     Delete_sec_lName_txt_lbl.Text = Convert.ToString(vendor.sec_lName);
     Delete_sec_phone_txt_lbl.Text = Convert.ToString(vendor.sec_phone);
     return vendor;
 }
Beispiel #3
0
 public vendor vendor_insert()
 {
     vendor.vendor_name            = Insert_vendor_name_txt.Text;
     vendor.phone_num              = Insert_phone_num_txt.Text;
     vendor.email                  = Insert_email_txt.Text;
     vendor.address_id             = Convert.ToInt32(Insert_address_id_txt.Text);
     vendor.Vendor_address2        = Convert.ToInt32(Insert_Vendor_address2_txt.Text);
     vendor.vendor_job_assign      = Insert_vendor_job_assign_txt.Text;
     vendor.vendor_start_date      = Convert.ToDateTime(Insert_vendor_start_date_txt.Text);
     vendor.vendor_end_date        = Convert.ToDateTime(Insert_vendor_end_date_txt.Text);
     vendor.vendor_meth_of_contact = Insert_vendor_meth_of_contact_txt.Text;
     vendor.vendor_status          = Insert_vendor_status_txt.Text;
     vendor.vendor_meth_of_pay     = Insert_vendor_meth_of_pay_txt.Text;
     vendor.vendor_type            = Insert_vendor_type_txt.Text;
     vendor.vendor_comments        = Insert_vendor_comments_txt.Text;
     vendor.primary_fName          = Insert_primary_fName_txt.Text;
     vendor.primary_lName          = Insert_primary_lName_txt.Text;
     vendor.primary_phone          = Insert_primary_phone_txt.Text;
     vendor.sec_fName              = Insert_sec_fName_txt.Text;
     vendor.sec_lName              = Insert_sec_lName_txt.Text;
     vendor.sec_phone              = Insert_sec_phone_txt.Text;
     vendor = vendor.Insert(vendor);
     Insert_vendor_GridView.DataBind();
     Update_vendor_GridView.DataBind();
     Delete_vendor_GridView.DataBind();
     return(vendor);
 }
Beispiel #4
0
        public Boolean Update(vendor id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_VENDOR", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@vendor_id", id.vendor_id);
                cmd.Parameters.AddWithValue("@vendor_name", id.vendor_name);
                cmd.Parameters.AddWithValue("@phone_num", id.phone_num);
                cmd.Parameters.AddWithValue("@email", id.email);
                cmd.Parameters.AddWithValue("@address_id", id.address_id);
                cmd.Parameters.AddWithValue("@Vendor_address2", id.Vendor_address2);
                cmd.Parameters.AddWithValue("@vendor_job_assign", id.vendor_job_assign);
                cmd.Parameters.AddWithValue("@vendor_start_date", id.vendor_start_date);
                cmd.Parameters.AddWithValue("@vendor_end_date", id.vendor_end_date);
                cmd.Parameters.AddWithValue("@vendor_meth_of_contact", id.vendor_meth_of_contact);
                cmd.Parameters.AddWithValue("@vendor_status", id.vendor_status);
                cmd.Parameters.AddWithValue("@vendor_meth_of_pay", id.vendor_meth_of_pay);
                cmd.Parameters.AddWithValue("@vendor_type", id.vendor_type);
                cmd.Parameters.AddWithValue("@vendor_comments", id.vendor_comments);
                cmd.Parameters.AddWithValue("@primary_fName", id.primary_fName);
                cmd.Parameters.AddWithValue("@primary_lName", id.primary_lName);
                cmd.Parameters.AddWithValue("@primary_phone", id.primary_phone);
                cmd.Parameters.AddWithValue("@sec_fName", id.sec_fName);
                cmd.Parameters.AddWithValue("@sec_lName", id.sec_lName);
                cmd.Parameters.AddWithValue("@sec_phone", id.sec_phone);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
 public vendor Insert(vendor id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_VENDOR", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@vendor_name", id.vendor_name);
     cmd.Parameters.AddWithValue("@phone_num", id.phone_num);
     cmd.Parameters.AddWithValue("@email", id.email);
     cmd.Parameters.AddWithValue("@address_id", id.address_id);
     cmd.Parameters.AddWithValue("@Vendor_address2", id.Vendor_address2);
     cmd.Parameters.AddWithValue("@vendor_job_assign", id.vendor_job_assign);
     cmd.Parameters.AddWithValue("@vendor_start_date", id.vendor_start_date);
     cmd.Parameters.AddWithValue("@vendor_end_date", id.vendor_end_date);
     cmd.Parameters.AddWithValue("@vendor_meth_of_contact", id.vendor_meth_of_contact);
     cmd.Parameters.AddWithValue("@vendor_status", id.vendor_status);
     cmd.Parameters.AddWithValue("@vendor_meth_of_pay", id.vendor_meth_of_pay);
     cmd.Parameters.AddWithValue("@vendor_type", id.vendor_type);
     cmd.Parameters.AddWithValue("@vendor_comments", id.vendor_comments);
     cmd.Parameters.AddWithValue("@primary_fName", id.primary_fName);
     cmd.Parameters.AddWithValue("@primary_lName", id.primary_lName);
     cmd.Parameters.AddWithValue("@primary_phone", id.primary_phone);
     cmd.Parameters.AddWithValue("@sec_fName", id.sec_fName);
     cmd.Parameters.AddWithValue("@sec_lName", id.sec_lName);
     cmd.Parameters.AddWithValue("@sec_phone", id.sec_phone);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_VENDOR", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@vendor_name", id.vendor_name);
     cmd.Parameters.AddWithValue("@phone_num", id.phone_num);
     cmd.Parameters.AddWithValue("@email", id.email);
     cmd.Parameters.AddWithValue("@address_id", id.address_id);
     cmd.Parameters.AddWithValue("@Vendor_address2", id.Vendor_address2);
     cmd.Parameters.AddWithValue("@vendor_job_assign", id.vendor_job_assign);
     cmd.Parameters.AddWithValue("@vendor_start_date", id.vendor_start_date);
     cmd.Parameters.AddWithValue("@vendor_end_date", id.vendor_end_date);
     cmd.Parameters.AddWithValue("@vendor_meth_of_contact", id.vendor_meth_of_contact);
     cmd.Parameters.AddWithValue("@vendor_status", id.vendor_status);
     cmd.Parameters.AddWithValue("@vendor_meth_of_pay", id.vendor_meth_of_pay);
     cmd.Parameters.AddWithValue("@vendor_type", id.vendor_type);
     cmd.Parameters.AddWithValue("@vendor_comments", id.vendor_comments);
     cmd.Parameters.AddWithValue("@primary_fName", id.primary_fName);
     cmd.Parameters.AddWithValue("@primary_lName", id.primary_lName);
     cmd.Parameters.AddWithValue("@primary_phone", id.primary_phone);
     cmd.Parameters.AddWithValue("@sec_fName", id.sec_fName);
     cmd.Parameters.AddWithValue("@sec_lName", id.sec_lName);
     cmd.Parameters.AddWithValue("@sec_phone", id.sec_phone);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.vendor_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Update Tab Methods
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     vendor = Update_vendor_select(Convert.ToInt32(Update_vendor_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     vendor = vendor_update(Convert.ToInt32(Update_vendor_GridView.SelectedValue));
 }
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Insert Tab Methods
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     vendor = Insert_vendor_select(Convert.ToInt32(Insert_vendor_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     vendor = vendor_insert();
 }
Beispiel #10
0
        public vendor Insert(vendor id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_VENDOR", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@vendor_name", id.vendor_name);
                cmd.Parameters.AddWithValue("@phone_num", id.phone_num);
                cmd.Parameters.AddWithValue("@email", id.email);
                cmd.Parameters.AddWithValue("@address_id", id.address_id);
                cmd.Parameters.AddWithValue("@Vendor_address2", id.Vendor_address2);
                cmd.Parameters.AddWithValue("@vendor_job_assign", id.vendor_job_assign);
                cmd.Parameters.AddWithValue("@vendor_start_date", id.vendor_start_date);
                cmd.Parameters.AddWithValue("@vendor_end_date", id.vendor_end_date);
                cmd.Parameters.AddWithValue("@vendor_meth_of_contact", id.vendor_meth_of_contact);
                cmd.Parameters.AddWithValue("@vendor_status", id.vendor_status);
                cmd.Parameters.AddWithValue("@vendor_meth_of_pay", id.vendor_meth_of_pay);
                cmd.Parameters.AddWithValue("@vendor_type", id.vendor_type);
                cmd.Parameters.AddWithValue("@vendor_comments", id.vendor_comments);
                cmd.Parameters.AddWithValue("@primary_fName", id.primary_fName);
                cmd.Parameters.AddWithValue("@primary_lName", id.primary_lName);
                cmd.Parameters.AddWithValue("@primary_phone", id.primary_phone);
                cmd.Parameters.AddWithValue("@sec_fName", id.sec_fName);
                cmd.Parameters.AddWithValue("@sec_lName", id.sec_lName);
                cmd.Parameters.AddWithValue("@sec_phone", id.sec_phone);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_VENDOR", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@vendor_name", id.vendor_name);
                cmd.Parameters.AddWithValue("@phone_num", id.phone_num);
                cmd.Parameters.AddWithValue("@email", id.email);
                cmd.Parameters.AddWithValue("@address_id", id.address_id);
                cmd.Parameters.AddWithValue("@Vendor_address2", id.Vendor_address2);
                cmd.Parameters.AddWithValue("@vendor_job_assign", id.vendor_job_assign);
                cmd.Parameters.AddWithValue("@vendor_start_date", id.vendor_start_date);
                cmd.Parameters.AddWithValue("@vendor_end_date", id.vendor_end_date);
                cmd.Parameters.AddWithValue("@vendor_meth_of_contact", id.vendor_meth_of_contact);
                cmd.Parameters.AddWithValue("@vendor_status", id.vendor_status);
                cmd.Parameters.AddWithValue("@vendor_meth_of_pay", id.vendor_meth_of_pay);
                cmd.Parameters.AddWithValue("@vendor_type", id.vendor_type);
                cmd.Parameters.AddWithValue("@vendor_comments", id.vendor_comments);
                cmd.Parameters.AddWithValue("@primary_fName", id.primary_fName);
                cmd.Parameters.AddWithValue("@primary_lName", id.primary_lName);
                cmd.Parameters.AddWithValue("@primary_phone", id.primary_phone);
                cmd.Parameters.AddWithValue("@sec_fName", id.sec_fName);
                cmd.Parameters.AddWithValue("@sec_lName", id.sec_lName);
                cmd.Parameters.AddWithValue("@sec_phone", id.sec_phone);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.vendor_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
Beispiel #11
0
 protected void INSERT(object sender, EventArgs e)
 {
     vendor = vendor_insert();
 }
Beispiel #12
0
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Insert Tab Methods
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     vendor = Insert_vendor_select(Convert.ToInt32(Insert_vendor_GridView.SelectedValue));
 }
Beispiel #13
0
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Delete Tab Methods
 protected void Delete_Select_Record(object sender, EventArgs e)
 {
     vendor = Delete_vendor_select(Convert.ToInt32(Delete_vendor_GridView.SelectedValue));
 }
Beispiel #14
0
 protected void UPDATE(object sender, EventArgs e)
 {
     vendor = vendor_update(Convert.ToInt32(Update_vendor_GridView.SelectedValue));
 }
 public vendor Select(int id)
 {
     vendor vendor = new vendor();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_VENDOR", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@vendor_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             vendor.vendor_id = rdr.GetInt32(0);
         }
         else
         {
             vendor.vendor_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             vendor.vendor_name = rdr.GetString(1);
         }
         else
         {
             vendor.vendor_name = " ";
         }
         if (!rdr.IsDBNull(2))
         {
             vendor.phone_num = rdr.GetString(2);
         }
         else
         {
             vendor.phone_num = " ";
         }
         if (!rdr.IsDBNull(3))
         {
             vendor.email = rdr.GetString(3);
         }
         else
         {
             vendor.email = " ";
         }
         if (!rdr.IsDBNull(4))
         {
             vendor.address_id = rdr.GetInt32(4);
         }
         else
         {
             vendor.address_id = 0;
         }
         if (!rdr.IsDBNull(5))
         {
             vendor.Vendor_address2 = rdr.GetInt32(5);
         }
         else
         {
             vendor.Vendor_address2 = 0;
         }
         if (!rdr.IsDBNull(6))
         {
             vendor.vendor_job_assign = rdr.GetString(6);
         }
         else
         {
             vendor.vendor_job_assign = " ";
         }
         if (!rdr.IsDBNull(7))
         {
             vendor.vendor_start_date = rdr.GetDateTime(7);
         }
         else
         {
             vendor.vendor_start_date = DateTime.Now;
         }
         if (!rdr.IsDBNull(8))
         {
             vendor.vendor_end_date = rdr.GetDateTime(8);
         }
         else
         {
             vendor.vendor_end_date = DateTime.Now;
         }
         if (!rdr.IsDBNull(9))
         {
             vendor.vendor_meth_of_contact = rdr.GetString(9);
         }
         else
         {
             vendor.vendor_meth_of_contact = " ";
         }
         if (!rdr.IsDBNull(10))
         {
             vendor.vendor_status = rdr.GetString(10);
         }
         else
         {
             vendor.vendor_status = " ";
         }
         if (!rdr.IsDBNull(11))
         {
             vendor.vendor_meth_of_pay = rdr.GetString(11);
         }
         else
         {
             vendor.vendor_meth_of_pay = " ";
         }
         if (!rdr.IsDBNull(12))
         {
             vendor.vendor_type = rdr.GetString(12);
         }
         else
         {
             vendor.vendor_type = " ";
         }
         if (!rdr.IsDBNull(13))
         {
             vendor.vendor_comments = rdr.GetString(13);
         }
         else
         {
             vendor.vendor_comments = " ";
         }
         if (!rdr.IsDBNull(14))
         {
             vendor.primary_fName = rdr.GetString(14);
         }
         else
         {
             vendor.primary_fName = " ";
         }
         if (!rdr.IsDBNull(15))
         {
             vendor.primary_lName = rdr.GetString(15);
         }
         else
         {
             vendor.primary_lName = " ";
         }
         if (!rdr.IsDBNull(16))
         {
             vendor.primary_phone = rdr.GetString(16);
         }
         else
         {
             vendor.primary_phone = " ";
         }
         if (!rdr.IsDBNull(17))
         {
             vendor.sec_fName = rdr.GetString(17);
         }
         else
         {
             vendor.sec_fName = " ";
         }
         if (!rdr.IsDBNull(18))
         {
             vendor.sec_lName = rdr.GetString(18);
         }
         else
         {
             vendor.sec_lName = " ";
         }
         if (!rdr.IsDBNull(19))
         {
             vendor.sec_phone = rdr.GetString(19);
         }
         else
         {
             vendor.sec_phone = " ";
         }
         }
         else
         {
             vendor.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     vendor.SetColumnDefaults();
     return vendor;
     }
     finally
     {
     con.Close();
     }
     return vendor;
 }
 public vendor vendor_update(int ID)
 {
     vendor = vendor.Select(ID);
     vendor.vendor_id = Convert.ToInt32(Update_vendor_id_txt.Text);
     vendor.vendor_name = Update_vendor_name_txt.Text;
     vendor.phone_num = Update_phone_num_txt.Text;
     vendor.email = Update_email_txt.Text;
     vendor.address_id = Convert.ToInt32(Update_address_id_txt.Text);
     vendor.Vendor_address2 = Convert.ToInt32(Update_Vendor_address2_txt.Text);
     vendor.vendor_job_assign = Update_vendor_job_assign_txt.Text;
     vendor.vendor_start_date = Convert.ToDateTime(Update_vendor_start_date_txt.Text);
     vendor.vendor_end_date = Convert.ToDateTime(Update_vendor_end_date_txt.Text);
     vendor.vendor_meth_of_contact = Update_vendor_meth_of_contact_txt.Text;
     vendor.vendor_status = Update_vendor_status_txt.Text;
     vendor.vendor_meth_of_pay = Update_vendor_meth_of_pay_txt.Text;
     vendor.vendor_type = Update_vendor_type_txt.Text;
     vendor.vendor_comments = Update_vendor_comments_txt.Text;
     vendor.primary_fName = Update_primary_fName_txt.Text;
     vendor.primary_lName = Update_primary_lName_txt.Text;
     vendor.primary_phone = Update_primary_phone_txt.Text;
     vendor.sec_fName = Update_sec_fName_txt.Text;
     vendor.sec_lName = Update_sec_lName_txt.Text;
     vendor.sec_phone = Update_sec_phone_txt.Text;
     vendor.Update(vendor);
     Insert_vendor_GridView.DataBind();
     Update_vendor_GridView.DataBind();
     Delete_vendor_GridView.DataBind();
     return vendor;
 }
 public Boolean Update(vendor id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_VENDOR", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@vendor_id", id.vendor_id);
     cmd.Parameters.AddWithValue("@vendor_name", id.vendor_name);
     cmd.Parameters.AddWithValue("@phone_num", id.phone_num);
     cmd.Parameters.AddWithValue("@email", id.email);
     cmd.Parameters.AddWithValue("@address_id", id.address_id);
     cmd.Parameters.AddWithValue("@Vendor_address2", id.Vendor_address2);
     cmd.Parameters.AddWithValue("@vendor_job_assign", id.vendor_job_assign);
     cmd.Parameters.AddWithValue("@vendor_start_date", id.vendor_start_date);
     cmd.Parameters.AddWithValue("@vendor_end_date", id.vendor_end_date);
     cmd.Parameters.AddWithValue("@vendor_meth_of_contact", id.vendor_meth_of_contact);
     cmd.Parameters.AddWithValue("@vendor_status", id.vendor_status);
     cmd.Parameters.AddWithValue("@vendor_meth_of_pay", id.vendor_meth_of_pay);
     cmd.Parameters.AddWithValue("@vendor_type", id.vendor_type);
     cmd.Parameters.AddWithValue("@vendor_comments", id.vendor_comments);
     cmd.Parameters.AddWithValue("@primary_fName", id.primary_fName);
     cmd.Parameters.AddWithValue("@primary_lName", id.primary_lName);
     cmd.Parameters.AddWithValue("@primary_phone", id.primary_phone);
     cmd.Parameters.AddWithValue("@sec_fName", id.sec_fName);
     cmd.Parameters.AddWithValue("@sec_lName", id.sec_lName);
     cmd.Parameters.AddWithValue("@sec_phone", id.sec_phone);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }
Beispiel #18
0
        public vendor Select(int id)
        {
            vendor        vendor           = new vendor();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_VENDOR", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@vendor_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        vendor.vendor_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        vendor.vendor_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        vendor.vendor_name = rdr.GetString(1);
                    }
                    else
                    {
                        vendor.vendor_name = " ";
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        vendor.phone_num = rdr.GetString(2);
                    }
                    else
                    {
                        vendor.phone_num = " ";
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        vendor.email = rdr.GetString(3);
                    }
                    else
                    {
                        vendor.email = " ";
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        vendor.address_id = rdr.GetInt32(4);
                    }
                    else
                    {
                        vendor.address_id = 0;
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        vendor.Vendor_address2 = rdr.GetInt32(5);
                    }
                    else
                    {
                        vendor.Vendor_address2 = 0;
                    }
                    if (!rdr.IsDBNull(6))
                    {
                        vendor.vendor_job_assign = rdr.GetString(6);
                    }
                    else
                    {
                        vendor.vendor_job_assign = " ";
                    }
                    if (!rdr.IsDBNull(7))
                    {
                        vendor.vendor_start_date = rdr.GetDateTime(7);
                    }
                    else
                    {
                        vendor.vendor_start_date = DateTime.Now;
                    }
                    if (!rdr.IsDBNull(8))
                    {
                        vendor.vendor_end_date = rdr.GetDateTime(8);
                    }
                    else
                    {
                        vendor.vendor_end_date = DateTime.Now;
                    }
                    if (!rdr.IsDBNull(9))
                    {
                        vendor.vendor_meth_of_contact = rdr.GetString(9);
                    }
                    else
                    {
                        vendor.vendor_meth_of_contact = " ";
                    }
                    if (!rdr.IsDBNull(10))
                    {
                        vendor.vendor_status = rdr.GetString(10);
                    }
                    else
                    {
                        vendor.vendor_status = " ";
                    }
                    if (!rdr.IsDBNull(11))
                    {
                        vendor.vendor_meth_of_pay = rdr.GetString(11);
                    }
                    else
                    {
                        vendor.vendor_meth_of_pay = " ";
                    }
                    if (!rdr.IsDBNull(12))
                    {
                        vendor.vendor_type = rdr.GetString(12);
                    }
                    else
                    {
                        vendor.vendor_type = " ";
                    }
                    if (!rdr.IsDBNull(13))
                    {
                        vendor.vendor_comments = rdr.GetString(13);
                    }
                    else
                    {
                        vendor.vendor_comments = " ";
                    }
                    if (!rdr.IsDBNull(14))
                    {
                        vendor.primary_fName = rdr.GetString(14);
                    }
                    else
                    {
                        vendor.primary_fName = " ";
                    }
                    if (!rdr.IsDBNull(15))
                    {
                        vendor.primary_lName = rdr.GetString(15);
                    }
                    else
                    {
                        vendor.primary_lName = " ";
                    }
                    if (!rdr.IsDBNull(16))
                    {
                        vendor.primary_phone = rdr.GetString(16);
                    }
                    else
                    {
                        vendor.primary_phone = " ";
                    }
                    if (!rdr.IsDBNull(17))
                    {
                        vendor.sec_fName = rdr.GetString(17);
                    }
                    else
                    {
                        vendor.sec_fName = " ";
                    }
                    if (!rdr.IsDBNull(18))
                    {
                        vendor.sec_lName = rdr.GetString(18);
                    }
                    else
                    {
                        vendor.sec_lName = " ";
                    }
                    if (!rdr.IsDBNull(19))
                    {
                        vendor.sec_phone = rdr.GetString(19);
                    }
                    else
                    {
                        vendor.sec_phone = " ";
                    }
                }
                else
                {
                    vendor.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                vendor.SetColumnDefaults();
                return(vendor);
            }
            finally
            {
                con.Close();
            }
            return(vendor);
        }