예제 #1
0
        private void Shop_Form_Load(object sender, EventArgs e)
        {
            ShoplinqDataContext data       = new ShoplinqDataContext();
            List <ShopTable>    lshoptable = new List <ShopTable>();

            lshoptable = data.ShopTables.ToList();
            dataGridView_Form1.DataSource = lshoptable;

            toolTip1.SetToolTip(button_About, "درباره");
            toolTip1.SetToolTip(Button_Show, "نمایش");
            toolTip1.SetToolTip(Button_Insert, "اضافه");
            toolTip1.SetToolTip(Button_Search, "جستجو");
            toolTip1.SetToolTip(Button_Delete, "حذف");
            toolTip1.SetToolTip(Button_Restore, "سطل بازیافت");
            toolTip1.SetToolTip(Button_Sort, "مرتب کردن");
            toolTip1.SetToolTip(button_Exit, "خروج");
            toolTip1.SetToolTip(button_Play, "پخش آهنگ");
            toolTip1.SetToolTip(button_Stop, "توقف آهنگ");
            toolTip1.SetToolTip(button_Changemusic, "تغییر آهنگ");

            music[0] = Application.StartupPath + "//ParandeyeMohajer.wav";
            music[1] = Application.StartupPath + "//Baazi.wav";

            this.playmuisic();
        }
예제 #2
0
        private void button_Restore_Click(object sender, EventArgs e)
        {
            ShoplinqDataContext data = new ShoplinqDataContext();

            if (this.dataGridView_Restore.RowCount > 0 && this.dataGridView_Restore.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow row in this.dataGridView_Restore.SelectedRows)
                {
                    RecycleBin deltable;
                    deltable = (RecycleBin)row.DataBoundItem;
                    data.RecycleBins.DeleteAllOnSubmit(data.RecycleBins.Where(s => s.Id == deltable.Id));

                    ShopTable rb = new ShopTable();
                    rb.Id      = deltable.Id;
                    rb.stuff   = deltable.stuff;
                    rb.company = deltable.company;
                    rb.price   = deltable.price;
                    rb.exp     = deltable.exp;
                    data.ShopTables.InsertOnSubmit(rb);
                }
            }
            data.SubmitChanges();

            List <RecycleBin> listrb = new List <RecycleBin>();

            listrb = data.RecycleBins.ToList();
            dataGridView_Restore.DataSource = listrb;
        }
예제 #3
0
        private void button_Search_Click(object sender, EventArgs e)
        {
            if (textBox_Search.Text != "")
            {
                ShoplinqDataContext data = new ShoplinqDataContext();

                if (radioButton_SeaStuff.Checked)
                {
                    string search = textBox_Search.Text;
                    ListShop = data.ShopTables.Where(s => s.stuff == search).ToList();
                }

                if (radioButton_SeaCompany.Checked)
                {
                    string search = textBox_Search.Text;
                    ListShop = data.ShopTables.Where(s => s.company == search).ToList();
                }

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }

            if (textBox_Search.Text == "")
            {
                textBox_Search.BackColor = Color.Yellow;
            }
            else
            {
                textBox_Search.BackColor = Color.White;
            }
        }
예제 #4
0
        private void Button_Show_Click(object sender, EventArgs e)
        {
            ShoplinqDataContext data       = new ShoplinqDataContext();
            List <ShopTable>    lshoptable = new List <ShopTable>();

            lshoptable = data.ShopTables.ToList();
            dataGridView_Form1.DataSource = lshoptable;
        }
예제 #5
0
        private void Restore_Load(object sender, EventArgs e)
        {
            ShoplinqDataContext data   = new ShoplinqDataContext();
            List <RecycleBin>   listrb = new List <RecycleBin>();

            listrb = data.RecycleBins.ToList();
            dataGridView_Restore.DataSource = listrb;
        }
