コード例 #1
0
        private void hlAddProducts_Click(object sender, RoutedEventArgs e)
        {
            frmAddProducts obj = new frmAddProducts();
            obj.ShowDialog();
            if(obj.DialogResult == true)
            {
                if (dtstat.Rows.Count == 0)
                {
                    dtstat.Columns.Add("ID");
                    dtstat.Columns.Add("Product_Name");
                    dtstat.Columns.Add("Brand_Name");
                    dtstat.Columns.Add("Product_Category");
                    dtstat.Columns.Add("Model_No");
                    dtstat.Columns.Add("Color");
                    dtstat.Columns.Add("Price");
                }
                DataRow dr = dtstat.NewRow();
                dr["ID"] = obj.txtProductsID.Text;
                dr["Product_Name"] = obj.txtPRoductName.Text;
                dr["Brand_Name"] = obj.txtBrandName.Text;
                dr["Product_Category"] = obj.txtPRoductCategory.Text;
                dr["Model_No"] = obj.txtModelNo.Text;
                dr["Color"] = obj.txtColor.Text;
                dr["Price"] = obj.txtPrice.Text;

                dtstat.Rows.Add(dr);
                dgvFoll_AddProducts.ItemsSource = dtstat.DefaultView;
                dgvFoll_AddProducts.CanUserAddRows = false;
            }
            //obj.Show();
        }
コード例 #2
0
        private void hlViewFollowProducts_Click(object sender, RoutedEventArgs e)
        {
            frmAddProducts obj = new frmAddProducts();
            obj.ShowDialog();
            if (obj.DialogResult == true)
            {
                if (dtstat.Rows.Count == 0)
                {
                    dtstat.Columns.Add("ID");
                    dtstat.Columns.Add("Product_Name");
                    dtstat.Columns.Add("Brand_Name");
                    dtstat.Columns.Add("Product_Category");
                    dtstat.Columns.Add("Model_No");
                    dtstat.Columns.Add("Color");
                    dtstat.Columns.Add("Price");
                }
                //DataRow dr = dtstat.NewRow();
                //dr["ID"] = obj.txtProductsID.Text;
                //dr["Product_Name"] = obj.txtPRoductName.Text;
                //dr["Brand_Name"] = obj.txtBrandName.Text;
                //dr["Product_Category"] = obj.txtPRoductCategory.Text;
                //dr["Model_No"] = obj.txtModelNo.Text;
                //dr["Color"] = obj.txtColor.Text;
                //dr["Price"] = obj.txtPrice.Text;

                try
                {
                    balfollwproducts.Flag = 1;
                    balfollwproducts.FolloupProductID = Convert.ToInt32(txtFollowupViewID.Text);
                    balfollwproducts.FProductID = Convert.ToInt32(dtstat.Rows[i]["ID"].ToString());
                    balfollwproducts.S_Status = "Active";
                    balfollwproducts.C_Date = System.DateTime.Now.ToShortDateString();
                    dalfollow.FollwupProducts_Save_Insert_Update_Delete(balfollwproducts);
                    MessageBox.Show("Done");

                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }

                FollowupAllProducts_Details();
                //dtstat.Rows.Add(dr);
                //dgvFollowUp_Products.ItemsSource = dtstat.DefaultView;
                //dgvFollowUp_Products.CanUserAddRows = false;
                
            }
        }