コード例 #1
0
        public Boolean Update(Mobile_Product id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_MOBILE_PRODUCT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Mobile_Product_id", id.Mobile_Product_id);
                cmd.Parameters.AddWithValue("@Mobile_Unit_id", id.Mobile_Unit_id);
                cmd.Parameters.AddWithValue("@Product_id", id.Product_id);
                cmd.Parameters.AddWithValue("@Case_id", id.Case_id);
                cmd.Parameters.AddWithValue("@Lot_id", id.Lot_id);
                cmd.Parameters.AddWithValue("@Min_inv", id.Min_inv);
                cmd.Parameters.AddWithValue("@Quantity", id.Quantity);
                cmd.Parameters.AddWithValue("@Experiation_Date", id.Experiation_Date);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
コード例 #2
0
        public Mobile_Product Insert(Mobile_Product id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_MOBILE_PRODUCT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Mobile_Unit_id", id.Mobile_Unit_id);
                cmd.Parameters.AddWithValue("@Product_id", id.Product_id);
                cmd.Parameters.AddWithValue("@Case_id", id.Case_id);
                cmd.Parameters.AddWithValue("@Lot_id", id.Lot_id);
                cmd.Parameters.AddWithValue("@Min_inv", id.Min_inv);
                cmd.Parameters.AddWithValue("@Quantity", id.Quantity);
                cmd.Parameters.AddWithValue("@Experiation_Date", id.Experiation_Date);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_MOBILE_PRODUCT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Mobile_Unit_id", id.Mobile_Unit_id);
                cmd.Parameters.AddWithValue("@Product_id", id.Product_id);
                cmd.Parameters.AddWithValue("@Case_id", id.Case_id);
                cmd.Parameters.AddWithValue("@Lot_id", id.Lot_id);
                cmd.Parameters.AddWithValue("@Min_inv", id.Min_inv);
                cmd.Parameters.AddWithValue("@Quantity", id.Quantity);
                cmd.Parameters.AddWithValue("@Experiation_Date", id.Experiation_Date);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.Mobile_Product_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
 public Mobile_Product Insert(Mobile_Product id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_MOBILE_PRODUCT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Mobile_Unit_id", id.Mobile_Unit_id);
     cmd.Parameters.AddWithValue("@Product_id", id.Product_id);
     cmd.Parameters.AddWithValue("@Case_id", id.Case_id);
     cmd.Parameters.AddWithValue("@Lot_id", id.Lot_id);
     cmd.Parameters.AddWithValue("@Min_inv", id.Min_inv);
     cmd.Parameters.AddWithValue("@Quantity", id.Quantity);
     cmd.Parameters.AddWithValue("@Experiation_Date", id.Experiation_Date);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_MOBILE_PRODUCT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Mobile_Unit_id", id.Mobile_Unit_id);
     cmd.Parameters.AddWithValue("@Product_id", id.Product_id);
     cmd.Parameters.AddWithValue("@Case_id", id.Case_id);
     cmd.Parameters.AddWithValue("@Lot_id", id.Lot_id);
     cmd.Parameters.AddWithValue("@Min_inv", id.Min_inv);
     cmd.Parameters.AddWithValue("@Quantity", id.Quantity);
     cmd.Parameters.AddWithValue("@Experiation_Date", id.Experiation_Date);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.Mobile_Product_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
 public Boolean Update(Mobile_Product id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_MOBILE_PRODUCT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Mobile_Product_id", id.Mobile_Product_id);
     cmd.Parameters.AddWithValue("@Mobile_Unit_id", id.Mobile_Unit_id);
     cmd.Parameters.AddWithValue("@Product_id", id.Product_id);
     cmd.Parameters.AddWithValue("@Case_id", id.Case_id);
     cmd.Parameters.AddWithValue("@Lot_id", id.Lot_id);
     cmd.Parameters.AddWithValue("@Min_inv", id.Min_inv);
     cmd.Parameters.AddWithValue("@Quantity", id.Quantity);
     cmd.Parameters.AddWithValue("@Experiation_Date", id.Experiation_Date);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }
 public Mobile_Product Select(int id)
 {
     Mobile_Product Mobile_Product = new Mobile_Product();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_MOBILE_PRODUCT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Mobile_Product_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             Mobile_Product.Mobile_Product_id = rdr.GetInt32(0);
         }
         else
         {
             Mobile_Product.Mobile_Product_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             Mobile_Product.Mobile_Unit_id = rdr.GetInt32(1);
         }
         else
         {
             Mobile_Product.Mobile_Unit_id = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             Mobile_Product.Product_id = rdr.GetInt32(2);
         }
         else
         {
             Mobile_Product.Product_id = 0;
         }
         if (!rdr.IsDBNull(3))
         {
             Mobile_Product.Case_id = rdr.GetInt32(3);
         }
         else
         {
             Mobile_Product.Case_id = 0;
         }
         if (!rdr.IsDBNull(4))
         {
             Mobile_Product.Lot_id = rdr.GetInt32(4);
         }
         else
         {
             Mobile_Product.Lot_id = 0;
         }
         if (!rdr.IsDBNull(5))
         {
             Mobile_Product.Min_inv = rdr.GetInt32(5);
         }
         else
         {
             Mobile_Product.Min_inv = 0;
         }
         if (!rdr.IsDBNull(6))
         {
             Mobile_Product.Quantity = rdr.GetInt32(6);
         }
         else
         {
             Mobile_Product.Quantity = 0;
         }
         if (!rdr.IsDBNull(7))
         {
             Mobile_Product.Experiation_Date = rdr.GetDateTime(7);
         }
         else
         {
             Mobile_Product.Experiation_Date = DateTime.Now;
         }
         }
         else
         {
             Mobile_Product.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     Mobile_Product.SetColumnDefaults();
     return Mobile_Product;
     }
     finally
     {
     con.Close();
     }
     return Mobile_Product;
 }
コード例 #6
0
        public Mobile_Product Select(int id)
        {
            Mobile_Product Mobile_Product   = new Mobile_Product();
            string         ConnectionString = IDManager.connection();
            SqlConnection  con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_MOBILE_PRODUCT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Mobile_Product_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        Mobile_Product.Mobile_Product_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        Mobile_Product.Mobile_Product_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        Mobile_Product.Mobile_Unit_id = rdr.GetInt32(1);
                    }
                    else
                    {
                        Mobile_Product.Mobile_Unit_id = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        Mobile_Product.Product_id = rdr.GetInt32(2);
                    }
                    else
                    {
                        Mobile_Product.Product_id = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        Mobile_Product.Case_id = rdr.GetInt32(3);
                    }
                    else
                    {
                        Mobile_Product.Case_id = 0;
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        Mobile_Product.Lot_id = rdr.GetInt32(4);
                    }
                    else
                    {
                        Mobile_Product.Lot_id = 0;
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        Mobile_Product.Min_inv = rdr.GetInt32(5);
                    }
                    else
                    {
                        Mobile_Product.Min_inv = 0;
                    }
                    if (!rdr.IsDBNull(6))
                    {
                        Mobile_Product.Quantity = rdr.GetInt32(6);
                    }
                    else
                    {
                        Mobile_Product.Quantity = 0;
                    }
                    if (!rdr.IsDBNull(7))
                    {
                        Mobile_Product.Experiation_Date = rdr.GetDateTime(7);
                    }
                    else
                    {
                        Mobile_Product.Experiation_Date = DateTime.Now;
                    }
                }
                else
                {
                    Mobile_Product.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                Mobile_Product.SetColumnDefaults();
                return(Mobile_Product);
            }
            finally
            {
                con.Close();
            }
            return(Mobile_Product);
        }