Beispiel #1
0
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Stock_ classObj = DG_Stock.SelectedItem as Stock_;
            int    id       = classObj.Product_Id;
            var    query    = from m in stock_context.Stock_s
                              where m.Product_Id == id
                              select m;

            foreach (var q in query)
            {
                Product_code.Text             = Convert.ToString(q.Product_Id);
                Product_name.Text             = q.Product_Name;
                Transaction_date.SelectedDate = q.Trans_Date;
                auto_number.Text = Convert.ToString(q.Quantity);
            }
        }
Beispiel #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            Stock_ classObj = DG_Stock.SelectedItem as Stock_;

            ID           = classObj.Product_Id;
            stock_member = stock_context.Stock_s.Where(w => w.Product_Id == ID).FirstOrDefault();
            stock_context.Stock_s.DeleteOnSubmit(stock_member);
            stock_context.SubmitChanges();
            DG_Stock.ItemsSource = stock_context.Stock_s.ToList();
            if (ID <= DG_Stock.Items.Count - 1)
            {
                DG_Stock.SelectedIndex = ID;
            }
            Product_name.Text             = auto_number.Text = Product_code.Text = "";
            Transaction_date.SelectedDate = System.DateTime.Now;
        }
Beispiel #3
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            if (DG_Stock.CurrentCell.Item != null)
            {
                using (ProductLinqClassesDataContext p_linq = new ProductLinqClassesDataContext())
                {
                    Stock_ classObj = DG_Stock.SelectedItem as Stock_;
                    ID           = classObj.Product_Id;
                    stock_member = p_linq.Stock_s.Where(w => w.Product_Id == ID).FirstOrDefault();
                    stock_member.Product_Name = Product_name.Text;
                    stock_member.Trans_Date   = Transaction_date.SelectedDate;
                    stock_member.Quantity     = Convert.ToInt32(auto_number.Text);
                    p_linq.SubmitChanges();

                    DG_Stock.ItemsSource          = p_linq.Stock_s.ToList();
                    Product_name.Text             = auto_number.Text = Product_code.Text = "";
                    Transaction_date.SelectedDate = System.DateTime.Now;
                }
            }
        }
 partial void DeleteStock_(Stock_ instance);
 partial void UpdateStock_(Stock_ instance);
 partial void InsertStock_(Stock_ instance);