Esempio n. 1
0
        public Boolean Update(requestor_Order id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_REQUESTOR_ORDER", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OrderID", id.OrderID);
                cmd.Parameters.AddWithValue("@Requestor_ID", id.Requestor_ID);
                cmd.Parameters.AddWithValue("@EncounterID", id.EncounterID);
                cmd.Parameters.AddWithValue("@OrderPriority", id.OrderPriority);
                cmd.Parameters.AddWithValue("@OrderNum", id.OrderNum);
                cmd.Parameters.AddWithValue("@ShipToAddressID", id.ShipToAddressID);
                cmd.Parameters.AddWithValue("@OrderDeliveryType", id.OrderDeliveryType);
                cmd.Parameters.AddWithValue("@OrderPickUpDate", id.OrderPickUpDate);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
Esempio n. 2
0
        public requestor_Order Insert(requestor_Order id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_REQUESTOR_ORDER", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Requestor_ID", id.Requestor_ID);
                cmd.Parameters.AddWithValue("@EncounterID", id.EncounterID);
                cmd.Parameters.AddWithValue("@OrderPriority", id.OrderPriority);
                cmd.Parameters.AddWithValue("@OrderNum", id.OrderNum);
                cmd.Parameters.AddWithValue("@ShipToAddressID", id.ShipToAddressID);
                cmd.Parameters.AddWithValue("@OrderDeliveryType", id.OrderDeliveryType);
                cmd.Parameters.AddWithValue("@OrderPickUpDate", id.OrderPickUpDate);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_REQUESTOR_ORDER", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Requestor_ID", id.Requestor_ID);
                cmd.Parameters.AddWithValue("@EncounterID", id.EncounterID);
                cmd.Parameters.AddWithValue("@OrderPriority", id.OrderPriority);
                cmd.Parameters.AddWithValue("@OrderNum", id.OrderNum);
                cmd.Parameters.AddWithValue("@ShipToAddressID", id.ShipToAddressID);
                cmd.Parameters.AddWithValue("@OrderDeliveryType", id.OrderDeliveryType);
                cmd.Parameters.AddWithValue("@OrderPickUpDate", id.OrderPickUpDate);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.OrderID = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
