Esempio n. 1
0
        private void search_btn_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            parcels.Clear();
            mtotal_number_of_parcels       = 0;
            mtotal_number_of_sheets        = 0;
            mtotoal_net_weight             = 0;
            total_number_of_sheets.Text    = 0.ToString();
            total_number_of_packages.Text  = 0.ToString();
            total_net_weight_text_box.Text = 0.ToString();
            double testnumber = 0;
            bool   length     = false;
            bool   width      = false;
            bool   thickness  = false;
            bool   temper     = false;
            bool   coating    = false;
            bool   code       = false;
            bool   finish     = false;
            bool   type       = false;
            bool   stock      = false;
            string mlength    = "";
            string mwidth     = "";
            string mthickness = "";
            string mtemper    = "";
            string mcaoting   = "";
            string mcode      = "";
            string mfinish    = "";
            string mtype      = "";
            string mStock     = "";



            if (string.IsNullOrEmpty(item_length_text_box.Text))
            {
                mlength = " ";
            }
            else if (double.TryParse(item_length_text_box.Text, out testnumber))
            {
                length  = true;
                mlength = " AND ( SH_ITEM_LENGTH = @SH_ITEM_LENGTH) ";
            }
            else
            {
                mlength = " ";
            }

            if (string.IsNullOrEmpty(item_width_text_box.Text))
            {
                mwidth = " ";
            }
            else if (double.TryParse(item_width_text_box.Text, out testnumber))
            {
                width  = true;
                mwidth = " AND ( SH_ITEM_WIDTH = @SH_ITEM_WIDTH ) ";
            }
            else
            {
                mwidth = " ";
            }
            if (string.IsNullOrEmpty(item_thickness_text_box.Text))
            {
                mthickness = " ";
            }
            else if (double.TryParse(item_thickness_text_box.Text, out testnumber))
            {
                thickness  = true;
                mthickness = " AND ( SH_ITEM_THICKNESS = @SH_ITEM_THICKNESS )";
            }
            else
            {
                mthickness = " ";
            }

            if (string.IsNullOrEmpty(stocks_combo_box.Text))
            {
                mStock = " ";
            }
            else
            {
                stock  = true;
                mStock = " AND ( SH_STOCK_NAME LIKE N'%" + stocks[stocks_combo_box.SelectedIndex].SH_STOCK_NAME + "%')";
            }


            if (string.IsNullOrEmpty(tempet_combo_box.Text))
            {
                mtemper = " ";
            }
            else
            {
                temper = true;

                mtemper = " AND ( SH_ITEM_TEMPER LIKE N'%" + item_temper[tempet_combo_box.SelectedIndex] + "%')";
            }

            if (string.IsNullOrEmpty(item_code_text_box.Text))
            {
                mcode = " ";
            }
            else
            {
                code  = true;
                mcode = " AND ( SH_ITEM_CODE  LIKE N'%" + item_code_text_box.Text + "%')";
            }

            if (string.IsNullOrEmpty(finish_combo_box.Text))
            {
                mfinish = " ";
            }
            else
            {
                finish  = true;
                mfinish = "AND (  SH_ITEM_FINISH LIKE N'%" + item_finish[finish_combo_box.SelectedIndex] + "%')";
            }

            if (string.IsNullOrEmpty(item_types_combo_box.Text))
            {
                mtype = " ";
                type  = false;
            }
            else
            {
                type = true;
                //OR  SH_ITEM_TYPE LIKE N'% @SH_ITEM_TYPE %' OR  SH_ITEM_TYPE LIKE N' @SH_ITEM_TYPE %'
                mtype = " AND ( SH_ITEM_TYPE LIKE N'%" + item_types[item_types_combo_box.SelectedIndex] + "%' )";
            }
            if (string.IsNullOrEmpty(coating_text_box.Text))
            {
                mcaoting = " ";
            }
            else
            {
                coating  = true;
                mcaoting = "  AND ( SH_ITEM_COATING LIKE N'%" + item_coating[coating_text_box.SelectedIndex] + "%')";
            }

            //+mlength + mwidth + mthickness + mcode + mfinish + mtemper + mtype + mcaoting +
            try
            {
                //   string query = "SELECT * FROM  SH_RAW_MATERIAL_PARCEL WHERE  (SH_ID NOT IN (SELECT SH_RAW_MATERIAL_PARCEL_ID FROM SH_PACKAGES_DISBURSED_RAW_MATERIAL) )" + mlength + mwidth + mthickness + mcode + mfinish + mtemper + mtype + mcaoting ;
                string query = "SELECT * FROM SH_RAW_MATERIAL_PARCEL WHERE SH_ID not in (SELECT SH_RAW_MATERIAL_PARCEL_ID FROM SH_PACKAGES_DISBURSED_RAW_MATERIAL )" + mlength + mwidth + mthickness + mcode + mfinish + mtemper + mtype + mcaoting + mStock;



                DatabaseConnection myconnection = new DatabaseConnection();
                myconnection.openConnection();
                SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                if (length)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_LENGTH", double.Parse(item_length_text_box.Text));
                }
                if (width)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_WIDTH", double.Parse(item_width_text_box.Text));
                }
                if (thickness)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_THICKNESS", double.Parse(item_thickness_text_box.Text));
                }
                if (code)
                {
                    // cmd.Parameters.AddWithValue("@SH_ITEM_CODE", item_code_text_box.Text);
                }
                if (temper)
                {
                    // cmd.Parameters.AddWithValue("@SH_ITEM_TEMPER", item_temper[tempet_combo_box.SelectedIndex]);
                }
                if (coating)
                {
                    // cmd.Parameters.AddWithValue("@SH_ITEM_COATING",item_coating[coating_text_box.SelectedIndex]);
                }
                if (finish)
                {
                    // cmd.Parameters.AddWithValue("@SH_ITEM_FINISH", item_finish[finish_combo_box.SelectedIndex]);
                }
                if (type)
                {
                    //MessageBox.Show(cmd.CommandText);
                    //  cmd.Parameters.AddWithValue("@SH_ITEM_TYPE", item_types[item_types_combo_box.SelectedIndex]);
                }
                //  MessageBox.Show(cmd.Parameters.ToString());
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    mtotal_number_of_parcels += 1;
                    mtotal_number_of_sheets  += long.Parse(reader["SH_ITEM_NUMBER_OF_SHEETS"].ToString());
                    parcels.Add(new SH_RAW_MATERIAL_PARCEL()
                    {
                        SH_ID = long.Parse(reader["SH_ID"].ToString()), SH_ADDITION_DATE = DateTime.Parse(reader["SH_ADDITION_DATE"].ToString()), SH_ITEM_COATING = reader["SH_ITEM_COATING"].ToString(), SH_ITEM_CODE = reader["SH_ITEM_CODE"].ToString(), SH_ITEM_FINISH = reader["SH_ITEM_FINISH"].ToString(), SH_ITEM_GROSS_WEIGHT = Math.Round(double.Parse(reader["SH_ITEM_PARCEL_GROSS_WEIGHT"].ToString()), 1), SH_ITEM_LENGTH = Math.Round(double.Parse(reader["SH_ITEM_LENGTH"].ToString()), 1), SH_ITEM_NUMBER_OF_SHEETS = long.Parse(reader["SH_ITEM_NUMBER_OF_SHEETS"].ToString()), SH_ITEM_PARCEL_GROSS_WEIGHT = Math.Round(double.Parse(reader["SH_ITEM_PARCEL_GROSS_WEIGHT"].ToString()), 1), SH_ITEM_PARCEL_NET_WEIGHT = Math.Round(double.Parse(reader["SH_ITEM_PARCEL_NET_WEIGHT"].ToString()), 1), SH_ITEM_SHEET_WEIGHT = Math.Round(double.Parse(reader["SH_ITEM_SHEET_WEIGHT"].ToString()), 1), SH_ITEM_TEMPER = reader["SH_ITEM_TEMPER"].ToString(), SH_ITEM_TYPE = reader["SH_ITEM_TYPE"].ToString(), SH_ITEM_THICKNESS = double.Parse(reader["SH_ITEM_THICKNESS"].ToString()), SH_ITEM_WIDTH = Math.Round(double.Parse(reader["SH_ITEM_WIDTH"].ToString()), 1), SH_STOCK_NAME = reader["SH_STOCK_NAME"].ToString(), SH_SUPPLIER_NAME = reader["SH_SUPPLIER_NAME"].ToString()
                    });
                    mtotoal_net_weight += double.Parse(reader["SH_ITEM_PARCEL_NET_WEIGHT"].ToString());
                }

                total_number_of_sheets.Text    = mtotal_number_of_sheets.ToString();
                total_number_of_packages.Text  = mtotal_number_of_parcels.ToString();
                total_net_weight_text_box.Text = String.Format("{0:0,0.0}", mtotoal_net_weight);
                myconnection.closeConnection();
                fillparcelsgridview();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR WHILE GETTING SEARCH RESULT FORM  " + ex.ToString());
            }
            finally
            {
                Cursor.Current = Cursors.WaitCursor;
            }
        }
Esempio n. 2
0
 void savenewquantityofmurantin(long muran_sp_id)
 {
     if (quantities.Count > 0)
     {
         for (int i = 0; i < quantities.Count; i++)
         {
             try
             {
                 string query = "INSERT INTO SH_QUANTITY_OF_MURAN_MATERIAL ";
                 query += "(SH_SPECIFICATION_OF_MURAN_MATERIAL_ID, SH_ITEM_LENGTH, SH_ITEM_WIDTH, SH_ITEM_THICKNESS, SH_ITEM_TYPE, SH_ITEM_NAME, SH_ITEM_CODE, SH_ITEM_INTENSITY,";
                 query += "SH_ITEM_SHEET_WEIGHT, SH_ITEM_PACKAGE_NET_WEIGHT, SH_ITEM_NUMBER_OF_PACKAGES, SH_ITEM_TOTAL_NUMBER_OF_SHEETS, SH_QUANTITY_NET_WEIGHT, SH_QUANTITY_GROSS_WEIGHT,";
                 query += "SH_PACKAGE_GROSS_WEIGHT, SH_CLIENT_NAME, SH_STOCK_NAME, SH_ITEM_FIRST_FACE, SH_ITEM_SECOND_FACE, SH_MURAN_TYPE,";
                 query += " SH_BOTTLE_CAPACITY";
                 query += ", SH_BOTTLE_HEIGHT , SH_SIZE_ID , SH_SIZE_NAME ) VALUES( @SH_SPECIFICATION_OF_MURAN_MATERIAL_ID , @SH_ITEM_LENGTH , @SH_ITEM_WIDTH,@SH_ITEM_THICKNESS,@SH_ITEM_TYPE,@SH_ITEM_NAME,@SH_ITEM_CODE,@SH_ITEM_INTENSITY";
                 query += ",@SH_ITEM_SHEET_WEIGHT,@SH_ITEM_PACKAGE_NET_WEIGHT,@SH_ITEM_NUMBER_OF_PACKAGES,@SH_ITEM_TOTAL_NUMBER_OF_SHEETS,@SH_QUANTITY_NET_WEIGHT,@SH_QUANTITY_GROSS_WEIGHT";
                 query += ",@SH_PACKAGE_GROSS_WEIGHT,@SH_CLIENT_NAME,@SH_STOCK_NAME,@SH_ITEM_FIRST_FACE,@SH_ITEM_SECOND_FACE,@SH_MURAN_TYPE";
                 query += ",@SH_BOTTLE_CAPACITY, @SH_BOTTLE_HEIGHT  , @SH_SIZE_ID , @SH_SIZE_NAME)";
                 query += "SELECT SCOPE_IDENTITY() AS myidentity";
                 DatabaseConnection myconnection = new DatabaseConnection();
                 myconnection.openConnection();
                 SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                 cmd.Parameters.AddWithValue("@SH_SPECIFICATION_OF_MURAN_MATERIAL_ID", muran_sp_id);
                 cmd.Parameters.AddWithValue("@SH_ITEM_LENGTH", quantities[i].SH_ITEM_LENGTH);
                 cmd.Parameters.AddWithValue("@SH_ITEM_WIDTH", quantities[i].SH_ITEM_WIDTH);
                 cmd.Parameters.AddWithValue("@SH_ITEM_THICKNESS", quantities[i].SH_ITEM_THICKNESS);
                 cmd.Parameters.AddWithValue("@SH_ITEM_TYPE", quantities[i].SH_ITEM_TYPE);
                 cmd.Parameters.AddWithValue("@SH_ITEM_NAME", "صفيح");
                 cmd.Parameters.AddWithValue("@SH_ITEM_CODE", quantities[i].SH_ITEM_CODE);
                 cmd.Parameters.AddWithValue("@SH_ITEM_INTENSITY", quantities[i].SH_ITEM_INTENSITY);
                 cmd.Parameters.AddWithValue("@SH_ITEM_SHEET_WEIGHT", quantities[i].SH_ITEM_SHEET_WEIGHT);
                 cmd.Parameters.AddWithValue("@SH_ITEM_PACKAGE_NET_WEIGHT", quantities[i].SH_ITEM_PARCEL_NET_WEIGHT);
                 cmd.Parameters.AddWithValue("@SH_ITEM_NUMBER_OF_PACKAGES", quantities[i].SH_ITEM_NUMBER_OF_PACKAGES);
                 cmd.Parameters.AddWithValue("@SH_ITEM_TOTAL_NUMBER_OF_SHEETS", quantities[i].SH_ITEM_TOTAL_NUMBER_OF_SHEETS);
                 cmd.Parameters.AddWithValue("@SH_QUANTITY_NET_WEIGHT", quantities[i].SH_QUANTITY_NET_WEIGHT);
                 cmd.Parameters.AddWithValue("@SH_QUANTITY_GROSS_WEIGHT", 0);
                 cmd.Parameters.AddWithValue("@SH_PACKAGE_GROSS_WEIGHT", 0);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_NAME", quantities[i].SH_CLIENT_NAME);
                 cmd.Parameters.AddWithValue("@SH_STOCK_NAME", quantities[i].SH_STOCK_NAME);
                 cmd.Parameters.AddWithValue("@SH_ITEM_FIRST_FACE", quantities[i].SH_ITEM_FIRST_FACE);
                 cmd.Parameters.AddWithValue("@SH_ITEM_SECOND_FACE", quantities[i].SH_ITEM_SECOND_FACE);
                 cmd.Parameters.AddWithValue("@SH_MURAN_TYPE", quantities[i].SH_MURAN_TYPE);
                 cmd.Parameters.AddWithValue("@SH_BOTTLE_HEIGHT", quantities[i].SH_BOTTLE_HEIGHT);
                 cmd.Parameters.AddWithValue("@SH_BOTTLE_CAPACITY", quantities[i].SH_BOTTLE_CAPACITY);
                 cmd.Parameters.AddWithValue("@SH_SIZE_ID", quantities[i].SH_SIZE_ID);
                 cmd.Parameters.AddWithValue("@SH_SIZE_NAME", quantities[i].SH_SIZE_NAME);
                 SqlDataReader reader = cmd.ExecuteReader();
                 if (reader.Read())
                 {
                     long q_id = long.Parse(reader["myidentity"].ToString());
                     savemurantinparcel(muran_sp_id, q_id, quantities[i].SH_ITEM_NUMBER_OF_PACKAGES, quantities[i]);
                 }
                 myconnection.closeConnection();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("ERROR WHILE SAVING QUANTITIES" + ex.ToString());
             }
         }
         MessageBox.Show("تم الحفظ ", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
     }
 }
Esempio n. 3
0
        void saveUserPermisions()
        {
            try
            {
                string query = " INSERT INTO SH_USER_PERMISIONS ";
                query += "(SH_ACCOUNT_ID, SH_ACCOUNT_NAME, SH_OPEN_CHANGE_PASSWORD, SH_OPEN_DASH_BOARD, SH_OPEN_GETALL_EMP, SH_OPEN_DISPLAY_ALLUSERS, SH_OPEN_MAKE_NEW_USER, SH_OPEN_REGIST_EMP,";
                query += " SH_OPEN_SELECT_USER_PERMISION, SH_ADD_NEW_CLIENT_COMPANY, SH_ADD_NEW_CLIENT_BRANCH, SH_SHOW_ALL_CLIENTS, SH_ADD_NEW_SUPPLIER, SH_ADD_NEW_SUPPLIER_BRANCH,";
                query += " SH_SHOW_ALL_SUPPLIERS, SH_MAIN_TIN_STOCK, SH_RAW_TIN_MATERIAL, SH_ADD_NEW_RAW_TIN_FIRST_DURATION, SH_ADD_NEW_RAW_TIN, SH_EXCHANGE_RAW_TIN_PARCEL_NO,";
                query += " SH_EXCHANGE_RAW_TIN_PROPERTIES, SH_ADD_NEW_MURAN_TIN, SH_EXCHANGE_MURAN_TIN, SH_ADD_NEW_PRINTED_TIN, SH_EXCHANGE_PRINTED_TIN, SH_ADD_NEW_SIZE, SH_ADD_NEW_CUT_RAW_TIN,";
                query += " SH_EXCHANGE_CUT_RAW_TIN, SH_ADD_NEW_CUT_PRINTED_TIN, SH_EXCHANGE_CUT_PRINTED_TIN, SH_ADD_NEW_CUT_MURAN_TIN, SH_EXCHANGE_CUT_MURAN_TIN, SH_SHOW_ALL_CUTTERS,";
                query += " SH_ADD_NEW_CUTTERS, SH_ADD_NEW_STOCK_PLACE, SH_SHOW_ALL_STOCKS, SH_DEPARTMENT_STOCKS, SH_DEPARTMENT_SALES, SH_DEPARTMENT_HR, SH_DEPARTMENT_PURCHASING,";
                query += " SH_DEPARTMENT_SECRETARY, SH_DEPARTMENT_ACCOUNTING, SH_DEPARTMENT_IT, SH_DEPARTMENT_PRODUCTION, SH_IT_SERVER_SETTINGS, SH_ADD_NEW_DEPARTMENT, SH_ADD_NEW_JOB,";
                query += " SH_ADD_NEW_PRODUCT_CLIENT, SH_ADD_NEW_COLOR, SH_ADD_PRODUCTION_REQUIRMENT, SH_EXCHANGE_PRODUCTION_REQUIRMENT, SH_ADD_CHANGE_BITS, SH_EXCHANGE_CHANGE_BITS,";
                query += " SH_ADD_EASY_OPEN, SH_EXCHANGE_EASY_OPEN, SH_ADD_TIN_CANS, SH_EXCHANGE_TIN_CANS, SH_ADD_NEW_RLT, SH_EXCHANGE_RLT, SH_ADD_NEW_BOTTOM, SH_EXCHANGE_BOTTOM)";
                query += " VALUES(@SH_ACCOUNT_ID, @SH_ACCOUNT_NAME, @SH_OPEN_CHANGE_PASSWORD, @SH_OPEN_DASH_BOARD, @SH_OPEN_GETALL_EMP, @SH_OPEN_DISPLAY_ALLUSERS, @SH_OPEN_MAKE_NEW_USER, @SH_OPEN_REGIST_EMP, ";
                query += " @SH_OPEN_SELECT_USER_PERMISION, @SH_ADD_NEW_CLIENT_COMPANY, @SH_ADD_NEW_CLIENT_BRANCH, @SH_SHOW_ALL_CLIENTS, @SH_ADD_NEW_SUPPLIER, @SH_ADD_NEW_SUPPLIER_BRANCH, ";
                query += " @SH_SHOW_ALL_SUPPLIERS, @SH_MAIN_TIN_STOCK, @SH_RAW_TIN_MATERIAL, @SH_ADD_NEW_RAW_TIN_FIRST_DURATION, @SH_ADD_NEW_RAW_TIN, @SH_EXCHANGE_RAW_TIN_PARCEL_NO, ";
                query += " @SH_EXCHANGE_RAW_TIN_PROPERTIES, @SH_ADD_NEW_MURAN_TIN, @SH_EXCHANGE_MURAN_TIN, @SH_ADD_NEW_PRINTED_TIN, @SH_EXCHANGE_PRINTED_TIN, @SH_ADD_NEW_SIZE, @SH_ADD_NEW_CUT_RAW_TIN, ";
                query += " @SH_EXCHANGE_CUT_RAW_TIN, @SH_ADD_NEW_CUT_PRINTED_TIN, @SH_EXCHANGE_CUT_PRINTED_TIN, @SH_ADD_NEW_CUT_MURAN_TIN, @SH_EXCHANGE_CUT_MURAN_TIN, @SH_SHOW_ALL_CUTTERS, ";
                query += " @SH_ADD_NEW_CUTTERS, @SH_ADD_NEW_STOCK_PLACE, @SH_SHOW_ALL_STOCKS, @SH_DEPARTMENT_STOCKS, @SH_DEPARTMENT_SALES, @SH_DEPARTMENT_HR, @SH_DEPARTMENT_PURCHASING, ";
                query += " @SH_DEPARTMENT_SECRETARY, @SH_DEPARTMENT_ACCOUNTING, @SH_DEPARTMENT_IT, @SH_DEPARTMENT_PRODUCTION, @SH_IT_SERVER_SETTINGS, @SH_ADD_NEW_DEPARTMENT, @SH_ADD_NEW_JOB, ";
                query += " @SH_ADD_NEW_PRODUCT_CLIENT, @SH_ADD_NEW_COLOR, @SH_ADD_PRODUCTION_REQUIRMENT, @SH_EXCHANGE_PRODUCTION_REQUIRMENT, @SH_ADD_CHANGE_BITS, @SH_EXCHANGE_CHANGE_BITS, ";
                query += " @SH_ADD_EASY_OPEN, @SH_EXCHANGE_EASY_OPEN, @SH_ADD_TIN_CANS, @SH_EXCHANGE_TIN_CANS, @SH_ADD_NEW_RLT, @SH_EXCHANGE_RLT, @SH_ADD_NEW_BOTTOM, @SH_EXCHANGE_BOTTOM) ";
                DatabaseConnection myconnection = new DatabaseConnection();
                myconnection.openConnection();
                SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                cmd.Parameters.AddWithValue("@SH_ACCOUNT_ID", acc.SH_ID);
                cmd.Parameters.AddWithValue("@SH_ACCOUNT_NAME", acc.SH_EMP_USER_NAME);
                cmd.Parameters.AddWithValue("@SH_OPEN_CHANGE_PASSWORD", userPerm.SH_OPEN_CHANGE_PASSWORD);
                cmd.Parameters.AddWithValue("@SH_OPEN_DASH_BOARD", userPerm.SH_OPEN_DASH_BOARD);
                cmd.Parameters.AddWithValue("@SH_OPEN_GETALL_EMP", userPerm.SH_OPEN_GETALL_EMP);
                cmd.Parameters.AddWithValue("@SH_OPEN_DISPLAY_ALLUSERS", userPerm.SH_OPEN_DISPLAY_ALLUSERS);
                cmd.Parameters.AddWithValue("@SH_OPEN_MAKE_NEW_USER", userPerm.SH_OPEN_MAKE_NEW_USER);
                cmd.Parameters.AddWithValue("@SH_OPEN_REGIST_EMP", userPerm.SH_OPEN_REGIST_EMP);
                cmd.Parameters.AddWithValue("@SH_OPEN_SELECT_USER_PERMISION", userPerm.SH_OPEN_SELECT_USER_PERMISION);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_CLIENT_COMPANY", userPerm.SH_ADD_NEW_CLIENT_COMPANY);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_CLIENT_BRANCH", userPerm.SH_ADD_NEW_CLIENT_BRANCH);
                cmd.Parameters.AddWithValue("@SH_SHOW_ALL_CLIENTS", userPerm.SH_SHOW_ALL_CLIENTS);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_SUPPLIER", userPerm.SH_ADD_NEW_SUPPLIER);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_SUPPLIER_BRANCH", userPerm.SH_ADD_NEW_SUPPLIER_BRANCH);
                cmd.Parameters.AddWithValue("@SH_SHOW_ALL_SUPPLIERS", userPerm.SH_SHOW_ALL_SUPPLIERS);
                cmd.Parameters.AddWithValue("@SH_MAIN_TIN_STOCK", userPerm.SH_MAIN_TIN_STOCK);
                cmd.Parameters.AddWithValue("@SH_RAW_TIN_MATERIAL", userPerm.SH_RAW_TIN_MATERIAL);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_RAW_TIN_FIRST_DURATION", userPerm.SH_ADD_NEW_RAW_TIN_FIRST_DURATION);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_RAW_TIN", userPerm.SH_ADD_NEW_RAW_TIN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_RAW_TIN_PARCEL_NO", userPerm.SH_EXCHANGE_RAW_TIN_PARCEL_NO);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_RAW_TIN_PROPERTIES", userPerm.SH_EXCHANGE_RAW_TIN_PROPERTIES);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_MURAN_TIN", userPerm.SH_ADD_NEW_MURAN_TIN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_MURAN_TIN", userPerm.SH_EXCHANGE_MURAN_TIN);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_PRINTED_TIN", userPerm.SH_ADD_NEW_PRINTED_TIN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_PRINTED_TIN", userPerm.SH_EXCHANGE_PRINTED_TIN);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_SIZE", userPerm.SH_ADD_NEW_SIZE);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_CUT_RAW_TIN", userPerm.SH_ADD_NEW_CUT_RAW_TIN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_CUT_RAW_TIN", userPerm.SH_EXCHANGE_CUT_RAW_TIN);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_CUT_PRINTED_TIN", userPerm.SH_ADD_NEW_CUT_PRINTED_TIN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_CUT_PRINTED_TIN", userPerm.SH_EXCHANGE_CUT_PRINTED_TIN);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_CUT_MURAN_TIN", userPerm.SH_ADD_NEW_CUT_MURAN_TIN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_CUT_MURAN_TIN", userPerm.SH_EXCHANGE_CUT_MURAN_TIN);
                cmd.Parameters.AddWithValue("@SH_SHOW_ALL_CUTTERS", userPerm.SH_SHOW_ALL_CUTTERS);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_CUTTERS", userPerm.SH_ADD_NEW_CUTTERS);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_STOCK_PLACE", userPerm.SH_ADD_NEW_STOCK_PLACE);
                cmd.Parameters.AddWithValue("@SH_SHOW_ALL_STOCKS", userPerm.SH_SHOW_ALL_STOCKS);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_STOCKS", userPerm.SH_DEPARTMENT_STOCKS);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_SALES", userPerm.SH_DEPARTMENT_SALES);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_HR", userPerm.SH_DEPARTMENT_HR);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_PURCHASING", userPerm.SH_DEPARTMENT_PURCHASING);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_SECRETARY", userPerm.SH_DEPARTMENT_SECRETARY);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_ACCOUNTING", userPerm.SH_DEPARTMENT_ACCOUNTING);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_IT", userPerm.SH_DEPARTMENT_IT);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_PRODUCTION", userPerm.SH_DEPARTMENT_PRODUCTION);
                cmd.Parameters.AddWithValue("@SH_IT_SERVER_SETTINGS", userPerm.SH_IT_SERVER_SETTINGS);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_DEPARTMENT", userPerm.SH_ADD_NEW_DEPARTMENT);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_JOB", userPerm.SH_ADD_NEW_JOB);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_PRODUCT_CLIENT", userPerm.SH_ADD_NEW_PRODUCT_CLIENT);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_COLOR", userPerm.SH_ADD_NEW_COLOR);
                cmd.Parameters.AddWithValue("@SH_ADD_PRODUCTION_REQUIRMENT", userPerm.SH_ADD_PRODUCTION_REQUIRMENT);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_PRODUCTION_REQUIRMENT", userPerm.SH_EXCHANGE_PRODUCTION_REQUIRMENT);
                cmd.Parameters.AddWithValue("@SH_ADD_CHANGE_BITS", userPerm.SH_ADD_CHANGE_BITS);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_CHANGE_BITS", userPerm.SH_EXCHANGE_CHANGE_BITS);
                cmd.Parameters.AddWithValue("@SH_ADD_EASY_OPEN", userPerm.SH_ADD_EASY_OPEN);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_EASY_OPEN", userPerm.SH_EXCHANGE_EASY_OPEN);
                cmd.Parameters.AddWithValue("@SH_ADD_TIN_CANS", userPerm.SH_ADD_TIN_CANS);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_TIN_CANS", userPerm.SH_EXCHANGE_EASY_OPEN);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_RLT", userPerm.SH_ADD_NEW_RLT);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_RLT", userPerm.SH_EXCHANGE_RLT);
                cmd.Parameters.AddWithValue("@SH_ADD_NEW_BOTTOM", userPerm.SH_ADD_NEW_BOTTOM);
                cmd.Parameters.AddWithValue("@SH_EXCHANGE_BOTTOM", userPerm.SH_EXCHANGE_BOTTOM);
                cmd.Parameters.AddWithValue("@SH_DEPARTMENT_MAINTENANCE", userPerm.SH_DEPARTMENT_MAINTENANCE);
                cmd.ExecuteNonQuery();

                MessageBox.Show("تم التسجيل بجاح");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in" + ex.Message);
            }
        }