Esempio n. 1
0
        private void sıralıYazdırmaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                using (MB_NEW.Modals.SearchWithBarcodeModal ara = new MB_NEW.Modals.SearchWithBarcodeModal())
                {
                    if (ara.ShowDialog() == DialogResult.OK)
                    {
                        ;
                        int len_ = ara.allRecords.Length;
                        if (len_ > 0)
                        {
                            search_text = " ITEMS.LOGICALREF IN (";
                            for (int i = 0; i < len_; i++)
                            {
                                search_text += "\'" + ara.allRecords[i].item_id.ToString() + "\'";
                            }

                            string in_text  = "";
                            string in_order = "CASE ITEMS.LOGICALREF ";
                            galyndy_query = "CASE ITEMS.LOGICALREF ";

                            for (int i = 0; i < len_; i++)
                            {
                                if (i != 0)
                                {
                                    in_text += ", ";
                                }
                                in_order      += "WHEN '" + ara.allRecords[i].item_id + "' THEN " + ara.allRecords[i].order + " ";
                                galyndy_query += "WHEN '" + ara.allRecords[i].item_id + "' THEN " + ara.allRecords[i].galyndy + " ";
                                in_text       += "'" + ara.allRecords[i].item_id + "'";
                            }
                            galyndy_query += " END GALYNDY ";
                            if (in_text != "")
                            {
                                search_text = " AND ITEMS.LOGICALREF IN(" + in_text + ") ORDER BY " + in_order + " END";
                            }
                            else
                            {
                                search_text = " AND ITEMS.LOGICALREF IN(-1)";
                            }
                            getData();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MB_NEW.Log.set("HATA: BarcodeForm>BarcodeReturn\nEXCEPTION:" + ex.ToString());
                MessageBox.Show("Hata oluştu. Programı yeniden başlatin.\n\n", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void sıralıYazdırmaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                using (MB_NEW.Modals.SearchWithBarcodeModal ara = new MB_NEW.Modals.SearchWithBarcodeModal())
                {
                    if (ara.ShowDialog() == DialogResult.OK)
                    {
                        //GET VALUE
                        barcodes = ara.barcodes;
                        int len_ = barcodes.Length;
                        if (len_ > 0)
                        {
                            search_text = "";

                            string in_text  = "";
                            string in_order = "CASE BARCODE ";

                            for (int i = 0; i < len_; i++)
                            {
                                if (i != 0)
                                {
                                    in_text += ", ";
                                }
                                in_order += "WHEN '" + barcodes[i] + "' THEN " + (i + 1).ToString() + " ";
                                in_text  += "'" + barcodes[i] + "'";
                            }

                            sql = "SELECT ITEMREF FROM LG_" + Int32.Parse(SettingsConf.tiger_firma_num).ToString("000") + "_UNITBARCODE WHERE BARCODE IN(" + in_text + ") ORDER BY " + in_order + " END";
                            // richTextBox1.Text = (sql);

                            SqlConnection bag = new SqlConnection(@"server=" + SettingsConf.server_name + ";Initial Catalog=" + SettingsConf.tiger_firma_database_name + "; User ID=" + SettingsConf.server_user_name + "; Password="******";");
                            bag.Open();

                            SqlCommand    cmdepo = new SqlCommand(sql, bag);
                            SqlDataReader rs     = cmdepo.ExecuteReader();

                            List <string> log_ref = new List <string>();
                            while (rs.Read())
                            {
                                log_ref.Add(rs[0].ToString());
                            }
                            bag.Close();

                            // hakyky sql ucin
                            in_text  = "";
                            in_order = "CASE ITEMS.LOGICALREF ";
                            len_     = log_ref.Count();

                            for (int i = 0; i < len_; i++)
                            {
                                if (i != 0)
                                {
                                    in_text += ", ";
                                }
                                in_order += "WHEN '" + log_ref[i] + "' THEN " + (i + 1).ToString() + " ";
                                in_text  += "'" + log_ref[i] + "'";
                            }
                            if (in_text != "")
                            {
                                search_text = " AND ITEMS.LOGICALREF IN(" + in_text + ")";
                                orderbytext = "  ORDER BY " + in_order + " END ";
                            }
                            else
                            {
                                search_text = " AND ITEMS.LOGICALREF IN(-1)";
                                orderbytext = "";
                            }

                            getData();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.set("HATA: PriceForm>BarcodeReturn\nEXCEPTION:" + ex.ToString());
                MessageBox.Show("Hata oluştu. Programı yeniden başlatin.\n\n", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }