long savenewcoilspacification(SH_COILS_RAW_MATERIAL any_sample_coil)
 {
     try
     {
         string query = "INSERT INTO SH_SPECIFICATION_OF_RAW_MATERIAL_COILS ";
         query += "(SH_ITEM_WIDTH, SH_ITEM_THICKNESS, SH_ITEM_NAME, SH_ITEM_TYPE, SH_ITEM_FINISH, SH_ITEM_COATING, SH_ITEM_TEMPER, SH_ITEM_TOTAL_NET_WEIGHT, SH_ITEM_TOTAL_GROSS_WEIGHT) ";
         query += "VALUES(@SH_ITEM_WIDTH,@SH_ITEM_THICKNESS,@SH_ITEM_NAME,@SH_ITEM_TYPE,@SH_ITEM_FINISH,@SH_ITEM_COATING,@SH_ITEM_TEMPER,@SH_ITEM_TOTAL_NET_WEIGHT,@SH_ITEM_TOTAL_GROSS_WEIGHT)";
         query += "SELECT SCOPE_IDENTITY() AS myidentity";
         DatabaseConnection myconnection = new DatabaseConnection();
         myconnection.openConnection();
         SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
         cmd.Parameters.AddWithValue("@SH_ITEM_WIDTH", any_sample_coil.SH_ITEM_WIDTH);
         cmd.Parameters.AddWithValue("@SH_ITEM_THICKNESS", any_sample_coil.SH_ITEM_THICKNESS);
         cmd.Parameters.AddWithValue("@SH_ITEM_NAME", "صفيح");
         cmd.Parameters.AddWithValue("@SH_ITEM_TYPE", any_sample_coil.SH_ITEM_TYPE);
         cmd.Parameters.AddWithValue("@SH_ITEM_FINISH", any_sample_coil.SH_ITEM_FINISH);
         cmd.Parameters.AddWithValue("@SH_ITEM_COATING", any_sample_coil.SH_ITEM_COATING);
         cmd.Parameters.AddWithValue("@SH_ITEM_TEMPER", any_sample_coil.SH_ITEM_TEMPER);
         cmd.Parameters.AddWithValue("@SH_ITEM_TOTAL_NET_WEIGHT", any_sample_coil.SH_ITEM_TOTAL_NET_WEIGHT);
         cmd.Parameters.AddWithValue("@SH_ITEM_TOTAL_GROSS_WEIGHT", any_sample_coil.SH_ITEM_TOTAL_GROSS_WEIGHT);
         SqlDataReader reader = cmd.ExecuteReader();
         if (reader.Read())
         {
             return(long.Parse(reader["myidentity"].ToString()));
         }
         myconnection.closeConnection();
     }
     catch (Exception)
     {
         MessageBox.Show("ERROR WHILE SAVING COIL SPACIFICATION");
     }
     return(0);
 }
        long check_raw_material_existance_sp(SH_COILS_RAW_MATERIAL anycoil)
        {
            List <SH_SPECIFICATION_OF_RAW_MATERIAL_COILS> all_sp = new List <SH_SPECIFICATION_OF_RAW_MATERIAL_COILS>();

            if (string.IsNullOrEmpty(item_width_text_box.Text) && string.IsNullOrEmpty(item_thickness_text_box.Text) && string.IsNullOrEmpty(item_temper_combo_box.Text) && string.IsNullOrEmpty(item_type_combo_box.Text) && string.IsNullOrEmpty(item_finish_combo_box.Text))
            {
            }
            else
            {
                double mynum;
                long   mydidnum;
                if ((!string.IsNullOrEmpty(supplier_text_box.Text)) && double.TryParse(item_width_text_box.Text, out mynum) && long.TryParse(adding_request_number_text_box.Text, out mydidnum) && double.TryParse(item_thickness_text_box.Text, out mynum))
                {
                    try
                    {
                        DatabaseConnection myconnection = new DatabaseConnection();
                        myconnection.openConnection();
                        SqlCommand    cmd    = new SqlCommand("SELECT * FROM SH_SPECIFICATION_OF_RAW_MATERIAL_COILS ", DatabaseConnection.mConnection);
                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.Read())
                        {
                            all_sp.Add(new SH_SPECIFICATION_OF_RAW_MATERIAL_COILS {
                                SH_ID = long.Parse(reader["SH_ID"].ToString()), SH_ITEM_COATING = reader["SH_ITEM_COATING"].ToString(), SH_ITEM_FINISH = reader["SH_ITEM_FINISH"].ToString(), SH_ITEM_TEMPER = reader["SH_ITEM_TEMPER"].ToString(), SH_ITEM_THICKNESS = double.Parse(reader["SH_ITEM_THICKNESS"].ToString()), SH_ITEM_WIDTH = double.Parse(reader["SH_ITEM_WIDTH"].ToString())
                            });
                        }
                        myconnection.closeConnection();
                        for (int i = 0; i < all_sp.Count; i++)
                        {
                            if ((string.Compare(all_sp[i].SH_ITEM_FINISH, anycoil.SH_ITEM_FINISH) == 0) && (string.Compare(all_sp[i].SH_ITEM_COATING, anycoil.SH_ITEM_COATING) == 0) && (string.Compare(all_sp[i].SH_ITEM_TEMPER, anycoil.SH_ITEM_TEMPER) == 0) && (all_sp[i].SH_ITEM_WIDTH == anycoil.SH_ITEM_WIDTH) && (all_sp[i].SH_ITEM_THICKNESS == anycoil.SH_ITEM_THICKNESS))
                            {
                                return(all_sp[i].SH_ID);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("ERROR WHILE CHECKING RAW MATERIAL EXISTANCE" + ex.ToString());
                    }
                }
                else
                {
                    MessageBox.Show("الرجاء إدخال المعلومات بشكل صحيح", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                }
            }
            return(0);
        }
 bool check_if_there_is_coils_with_the_same_gross_and_net(SH_COILS_RAW_MATERIAL anycoil)
 {
     if (raw_coils.Count > 0)
     {
         for (int i = 0; i < raw_coils.Count; i++)
         {
             if ((raw_coils[i].SH_ITEM_TOTAL_NET_WEIGHT == anycoil.SH_ITEM_TOTAL_NET_WEIGHT) && (raw_coils[i].SH_ITEM_TOTAL_GROSS_WEIGHT == anycoil.SH_ITEM_TOTAL_GROSS_WEIGHT))
             {
                 return(true);
             }
         }
     }
     else
     {
         return(false);
     }
     return(false);
 }