Beispiel #1
0
        private void save_new_client_product_btn_Click(object sender, EventArgs e)
        {
            bool saveornot = true;

            if (string.IsNullOrEmpty(product_name_text_box.Text))
            {
                MessageBox.Show(" الرجاء ادخال إسم الصنف ", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                saveornot = false;
            }
            else
            {
                if (string.IsNullOrEmpty(faces_combo_box.Text))
                {
                    MessageBox.Show("الرجاء إختيار الوجة الثانى ", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                    saveornot = false;
                }
                else if (!(body_radio_btn.Checked || bottom_radio_btn.Checked || head_radio_btn.Checked || twist_of_radio_btn.Checked || easy_open_rado_btn.Checked))
                {
                    MessageBox.Show("الرجاء إختيار نوع الطباعة ", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                    saveornot = false;
                }
                else
                {
                    if (string.IsNullOrEmpty(height_text_box.Text))
                    {
                        if (body_radio_btn.Checked)
                        {
                            MessageBox.Show("الرجاء إدخال إرتقاع العلبة", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                            saveornot = false;
                        }
                        else
                        {
                            height_text_box.Text = 0.ToString();
                        }
                    }
                    //else if (string.IsNullOrEmpty(capacity_tect_box.Text))
                    //{
                    //    MessageBox.Show("الرجاء إدخال السعة بالجرامات", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                    //    saveornot = false;
                    //}
                    else if (string.IsNullOrEmpty(sizes_combo_box.Text))
                    {
                        MessageBox.Show("الرجاء إختيار المقاس", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);

                        saveornot = false;
                    }
                    else
                    {
                        if (saveornot)
                        {
                            if (check_if_product_exists_or_not() == 1)
                            {
                                MessageBox.Show("هذا الصنف موجود", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                            }
                            else
                            {
                                try
                                {
                                    string query = "INSERT INTO SH_CLIENTS_PRODUCTS ";
                                    query += "(SH_CLIENT_NAME, SH_CLIENT_ID, SH_PRODUCT_NAME, ";
                                    query += " SH_PRINTING_TYPE, SH_BOTTLE_CAPACITY, SH_BOTTLE_HEIGHT , ";
                                    query += " SH_SECOND_FACE_ID , SH_SECOND_FACE_NAME , SH_SIZE_ID ,";
                                    query += " SH_SIZE_NAME , SH_TWIST_SIZE_ID,SH_TWIST_SIZE_NAME, ";
                                    query += "SH_TWIST_TYPE,SH_TWIST_TYPE_ID,SH_TWIST_TYPE_KIND ";
                                    query += " , SH_DATA_ENTRY_USER_ID,SH_DATA_ENTRY_EMPLOYEE_ID,SH_ADDITION_DATE";
                                    query += ")";
                                    query += " VALUES(@SH_CLIENT_NAME,@SH_CLIENT_ID,@SH_PRODUCT_NAME,";
                                    query += " @SH_PRINTING_TYPE,@SH_BOTTLE_CAPACITY,@SH_BOTTLE_HEIGHT, ";
                                    query += " @SH_SECOND_FACE_ID , @SH_SECOND_FACE_NAME , @SH_SIZE_ID , ";
                                    query += " @SH_SIZE_NAME, @SH_TWIST_SIZE_ID,@SH_TWIST_SIZE_NAME ";
                                    query += ",@SH_TWIST_TYPE,@SH_TWIST_TYPE_ID,@SH_TWIST_TYPE_KIND ";
                                    query += " , @SH_DATA_ENTRY_USER_ID,@SH_DATA_ENTRY_EMPLOYEE_ID,@SH_ADDITION_DATE";
                                    query += " )";
                                    DatabaseConnection myconnection = new DatabaseConnection();
                                    myconnection.openConnection();
                                    SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                                    cmd.Parameters.AddWithValue("@SH_CLIENT_NAME", mclient.SH_CLIENT_COMPANY_NAME);
                                    cmd.Parameters.AddWithValue("@SH_CLIENT_ID", mclient.SH_ID);
                                    cmd.Parameters.AddWithValue("@SH_PRODUCT_NAME", product_name_text_box.Text);
                                    cmd.Parameters.AddWithValue("@SH_PRINTING_TYPE", getprintingtype());
                                    cmd.Parameters.AddWithValue("@SH_SECOND_FACE_NAME", faces_combo_box.Text);
                                    cmd.Parameters.AddWithValue("@SH_SECOND_FACE_ID", FACES[faces_combo_box.SelectedIndex].SH_ID);
                                    if (twist_of_radio_btn.Checked)
                                    {
                                        cmd.Parameters.AddWithValue("@SH_BOTTLE_CAPACITY", 0);
                                        cmd.Parameters.AddWithValue("@SH_BOTTLE_HEIGHT", 0);
                                        cmd.Parameters.AddWithValue("@SH_SIZE_ID", 0);
                                        cmd.Parameters.AddWithValue("@SH_SIZE_NAME", 0);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_SIZE_ID", twist_of_sizes[sizes_combo_box.SelectedIndex].SH_ID);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_SIZE_NAME", twist_of_sizes[sizes_combo_box.SelectedIndex].SH_TWIST_OF_SIZE_VALUE);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_TYPE", twist_of_types[capacity_tect_box.SelectedIndex].SH_SHORT_TITLE);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_TYPE_ID", twist_of_types[capacity_tect_box.SelectedIndex].SH_ID);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_TYPE_KIND", item_types[height_text_box.SelectedIndex]);
                                    }
                                    else
                                    {
                                        cmd.Parameters.AddWithValue("@SH_BOTTLE_CAPACITY", 0);
                                        cmd.Parameters.AddWithValue("@SH_BOTTLE_HEIGHT", double.Parse(height_text_box.Text));
                                        cmd.Parameters.AddWithValue("@SH_SIZE_ID", mSizes[sizes_combo_box.SelectedIndex].SH_ID);
                                        cmd.Parameters.AddWithValue("@SH_SIZE_NAME", mSizes[sizes_combo_box.SelectedIndex].SH_SIZE_NAME);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_SIZE_ID", 0);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_SIZE_NAME", 0);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_TYPE", 0);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_TYPE_ID", 0);
                                        cmd.Parameters.AddWithValue("@SH_TWIST_TYPE_KIND", 0);
                                    }
                                    cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_USER_ID", mAccount.SH_ID);
                                    cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_EMPLOYEE_ID", mAccount.SH_EMP_ID);
                                    cmd.Parameters.AddWithValue("@SH_ADDITION_DATE", DateTime.Now);
                                    cmd.ExecuteNonQuery();
                                    myconnection.closeConnection();
                                    mproduct.Clear();
                                    getallclientproducts();
                                    productsgridview();

                                    MessageBox.Show("تم الحفظ بنجاح", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("ERROR WHILE SAVING PRODUCT FOR A CLIENT " + ex.ToString());
                                }
                            }
                        }
                    }
                }
            }
        }
        private async void save_company_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(client_company_fax_number_text_box.Text) || string.IsNullOrEmpty(company_telephone_text_box.Text) || string.IsNullOrEmpty(company_telephone_text_box.Text))
            {
                MessageBox.Show("إملاء البيانات من فضلك", "تحذير", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
            }
            else
            {
                if ((errorProvider1.GetError(company_telephone_text_box) == "") && (errorProvider1.GetError(company_telephone_text_box) == ""))
                {
                    if (mclient == null)
                    {
                        //new client

                        if (await check_if_name_exits_or_not())
                        {
                            MessageBox.Show("هذا العميل تم إضافته مسبقا", "تحذير", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                        }
                        else
                        {
                            string company_type_text_box = "";
                            if (national_client_radio_btn.Checked)
                            {
                                company_type_text_box = "محلى";
                            }
                            else
                            {
                                company_type_text_box = "دولى";
                            }
                            string query = "INSERT INTO SH_CLIENT_COMPANY";
                            query += " (SH_CLIENT_COMPANY_NAME, SH_CLIENT_COMPANY_TYPE,";
                            query += " SH_CLIENT_COMPANY_TELEPHONE, ";
                            query += "  SH_CLIENT_COMPANY_FAX_NUMBER,SH_CLIENT_COMPANY_MOBILE ";
                            query += ", SH_DATA_ENTRY_USER_ID,SH_DATA_ENTRY_EMPLOYEE_ID,SH_ADDITION_DATE ";
                            query += " ) VALUES ";
                            query += "    (@SH_CLIENT_COMPANY_NAME,@SH_CLIENT_COMPANY_TYPE,@SH_CLIENT_COMPANY_TELEPHONE ,  ";
                            query += "    @SH_CLIENT_COMPANY_FAX_NUMBER,@SH_CLIENT_COMPANY_MOBILE ";
                            query += " , @SH_DATA_ENTRY_USER_ID,@SH_DATA_ENTRY_EMPLOYEE_ID,@SH_ADDITION_DATE ";
                            query += " ) ";
                            try
                            {
                                DatabaseConnection myconnection = new DatabaseConnection();
                                myconnection.openConnection();
                                SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                                cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_NAME", company_name_text_box.Text);
                                cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_TYPE", company_type_text_box);
                                cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_TELEPHONE", company_telephone_text_box.Text);

                                cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_FAX_NUMBER", client_company_fax_number_text_box.Text);
                                cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_MOBILE", textBoxMobile.Text);
                                cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_USER_ID", mAccount.SH_ID);
                                cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_EMPLOYEE_ID", mAccount.SH_EMP_ID);
                                cmd.Parameters.AddWithValue("@SH_ADDITION_DATE", DateTime.Now);
                                cmd.ExecuteNonQuery();
                                myconnection.closeConnection();
                                MessageBox.Show("تم الحفظ بنجاح", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);

                                company_name_text_box.Text              = "";
                                company_telephone_text_box.Text         = "";
                                client_company_fax_number_text_box.Text = "";
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("ERROR WHILE SAVING CLIENT COMPANY" + ex.ToString());
                            }
                        }
                    }
                    else //edite client data
                    {
                        if (await check_if_name_exits_or_not())
                        {
                            MessageBox.Show("هذا العميل تم إضافته مسبقا", "تحذير", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                        }
                        else
                        {
                            string company_type_text_box = "";
                            if (national_client_radio_btn.Checked)
                            {
                                company_type_text_box = "محلى";
                            }
                            else
                            {
                                company_type_text_box = "دولى";
                            }

                            string query = " UPDATE SH_CLIENT_COMPANY SET SH_CLIENT_COMPANY_NAME = @SH_CLIENT_COMPANY_NAME, ";
                            query += "SH_CLIENT_COMPANY_TYPE = @SH_CLIENT_COMPANY_TYPE, SH_CLIENT_COMPANY_TELEPHONE = @SH_CLIENT_COMPANY_TELEPHONE, ";
                            query += " SH_DATA_ENTRY_USER_ID = @SH_DATA_ENTRY_USER_ID, ";
                            query += " SH_DATA_ENTRY_EMPLOYEE_ID = @SH_DATA_ENTRY_EMPLOYEE_ID ,";
                            query += " SH_ADDITION_DATE = @SH_ADDITION_DATE , ";
                            query += "   SH_CLIENT_COMPANY_MOBILE = @SH_CLIENT_COMPANY_MOBILE, ";
                            query += "  SH_CLIENT_COMPANY_FAX_NUMBER =  @SH_CLIENT_COMPANY_FAX_NUMBER WHERE  SH_ID = @SH_ID ";

                            DatabaseConnection myconnection = new DatabaseConnection();
                            myconnection.openConnection();
                            SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                            cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_NAME", company_name_text_box.Text);
                            cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_TYPE", company_type_text_box);
                            cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_TELEPHONE", company_telephone_text_box.Text);

                            cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_FAX_NUMBER", client_company_fax_number_text_box.Text);
                            cmd.Parameters.AddWithValue("@SH_ID", mclient.SH_ID);
                            cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_USER_ID", mAccount.SH_ID);
                            cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_EMPLOYEE_ID", mAccount.SH_EMP_ID);
                            cmd.Parameters.AddWithValue("@SH_ADDITION_DATE", DateTime.Now);
                            cmd.ExecuteNonQuery();
                            myconnection.closeConnection();
                            MessageBox.Show("تم التعديل بنجاح", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);

                            company_name_text_box.Text              = "";
                            company_telephone_text_box.Text         = "";
                            client_company_fax_number_text_box.Text = "";
                        }
                    }
                }
                else
                {
                    MessageBox.Show("لا يمكن حفظ البيانات  \n  الرجاء التاكد من كتابة البيانات بشكل صحيح ", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                }
            }
        }
Beispiel #3
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);
     }
 }
Beispiel #4
0
        private void printeasyopentotalbalanceform_Load(object sender, EventArgs e)
        {
            long total_no_items      = 0;
            long total_no_containers = 0;
            long total_no_pallets    = 0;
            long total_no_cartons    = 0;

            DataTable mydatatabel = new DataTable();

            mydatatabel.Columns.Add("m");
            mydatatabel.Columns.Add("item_material_type");
            mydatatabel.Columns.Add("printing_type");
            mydatatabel.Columns.Add("size_name");
            mydatatabel.Columns.Add("client_name");
            mydatatabel.Columns.Add("first_face");
            mydatatabel.Columns.Add("second_face");
            mydatatabel.Columns.Add("container_name");
            mydatatabel.Columns.Add("no_items_per_container");
            mydatatabel.Columns.Add("total_no_items");
            mydatatabel.Columns.Add("usage");
            mydatatabel.Columns.Add("addition_date");

            try
            {
                myconnection.openConnection();
                SqlCommand cmd = new SqlCommand("SH_GET_ALL_SPECIFICATION_OF_EASY_OPEN", DatabaseConnection.mConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader reader  = cmd.ExecuteReader();
                long          counter = 0;
                while (reader.Read())
                {
                    counter++;
                    string[] mydata = new string[12];
                    mydata[0] = counter.ToString();
                    mydata[1] = reader["SH_RAW_MATERIAL_TYPE"].ToString();
                    mydata[2] = reader["SH_PRINTING_TYPE_NAME"].ToString();
                    if (long.Parse(reader["SH_PRINTING_TYPE"].ToString()) == 0)
                    {
                        mydata[3] = reader["SIZE_NAME"].ToString();
                        mydata[4] = reader["CLIENT_NAME"].ToString();
                        mydata[5] = reader["CLIENT_PRODUCT_NAME"].ToString();
                        mydata[6] = reader["PRODUCT_SECOND_FACE"].ToString();
                    }
                    else
                    {
                        mydata[3] = reader["SIZE_NAME"].ToString();
                        mydata[4] = "عام";
                        mydata[5] = reader["FIRST_FACE"].ToString();
                        mydata[6] = reader["SECOND_FACE"].ToString();
                    }

                    mydata[7] = reader["SH_CONTAINER_NAME"].ToString();
                    if (string.Compare(reader["SH_CONTAINER_NAME"].ToString(), "بالتة") == 0)
                    {
                        total_no_pallets += long.Parse(reader["NUMBER_OF_CONTAINERS"].ToString());
                    }
                    else
                    {
                        total_no_cartons += long.Parse(reader["NUMBER_OF_CONTAINERS"].ToString());
                    }
                    total_no_containers += long.Parse(reader["NUMBER_OF_CONTAINERS"].ToString());
                    mydata[8]            = (long.Parse(reader["NO_ITEMS"].ToString()) / long.Parse(reader["NUMBER_OF_CONTAINERS"].ToString())).ToString();
                    total_no_items      += long.Parse(reader["NO_ITEMS"].ToString());
                    mydata[9]            = reader["NO_ITEMS"].ToString();
                    mydata[10]           = reader["SH_USAGE"].ToString();
                    mydata[11]           = reader["SH_ADDITION_DATE"].ToString();
                    mydatatabel.Rows.Add(mydata);
                }
                reader.Close();
                myconnection.closeConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR WHILE GETTING BOTTOM INFO " + ex.ToString());
            }

            ReportParameter[] myparams = new ReportParameter[6];
            myparams[0] = new ReportParameter("total_no_items", total_no_items.ToString(), false);
            myparams[1] = new ReportParameter("total_no_containers", total_no_containers.ToString(), false);
            myparams[2] = new ReportParameter("total_no_pallets", total_no_pallets.ToString(), false);
            myparams[3] = new ReportParameter("total_no_cartons", total_no_cartons.ToString(), false);
            myparams[4] = new ReportParameter("report_presenter_name", mEmployee.SH_EMPLOYEE_NAME, false);
            myparams[5] = new ReportParameter("doc_title_text", "الأرصدة من المنتج التام ( إيزى أوبن  )", false);

            this.reportViewer1.LocalReport.SetParameters(myparams);
            ReportDataSource rds = new ReportDataSource("DataSet1", mydatatabel);

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(rds);

            this.reportViewer1.RefreshReport();
        }
Beispiel #5
0
        async Task autogenerateadditionpermisionnumber()
        {
            long mycount = 0;

            try
            {
                myconnection.openConnection();
                SqlCommand    cmd    = new SqlCommand("SELECT (MAX(SH_ID)+1) AS lastedid FROM SH_ADDITION_PERMISSION_NUMBER_OF_PLASTIC_MOLD  ", DatabaseConnection.mConnection);
                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.Read())
                {
                    if (string.IsNullOrWhiteSpace(reader["lastedid"].ToString()))
                    {
                        reader.Close();
                    }
                    else
                    {
                        mycount = long.Parse(reader["lastedid"].ToString());
                    }
                }

                reader.Close();
                myconnection.closeConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while getting new permission number " + ex.ToString());
            }


            if (mycount == 0)
            {
                //there is the first rows in the db
                string permissionnumber = "SH_";
                permissionnumber += "PLASTIC_MOLD-";
                permissionnumber += DateTime.Now.ToString("yy");
                string currentr = 1.ToString();
                for (int i = 0; i < 5 - 1; i++)
                {
                    permissionnumber += "0";
                }
                permissionnumber += 1.ToString();
                addition_permission_number_text_box.Text = permissionnumber;
            }
            else
            {
                string permissionnumber = "SH_";
                permissionnumber += "PLASTIC_MOLD-";
                permissionnumber += DateTime.Now.ToString("yy");
                string currentr = mycount.ToString();
                for (int i = 0; i < 5 - currentr.Length; i++)
                {
                    permissionnumber += "0";
                }
                permissionnumber += mycount.ToString();
                addition_permission_number_text_box.Text = permissionnumber;
            }
        }
Beispiel #6
0
        async Task getstocksmantoexamination()
        {
            stock_men.Clear();
            try
            {
                string query = "SELECT EMP.* FROM SH_EMPLOYEES EMP ";
                query += " LEFT JOIN SH_DEPARTEMENTS DPT ON ";
                query += " DPT.SH_ID = EMP.SH_DEPARTMENT_ID ";
                query += " WHERE DPT.SH_DEPARTEMNT_NAME LIKE N'%مخازن%' ";
                myconnection.openConnection();
                SqlCommand    cmd    = new SqlCommand(query, DatabaseConnection.mConnection);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    stock_men.Add(new SH_EMPLOYEES()
                    {
                        SH_DATA_ENTRY_EMPLOYEE_ID   = long.Parse(reader["SH_DATA_ENTRY_EMPLOYEE_ID"].ToString()),
                        SH_DATA_ENTRY_EMPLOYEE_NAME = reader["SH_DATA_ENTRY_EMPLOYEE_NAME"].ToString(),
                        SH_DATA_ENTRY_USER_ID       = long.Parse(reader["SH_DATA_ENTRY_USER_ID"].ToString()),
                        SH_DATA_ENTRY_USER_NAME     = reader["SH_DATA_ENTRY_USER_NAME"].ToString(),
                        SH_DEPARTMENT_ID            = long.Parse(reader["SH_DEPARTMENT_ID"].ToString()),
                        SH_DEPARTMENT_NAME          = reader["SH_DEPARTMENT_NAME"].ToString(),
                        SH_EMPLOYEE_ADDRESS         = reader["SH_EMPLOYEE_ADDRESS"].ToString(),
                        SH_EMPLOYEE_EMAIL           = reader["SH_EMPLOYEE_EMAIL"].ToString(),
                        SH_EMPLOYEE_FUNCTION_ID     = long.Parse(reader["SH_EMPLOYEE_FUNCTION_ID"].ToString()),
                        SH_EMPLOYEE_FUNCTION_NAME   = reader["SH_EMPLOYEE_FUNCTION_NAME"].ToString(),
                        SH_EMPLOYEE_GENDER          = reader["SH_EMPLOYEE_GENDER"].ToString(),
                        SH_EMPLOYEE_MOBILE          = reader["SH_EMPLOYEE_MOBILE"].ToString(),
                        SH_EMPLOYEE_NAME            = reader["SH_EMPLOYEE_NAME"].ToString(),
                        SH_EMPLOYEE_NATIONAL_ID     = reader["SH_EMPLOYEE_NATIONAL_ID"].ToString(),
                        SH_ID = long.Parse(reader["SH_ID"].ToString()),
                        SH_EMPLOYEMENT_DATE = DateTime.Parse(reader["SH_EMPLOYEMENT_DATE"].ToString())
                    });
                }
                reader.Close();
                myconnection.closeConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR WHILE GETTING STOCK_MEN " + ex.ToString());
            }

            if (stock_men.Count > 0)
            {
                monitors_one.Items.Clear();
                monitors_two.Items.Clear();
                monitor_one_combo_box.Items.Clear();
                monitor_two_combo_box.Items.Clear();
                for (int i = 0; i < stock_men.Count; i++)
                {
                    monitors_one.Items.Add(stock_men[i].SH_EMPLOYEE_NAME);
                    monitors_two.Items.Add(stock_men[i].SH_EMPLOYEE_NAME);
                    monitor_one_combo_box.Items.Add(stock_men[i].SH_EMPLOYEE_NAME);
                    monitor_two_combo_box.Items.Add(stock_men[i].SH_EMPLOYEE_NAME);
                }
            }
        }
Beispiel #7
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;
            }
        }
Beispiel #8
0
        private void search_btn_Click(object sender, EventArgs e)
        {
            parcels.Clear();
            bool length      = false;
            bool width       = false;
            bool thickness   = false;
            bool code        = false;
            bool temper      = false;
            bool coating     = false;
            bool finish      = false;
            bool no_sheets   = false;
            bool type        = false;
            bool first_face  = false;
            bool second_face = false;
            bool _size       = false;
            bool muran_type  = false;

            string mlength      = " ";
            string mwidth       = " ";
            string mthickness   = " ";
            string mcode        = " ";
            string mtemper      = " ";
            string mcoating     = " ";
            string mfinish      = " ";
            string mtype        = " ";
            string mno_sheets   = " ";
            string mfirst_face  = " ";
            string msecond_face = " ";
            string msize        = " ";
            string mmuran_type  = " ";

            double testnumber = 0;
            long   testnum    = 0;

            if (string.IsNullOrEmpty(first_face_combo_box.Text))
            {
                first_face = false;
            }
            else
            {
                first_face  = true;
                mfirst_face = " AND (smmp.SH_ITEM_FIRST_FACE LIKE N'%@SH_ITEM_FIRST_FACE' OR smmp.SH_ITEM_FIRST_FACE LIKE N'%@SH_ITEM_FIRST_FACE%' OR smmp.SH_ITEM_FIRST_FACE LIKE N'@SH_ITEM_FIRST_FACE%' ) ";
            }

            if (string.IsNullOrEmpty(second_face_combo_box.Text))
            {
                second_face = false;
            }
            else
            {
                second_face  = false;
                msecond_face = " AND ( smmp.SH_ITEM_SECOND_FACE LIKE  N'%@SH_ITEM_SECOND_FACE' OR smmp.SH_ITEM_SECOND_FACE LIKE  N'%@SH_ITEM_SECOND_FACE%' OR smmp.SH_ITEM_SECOND_FACE LIKE  N'@SH_ITEM_SECOND_FACE%' )";
            }

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

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

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

            if (string.IsNullOrEmpty(item_finish_text_box.Text))
            {
                finish = false;
            }
            else
            {
                finish  = true;
                mfinish = " AND smmp.SH_ITEM_FINISH LIKE N'%@SH_ITEM_FINISH' OR smmp.SH_ITEM_FINISH LIKE N'%@SH_ITEM_FINISH%' OR smmp.SH_ITEM_FINISH LIKE N'@SH_ITEM_FINISH%' ";
            }

            if (string.IsNullOrEmpty(item_coating_text_box.Text))
            {
                coating = false;
            }
            else
            {
                coating  = true;
                mcoating = " AND smmp.SH_ITEM_COATING LIKE N'%@SH_ITEM_COATING' OR smmp.SH_ITEM_COATING LIKE N'%@SH_ITEM_COATING%' OR smmp.SH_ITEM_COATING LIKE N'@SH_ITEM_COATING%'  ";
            }

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

            if (string.IsNullOrEmpty(item_no_sheets_text_box.Text))
            {
                no_sheets = false;
            }
            else
            {
                if (long.TryParse(item_no_sheets_text_box.Text, out testnum))
                {
                    no_sheets  = true;
                    mno_sheets = "AND smmp.SH_ITEM_NUMBER_OF_SHEETS = @SH_ITEM_NUMBER_OF_SHEETS ";
                }
                else
                {
                    no_sheets = false;
                }
            }

            if (body_radio_btn.Checked)
            {
                muran_type  = true;
                mmuran_type = " AND smmp.SH_MURAN_TYPE LIKE N'%@SH_MURAN_TYPE'  OR smmp.SH_MURAN_TYPE LIKE N'%@SH_MURAN_TYPE%' OR smmp.SH_MURAN_TYPE LIKE N'@SH_MURAN_TYPE%'";
            }
            else if (bottom_radio_btn.Checked)
            {
                muran_type  = true;
                mmuran_type = " AND smmp.SH_MURAN_TYPE LIKE N'%@SH_MURAN_TYPE' OR smmp.SH_MURAN_TYPE LIKE N'%@SH_MURAN_TYPE%' OR smmp.SH_MURAN_TYPE LIKE N'@SH_MURAN_TYPE%'";
            }
            else
            {
                muran_type = false;
            }

            if (string.IsNullOrEmpty(sizes_combo_box.Text))
            {
                _size = false;
            }
            else
            {
                _size = true;
                msize = "AND smmp.SH_SIZE_NAME LIKE N'%@SH_SIZE_NAME' OR smmp.SH_SIZE_NAME LIKE N'%@SH_SIZE_NAME%' OR smmp.SH_SIZE_NAME LIKE N'@SH_SIZE_NAME%'  ";
            }
            if (string.IsNullOrEmpty(item_type_text_box.Text))
            {
                type = false;
            }
            else
            {
                type  = true;
                mtype = "AND smmp.SH_ITEM_TYPE LIKE N'%@SH_ITEM_TYPE' OR smmp.SH_ITEM_TYPE LIKE N'%@SH_ITEM_TYPE%' OR smmp.SH_ITEM_TYPE LIKE N'@SH_ITEM_TYPE%' ";
            }
            try
            {
                string query = "SELECT smmp.* FROM SH_MURAN_MATERIAL_PARCEL smmp WHERE ( 1 = 1) " + mlength + mwidth + mthickness + mcoating + mcode + mtemper + msize + mtype + msecond_face + mfinish + mfirst_face + mmuran_type + mno_sheets + " AND NOT EXiSTS (SELECT * FROM SH_EXCHAGED_MURAN_PARCELS semp WHERE semp.SH_MURAN_PARCEL_ID = smmp.SH_ID)";
                // string query = "SELECT * FROM SH_MURAN_MATERIAL_PARCEL ";

                DatabaseConnection myconnection = new DatabaseConnection();
                myconnection.openConnection();
                //    MessageBox.Show(query);
                SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                if (length)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_LENGTH", double.Parse(item_length_text_box.Text));
                    MessageBox.Show("test1");
                }
                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_text_box.Text);
                }
                if (coating)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_COATING", item_coating_text_box.Text);
                }
                if (finish)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_FINISH", item_finish_text_box.Text);
                }
                if (_size)
                {
                    cmd.Parameters.AddWithValue("@SH_SIZE_NAME", sizes_combo_box.Text);
                }
                if (type)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_TYPE", item_type_text_box.Text);
                }
                if (first_face)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_FIRST_FACE", faces[first_face_combo_box.SelectedIndex].SH_FACE_COLOR_NAME);
                }
                if (second_face)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_SECOND_FACE", second_face_combo_box.Text);
                }
                if (muran_type)
                {
                    cmd.Parameters.AddWithValue("@SH_MURAN_TYPE", getmurantype());
                }
                if (no_sheets)
                {
                    cmd.Parameters.AddWithValue("@SH_ITEM_NUMBER_OF_SHEETS", long.Parse(item_no_sheets_text_box.Text));
                }

                SqlDataReader rd = cmd.ExecuteReader();

                while (rd.Read())
                {
                    parcels.Add(new SH_MURAN_MATERIAL_PARCEL()
                    {
                        SH_BOTTLE_CAPACITY = rd["SH_BOTTLE_CAPACITY"].ToString(), SH_ITEM_CODE = rd["SH_ITEM_CODE"].ToString(), SH_BOTTLE_HEIGHT = double.Parse(rd["SH_BOTTLE_HEIGHT"].ToString()), SH_CLIENT_NAME = rd["SH_CLIENT_NAME"].ToString(), SH_ID = long.Parse(rd["SH_ID"].ToString()), SH_ITEM_LENGTH = double.Parse(rd["SH_ITEM_LENGTH"].ToString()), SH_ITEM_NUMBER_OF_SHEETS = long.Parse(rd["SH_ITEM_NUMBER_OF_SHEETS"].ToString()), SH_ITEM_FIRST_FACE = rd["SH_ITEM_FIRST_FACE"].ToString(), SH_ITEM_THICKNESS = double.Parse(rd["SH_ITEM_THICKNESS"].ToString()), SH_ITEM_SECOND_FACE = rd["SH_ITEM_SECOND_FACE"].ToString(), SH_SIZE_ID = long.Parse(rd["SH_SIZE_ID"].ToString()), SH_SIZE_NAME = rd["SH_SIZE_NAME"].ToString(), SH_MURAN_TYPE = rd["SH_MURAN_TYPE"].ToString(), SH_ITEM_PARCEL_GROSS_WEIGHT = double.Parse(rd["SH_ITEM_PACKAGE_GROSS_WEIGHT"].ToString())
                    });
                }
                myconnection.closeConnection();
                fillmuranparcelsgridview();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR WHILE GETTING MURAN PARCELS : " + ex.ToString());
            }
        }
        public void getUserPermission()
        {
            try
            {
                DatabaseConnection myconnection = new DatabaseConnection();
                myconnection.openConnection();
                SqlCommand cmd = new SqlCommand("getpermissionOneEmp", DatabaseConnection.mConnection);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@empid", mAccount.SH_ID);
                SqlDataReader red = cmd.ExecuteReader();
                if (red.Read())
                {
                    mPermission.SH_ID                             = long.Parse(red["SH_ID"].ToString());
                    mPermission.SH_ADD_NEW_COLOR                  = long.Parse(red["SH_ADD_NEW_COLOR"].ToString());
                    mPermission.SH_OPEN_CHANGE_PASSWORD           = long.Parse(red["SH_OPEN_CHANGE_PASSWORD"].ToString());
                    mPermission.SH_OPEN_GETALL_EMP                = long.Parse(red["SH_OPEN_REGIST_EMP"].ToString());
                    mPermission.SH_OPEN_MAKE_NEW_USER             = long.Parse(red["SH_OPEN_MAKE_NEW_USER"].ToString());
                    mPermission.SH_OPEN_DISPLAY_ALLUSERS          = long.Parse(red["SH_OPEN_DISPLAY_ALLUSERS"].ToString());
                    mPermission.SH_OPEN_SELECT_USER_PERMISION     = long.Parse(red["SH_OPEN_SELECT_USER_PERMISION"].ToString());
                    mPermission.SH_RAW_TIN_MATERIAL               = long.Parse(red["SH_RAW_TIN_MATERIAL"].ToString());
                    mPermission.SH_ACCOUNT_ID                     = long.Parse(red["SH_ACCOUNT_ID"].ToString());
                    mPermission.SH_ACCOUNT_NAME                   = red["SH_ACCOUNT_NAME"].ToString();
                    mPermission.SH_SHOW_ALL_CLIENTS               = long.Parse(red["SH_SHOW_ALL_CLIENTS"].ToString());
                    mPermission.SH_OPEN_DASH_BOARD                = long.Parse(red["SH_OPEN_DASH_BOARD"].ToString());
                    mPermission.SH_OPEN_REGIST_EMP                = long.Parse(red["SH_OPEN_REGIST_EMP"].ToString());
                    mPermission.SH_ADD_NEW_CLIENT_COMPANY         = long.Parse(red["SH_ADD_NEW_CLIENT_COMPANY"].ToString());
                    mPermission.SH_ADD_NEW_CLIENT_BRANCH          = long.Parse(red["SH_ADD_NEW_CLIENT_BRANCH"].ToString());
                    mPermission.SH_ADD_NEW_SUPPLIER               = long.Parse(red["SH_ADD_NEW_SUPPLIER"].ToString());
                    mPermission.SH_ADD_NEW_SUPPLIER_BRANCH        = long.Parse(red["SH_ADD_NEW_SUPPLIER_BRANCH"].ToString());
                    mPermission.SH_SHOW_ALL_SUPPLIERS             = long.Parse(red["SH_SHOW_ALL_SUPPLIERS"].ToString());
                    mPermission.SH_MAIN_TIN_STOCK                 = long.Parse(red["SH_MAIN_TIN_STOCK"].ToString());
                    mPermission.SH_ADD_NEW_RAW_TIN_FIRST_DURATION = long.Parse(red["SH_ADD_NEW_RAW_TIN_FIRST_DURATION"].ToString());
                    mPermission.SH_ADD_NEW_RAW_TIN                = long.Parse(red["SH_ADD_NEW_RAW_TIN"].ToString());
                    mPermission.SH_EXCHANGE_RAW_TIN_PARCEL_NO     = long.Parse(red["SH_EXCHANGE_RAW_TIN_PARCEL_NO"].ToString());
                    mPermission.SH_EXCHANGE_RAW_TIN_PROPERTIES    = long.Parse(red["SH_EXCHANGE_RAW_TIN_PROPERTIES"].ToString());
                    mPermission.SH_EXCHANGE_MURAN_TIN             = long.Parse(red["SH_EXCHANGE_MURAN_TIN"].ToString());
                    mPermission.SH_ADD_NEW_MURAN_TIN              = long.Parse(red["SH_ADD_NEW_MURAN_TIN"].ToString());
                    mPermission.SH_ADD_NEW_PRINTED_TIN            = long.Parse(red["SH_ADD_NEW_PRINTED_TIN"].ToString());
                    mPermission.SH_EXCHANGE_PRINTED_TIN           = long.Parse(red["SH_EXCHANGE_PRINTED_TIN"].ToString());
                    mPermission.SH_ADD_NEW_SIZE                   = long.Parse(red["SH_ADD_NEW_SIZE"].ToString());
                    mPermission.SH_ADD_NEW_CUT_RAW_TIN            = long.Parse(red["SH_ADD_NEW_CUT_RAW_TIN"].ToString());
                    mPermission.SH_EXCHANGE_CUT_RAW_TIN           = long.Parse(red["SH_EXCHANGE_CUT_RAW_TIN"].ToString());
                    mPermission.SH_ADD_NEW_CUT_MURAN_TIN          = long.Parse(red["SH_ADD_NEW_CUT_MURAN_TIN"].ToString());
                    mPermission.SH_EXCHANGE_CUT_MURAN_TIN         = long.Parse(red["SH_EXCHANGE_CUT_MURAN_TIN"].ToString());
                    mPermission.SH_ADD_NEW_CUTTERS                = long.Parse(red["SH_ADD_NEW_CUTTERS"].ToString());
                    mPermission.SH_SHOW_ALL_CUTTERS               = long.Parse(red["SH_SHOW_ALL_CUTTERS"].ToString());
                    mPermission.SH_DEPARTMENT_PRODUCTION          = long.Parse(red["SH_DEPARTMENT_PRODUCTION"].ToString());
                    mPermission.SH_ADD_NEW_STOCK_PLACE            = long.Parse(red["SH_ADD_NEW_STOCK_PLACE"].ToString());
                    mPermission.SH_SHOW_ALL_STOCKS                = long.Parse(red["SH_SHOW_ALL_STOCKS"].ToString());
                    mPermission.SH_DEPARTMENT_STOCKS              = long.Parse(red["SH_DEPARTMENT_STOCKS"].ToString());
                    mPermission.SH_DEPARTMENT_SALES               = long.Parse(red["SH_DEPARTMENT_SALES"].ToString());
                    mPermission.SH_DEPARTMENT_HR                  = long.Parse(red["SH_DEPARTMENT_HR"].ToString());
                    mPermission.SH_DEPARTMENT_PURCHASING          = long.Parse(red["SH_DEPARTMENT_PURCHASING"].ToString());
                    mPermission.SH_DEPARTMENT_SECRETARY           = long.Parse(red["SH_DEPARTMENT_SECRETARY"].ToString());
                    mPermission.SH_DEPARTMENT_ACCOUNTING          = long.Parse(red["SH_DEPARTMENT_ACCOUNTING"].ToString());
                    mPermission.SH_DEPARTMENT_IT                  = long.Parse(red["SH_DEPARTMENT_IT"].ToString());
                    mPermission.SH_IT_SERVER_SETTINGS             = long.Parse(red["SH_IT_SERVER_SETTINGS"].ToString());
                    mPermission.SH_EXCHANGE_CHANGE_BITS           = long.Parse(red["SH_EXCHANGE_CHANGE_BITS"].ToString());
                    mPermission.SH_ADD_NEW_DEPARTMENT             = long.Parse(red["SH_ADD_NEW_DEPARTMENT"].ToString());
                    mPermission.SH_ADD_NEW_JOB                    = long.Parse(red["SH_ADD_NEW_JOB"].ToString());
                    mPermission.SH_ADD_NEW_PRODUCT_CLIENT         = long.Parse(red["SH_ADD_NEW_PRODUCT_CLIENT"].ToString());
                    mPermission.SH_ADD_PRODUCTION_REQUIRMENT      = long.Parse(red["SH_ADD_PRODUCTION_REQUIRMENT"].ToString());
                    mPermission.SH_EXCHANGE_PRODUCTION_REQUIRMENT = long.Parse(red["SH_EXCHANGE_PRODUCTION_REQUIRMENT"].ToString());
                    mPermission.SH_ADD_CHANGE_BITS                = long.Parse(red["SH_ADD_CHANGE_BITS"].ToString());
                    mPermission.SH_ADD_EASY_OPEN                  = long.Parse(red["SH_ADD_EASY_OPEN"].ToString());
                    mPermission.SH_EXCHANGE_EASY_OPEN             = long.Parse(red["SH_EXCHANGE_EASY_OPEN"].ToString());
                    mPermission.SH_ADD_TIN_CANS                   = long.Parse(red["SH_ADD_TIN_CANS"].ToString());
                    mPermission.SH_EXCHANGE_TIN_CANS              = long.Parse(red["SH_EXCHANGE_TIN_CANS"].ToString());
                    mPermission.SH_ADD_NEW_RLT                    = long.Parse(red["SH_ADD_NEW_RLT"].ToString());
                    mPermission.SH_EXCHANGE_RLT                   = long.Parse(red["SH_EXCHANGE_RLT"].ToString());
                    mPermission.SH_ADD_NEW_CUT_RAW_TIN            = long.Parse(red["SH_ADD_NEW_CUT_RAW_TIN"].ToString());
                    mPermission.SH_ADD_NEW_CUT_PRINTED_TIN        = long.Parse(red["SH_ADD_NEW_CUT_PRINTED_TIN"].ToString());
                    mPermission.SH_EXCHANGE_CUT_PRINTED_TIN       = long.Parse(red["SH_EXCHANGE_CUT_PRINTED_TIN"].ToString());
                    mPermission.SH_ADD_NEW_BOTTOM                 = long.Parse(red["SH_ADD_NEW_BOTTOM"].ToString());
                    mPermission.SH_EXCHANGE_BOTTOM                = long.Parse(red["SH_EXCHANGE_BOTTOM"].ToString());
                    mPermission.SH_DEPARTMENT_MAINTENANCE         = long.Parse(red["SH_DEPARTMENT_MAINTENANCE"].ToString());
                }
                myconnection.closeConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR WHIE GETTING USER PERMISSION " + ex.ToString());
            }
        }
 private void save_btn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(client_company_conact_email_text_box.Text) || string.IsNullOrWhiteSpace(client_company_contact_name.Text) || string.IsNullOrWhiteSpace(client_company_contact_telephone_text_box.Text))
     {
     }
     else
     {
         if (editeclientconctactid == 0) //new button
         {
             try
             {
                 string query = "INSERT INTO SH_CLIENT_COMPANY_CONTACTS ";
                 query += "(SH_CLIENT_COMPANY_ID, SH_CLIENT_COMPANY_CONTACT_NAME, ";
                 query += " SH_CLIENT_COMPANY_CONTACT_TELEPHONE, SH_CLIENT_COMPANY_CONTACT_EMAIL";
                 query += " ,SH_DATA_ENTRY_USER_ID,SH_DATA_ENTRY_EMPLOYEE_ID,SH_ADDITION_DATE";
                 query += ") ";
                 query += " VALUES(@SH_CLIENT_COMPANY_ID,@SH_CLIENT_COMPANY_CONTACT_NAME,";
                 query += "@SH_CLIENT_COMPANY_CONTACT_TELEPHONE,@SH_CLIENT_COMPANY_CONTACT_EMAIL ,";
                 query += " @SH_DATA_ENTRY_USER_ID, @SH_DATA_ENTRY_EMPLOYEE_ID, @SH_ADDITION_DATE";
                 query += ")";
                 DatabaseConnection myconnection = new DatabaseConnection();
                 myconnection.openConnection();
                 SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_ID", mclient.SH_ID);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_CONTACT_NAME", client_company_contact_name.Text);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_CONTACT_TELEPHONE", client_company_contact_telephone_text_box.Text);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_CONTACT_EMAIL", client_company_conact_email_text_box.Text);
                 cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_USER_ID", mAccount.SH_ID);
                 cmd.Parameters.AddWithValue("@SH_DATA_ENTRY_EMPLOYEE_ID", mAccount.SH_EMP_ID);
                 cmd.Parameters.AddWithValue("@SH_ADDITION_DATE", DateTime.Now);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("تم الحفظ بنجاح", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                 client_company_contact_name.Text               = "";
                 client_company_conact_email_text_box.Text      = "";
                 client_company_contact_telephone_text_box.Text = "";
                 myconnection.closeConnection();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("ERROR WHILE ADDING NEW CLIENT CONTACT IN DB " + ex.ToString());
             }
             fillclientcontactsgridview();
         }
         else  // edite
         {
             try
             {
                 string query = "UPDATE       SH_CLIENT_COMPANY_CONTACTS";
                 query += " SET SH_CLIENT_COMPANY_CONTACT_NAME = @SH_CLIENT_COMPANY_CONTACT_NAME, SH_CLIENT_COMPANY_CONTACT_TELEPHONE = @SH_CLIENT_COMPANY_CONTACT_TELEPHONE, ";
                 query += "SH_CLIENT_COMPANY_CONTACT_EMAIL = @SH_CLIENT_COMPANY_CONTACT_EMAIL  WHERE SH_ID = @SH_ID";
                 DatabaseConnection myconnection = new DatabaseConnection();
                 myconnection.openConnection();
                 SqlCommand cmd = new SqlCommand(query, DatabaseConnection.mConnection);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_ID", mclient.SH_ID);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_CONTACT_NAME", client_company_contact_name.Text);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_CONTACT_TELEPHONE", client_company_contact_telephone_text_box.Text);
                 cmd.Parameters.AddWithValue("@SH_CLIENT_COMPANY_CONTACT_EMAIL", client_company_conact_email_text_box.Text);
                 cmd.Parameters.AddWithValue("@SH_ID", editeclientconctactid);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("تم التعديل بنجاح", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                 client_company_contact_name.Text               = "";
                 client_company_conact_email_text_box.Text      = "";
                 client_company_contact_telephone_text_box.Text = "";
                 myconnection.closeConnection();
                 editeclientconctactid = 0;
             }
             catch (Exception ex)
             {
                 MessageBox.Show("ERROR WHILE EDITING  CLIENT CONTACT IN DB " + ex.ToString());
             }
             fillclientcontactsgridview();
         }
         editeclientconctactid = 0;
     }
 }