예제 #6
0
        private void button_Done_Click(object sender, EventArgs e)
        {
            ShoplinqDataContext data = new ShoplinqDataContext();
            List <ShopTable>    tempsort;

            tempsort = data.ShopTables.ToList();

            if (comboBox_sort.SelectedItem == "برحسب کد کالا" && radioButton_Acs.Checked == true)
            {
                ListSort = tempsort.OrderBy(s => s.Id).ToList();
            }
            if (comboBox_sort.SelectedItem == "برحسب کد کالا" && radioButton_Acs.Checked == false)
            {
                ListSort = tempsort.OrderByDescending(s => s.Id).ToList();
            }

            if (comboBox_sort.SelectedItem == "برحسب نام کالا" && radioButton_Acs.Checked == true)
            {
                ListSort = tempsort.OrderBy(s => s.stuff).ToList();
            }
            if (comboBox_sort.SelectedItem == "برحسب نام کالا" && radioButton_Acs.Checked == false)
            {
                ListSort = tempsort.OrderByDescending(s => s.stuff).ToList();
            }

            if (comboBox_sort.SelectedItem == "برحسب نام شرکت" && radioButton_Acs.Checked == true)
            {
                ListSort = tempsort.OrderBy(s => s.company).ToList();
            }
            if (comboBox_sort.SelectedItem == "برحسب نام شرکت" && radioButton_Acs.Checked == false)
            {
                ListSort = tempsort.OrderByDescending(s => s.company).ToList();
            }

            if (comboBox_sort.SelectedItem == "برحسب قیمت" && radioButton_Acs.Checked == true)
            {
                ListSort = tempsort.OrderBy(s => s.price).ToList();
            }
            if (comboBox_sort.SelectedItem == "برحسب قیمت" && radioButton_Acs.Checked == false)
            {
                ListSort = tempsort.OrderByDescending(s => s.price).ToList();
            }

            if (comboBox_sort.SelectedItem == "برحسب تاریخ انقضا" && radioButton_Acs.Checked == true)
            {
                ListSort = tempsort.OrderBy(s => s.exp).ToList();
            }
            if (comboBox_sort.SelectedItem == "برحسب تاریخ انقضا" && radioButton_Acs.Checked == false)
            {
                ListSort = tempsort.OrderByDescending(s => s.exp).ToList();
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
예제 #7
0
        private void Button_Restore_Click(object sender, EventArgs e)
        {
            Restore      fRestore = new Restore();
            DialogResult dr       = fRestore.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                ShoplinqDataContext data       = new ShoplinqDataContext();
                List <ShopTable>    lshoptable = new List <ShopTable>();
                lshoptable = data.ShopTables.ToList();
                dataGridView_Form1.DataSource = lshoptable;
            }
        }
예제 #8
0
        private void Button_Delete_Click(object sender, EventArgs e)
        {
            ShoplinqDataContext data = new ShoplinqDataContext();

            if (this.dataGridView_Form1.RowCount > 0 && this.dataGridView_Form1.SelectedRows.Count > 0)
            {
                Remove       fRemove = new Remove();
                DialogResult dr      = fRemove.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.No)
                {
                    foreach (DataGridViewRow row in this.dataGridView_Form1.SelectedRows)
                    {
                        ShopTable deltable;
                        deltable = (ShopTable)row.DataBoundItem;
                        data.ShopTables.DeleteAllOnSubmit(data.ShopTables.Where(s => s.Id == deltable.Id));

                        RecycleBin rb = new RecycleBin();
                        rb.Id      = deltable.Id;
                        rb.stuff   = deltable.stuff;
                        rb.company = deltable.company;
                        rb.price   = deltable.price;
                        rb.exp     = deltable.exp;
                        data.RecycleBins.InsertOnSubmit(rb);
                    }
                }
                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in this.dataGridView_Form1.SelectedRows)
                    {
                        ShopTable deltable;
                        deltable = (ShopTable)row.DataBoundItem;
                        data.ShopTables.DeleteAllOnSubmit(data.ShopTables.Where(s => s.Id == deltable.Id));
                    }
                }
                data.SubmitChanges();
            }
            List <ShopTable> lshoptable = new List <ShopTable>();

            lshoptable = data.ShopTables.ToList();
            dataGridView_Form1.DataSource = lshoptable;
        }
예제 #9
0
        private void Button_Add_Click(object sender, EventArgs e)
        {
            if (textBox_Id.Text != "" && TextBox_Stuff.Text != "" && TextBox_Company.Text != "" &&
                textBox_Price.Text != "" && maskedTextBox_Exp.Text != "")
            {
                ShopTable sh = new ShopTable();
                sh.Id      = int.Parse(textBox_Id.Text);
                sh.stuff   = TextBox_Stuff.Text;
                sh.company = TextBox_Company.Text;
                sh.price   = Int32.Parse(textBox_Price.Text);
                sh.exp     = DateTime.Parse(maskedTextBox_Exp.Text);
                ShoplinqDataContext data = new ShoplinqDataContext();
                data.ShopTables.InsertOnSubmit(sh);
                data.SubmitChanges();
                MessageBox.Show("کالا اضافه شد");
            }

            if (textBox_Id.Text == "")
            {
                textBox_Id.BackColor = Color.Yellow;
            }
            else
            {
                textBox_Id.BackColor = Color.White;
            }

            if (TextBox_Stuff.Text == "")
            {
                TextBox_Stuff.BackColor = Color.Yellow;
            }
            else
            {
                TextBox_Stuff.BackColor = Color.White;
            }

            if (TextBox_Company.Text == "")
            {
                TextBox_Company.BackColor = Color.Yellow;
            }
            else
            {
                TextBox_Company.BackColor = Color.White;
            }

            if (textBox_Price.Text == "")
            {
                textBox_Price.BackColor = Color.Yellow;
            }
            else
            {
                textBox_Price.BackColor = Color.White;
            }

            if (maskedTextBox_Exp.Text == "  /  /")
            {
                maskedTextBox_Exp.BackColor = Color.Yellow;
            }
            else
            {
                maskedTextBox_Exp.BackColor = Color.White;
            }
        }