Esempio n. 3
0
        public requestor_Order Select(int id)
        {
            requestor_Order requestor_Order  = new requestor_Order();
            string          ConnectionString = IDManager.connection();
            SqlConnection   con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_REQUESTOR_ORDER", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OrderID", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        requestor_Order.OrderID = rdr.GetInt32(0);
                    }
                    else
                    {
                        requestor_Order.OrderID = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        requestor_Order.Requestor_ID = rdr.GetInt32(1);
                    }
                    else
                    {
                        requestor_Order.Requestor_ID = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        requestor_Order.EncounterID = rdr.GetInt32(2);
                    }
                    else
                    {
                        requestor_Order.EncounterID = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        requestor_Order.OrderPriority = rdr.GetInt32(3);
                    }
                    else
                    {
                        requestor_Order.OrderPriority = 0;
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        requestor_Order.OrderNum = rdr.GetInt32(4);
                    }
                    else
                    {
                        requestor_Order.OrderNum = 0;
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        requestor_Order.ShipToAddressID = rdr.GetInt32(5);
                    }
                    else
                    {
                        requestor_Order.ShipToAddressID = 0;
                    }
                    if (!rdr.IsDBNull(6))
                    {
                        requestor_Order.OrderDeliveryType = rdr.GetString(6);
                    }
                    else
                    {
                        requestor_Order.OrderDeliveryType = " ";
                    }
                    if (!rdr.IsDBNull(7))
                    {
                        requestor_Order.OrderPickUpDate = rdr.GetDateTime(7);
                    }
                    else
                    {
                        requestor_Order.OrderPickUpDate = DateTime.Now;
                    }
                }
                else
                {
                    requestor_Order.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                requestor_Order.SetColumnDefaults();
                return(requestor_Order);
            }
            finally
            {
                con.Close();
            }
            return(requestor_Order);
        }
 public requestor_Order Insert(requestor_Order id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_REQUESTOR_ORDER", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Requestor_ID", id.Requestor_ID);
     cmd.Parameters.AddWithValue("@EncounterID", id.EncounterID);
     cmd.Parameters.AddWithValue("@OrderPriority", id.OrderPriority);
     cmd.Parameters.AddWithValue("@OrderNum", id.OrderNum);
     cmd.Parameters.AddWithValue("@ShipToAddressID", id.ShipToAddressID);
     cmd.Parameters.AddWithValue("@OrderDeliveryType", id.OrderDeliveryType);
     cmd.Parameters.AddWithValue("@OrderPickUpDate", id.OrderPickUpDate);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_REQUESTOR_ORDER", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Requestor_ID", id.Requestor_ID);
     cmd.Parameters.AddWithValue("@EncounterID", id.EncounterID);
     cmd.Parameters.AddWithValue("@OrderPriority", id.OrderPriority);
     cmd.Parameters.AddWithValue("@OrderNum", id.OrderNum);
     cmd.Parameters.AddWithValue("@ShipToAddressID", id.ShipToAddressID);
     cmd.Parameters.AddWithValue("@OrderDeliveryType", id.OrderDeliveryType);
     cmd.Parameters.AddWithValue("@OrderPickUpDate", id.OrderPickUpDate);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.OrderID = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
 public Boolean Update(requestor_Order id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_REQUESTOR_ORDER", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@OrderID", id.OrderID);
     cmd.Parameters.AddWithValue("@Requestor_ID", id.Requestor_ID);
     cmd.Parameters.AddWithValue("@EncounterID", id.EncounterID);
     cmd.Parameters.AddWithValue("@OrderPriority", id.OrderPriority);
     cmd.Parameters.AddWithValue("@OrderNum", id.OrderNum);
     cmd.Parameters.AddWithValue("@ShipToAddressID", id.ShipToAddressID);
     cmd.Parameters.AddWithValue("@OrderDeliveryType", id.OrderDeliveryType);
     cmd.Parameters.AddWithValue("@OrderPickUpDate", id.OrderPickUpDate);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }
 public requestor_Order Select(int id)
 {
     requestor_Order requestor_Order = new requestor_Order();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_REQUESTOR_ORDER", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@OrderID", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             requestor_Order.OrderID = rdr.GetInt32(0);
         }
         else
         {
             requestor_Order.OrderID = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             requestor_Order.Requestor_ID = rdr.GetInt32(1);
         }
         else
         {
             requestor_Order.Requestor_ID = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             requestor_Order.EncounterID = rdr.GetInt32(2);
         }
         else
         {
             requestor_Order.EncounterID = 0;
         }
         if (!rdr.IsDBNull(3))
         {
             requestor_Order.OrderPriority = rdr.GetInt32(3);
         }
         else
         {
             requestor_Order.OrderPriority = 0;
         }
         if (!rdr.IsDBNull(4))
         {
             requestor_Order.OrderNum = rdr.GetInt32(4);
         }
         else
         {
             requestor_Order.OrderNum = 0;
         }
         if (!rdr.IsDBNull(5))
         {
             requestor_Order.ShipToAddressID = rdr.GetInt32(5);
         }
         else
         {
             requestor_Order.ShipToAddressID = 0;
         }
         if (!rdr.IsDBNull(6))
         {
             requestor_Order.OrderDeliveryType = rdr.GetString(6);
         }
         else
         {
             requestor_Order.OrderDeliveryType = " ";
         }
         if (!rdr.IsDBNull(7))
         {
             requestor_Order.OrderPickUpDate = rdr.GetDateTime(7);
         }
         else
         {
             requestor_Order.OrderPickUpDate = DateTime.Now;
         }
         }
         else
         {
             requestor_Order.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     requestor_Order.SetColumnDefaults();
     return requestor_Order;
     }
     finally
     {
     con.Close();
     }
     return requestor_Order;
 }