Beispiel #11
0
        private void printfinishedcanstotalbalanceform_Load(object sender, EventArgs e)
        {
            DataTable mydatatabel = new DataTable();

            mydatatabel.Columns.Add("m");
            mydatatabel.Columns.Add("client_name");
            mydatatabel.Columns.Add("product_name");
            //size
            mydatatabel.Columns.Add("size_name");

            //no_cans_per_pallet
            mydatatabel.Columns.Add("total_number_of_pallets");
            mydatatabel.Columns.Add("total_number_of_cans_per_pallet");
            mydatatabel.Columns.Add("total_number_of_cans");
            mydatatabel.Columns.Add("addition_date");
            long total_no_pallets = 0;
            long total_no_cans    = 0;

            try
            {
                myconnection.openConnection();
                SqlCommand cmd = new SqlCommand("SH_GET_ALL_FINISHED_CANS", DatabaseConnection.mConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader reader  = cmd.ExecuteReader();
                long          counter = 0;
                while (reader.Read())
                {
                    counter++;
                    string[] mydata = new string[8];
                    mydata[0]         = (counter).ToString();
                    mydata[1]         = reader["SH_CLIENT_COMPANY_NAME"].ToString();
                    mydata[2]         = reader["SH_PRODUCT_NAME"].ToString();
                    mydata[3]         = reader["product_size"].ToString();
                    mydata[4]         = reader["NUMBER_OF_PALLETS"].ToString();
                    total_no_pallets += long.Parse(reader["NUMBER_OF_PALLETS"].ToString());
                    mydata[5]         = (long.Parse(reader["TOTAL_NO_CANS"].ToString()) / long.Parse(reader["NUMBER_OF_PALLETS"].ToString())).ToString();
                    total_no_cans    += long.Parse(reader["TOTAL_NO_CANS"].ToString());
                    mydata[6]         = reader["TOTAL_NO_CANS"].ToString();
                    mydata[7]         = reader["SH_ADDITION_DATE"].ToString();
                    mydatatabel.Rows.Add(mydata);
                }

                reader.Close();
                myconnection.closeConnection();
                // MessageBox.Show("ROWS : "+mydatatabel.Rows.Count.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR WHILE GETIING FINISHED CANS " + ex.ToString());
            }
            ReportParameter[] myparm = new ReportParameter[3];
            myparm[0] = new ReportParameter("total_no_pallets", total_no_pallets.ToString(), false);
            myparm[1] = new ReportParameter("total_no_cans", total_no_cans.ToString(), false);
            myparm[2] = new ReportParameter("report_presenter_name", mEmployee.SH_EMPLOYEE_NAME, false);

            this.reportViewer1.LocalReport.SetParameters(myparm);
            ReportDataSource rds = new ReportDataSource("mydataset", mydatatabel);

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(rds);
            //reportViewer1.DataBind();
            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.RefreshReport();
        }