コード例 #1
0
 public ActionResult ProductDemo()
 {
     DAO.ProductDAO dao = new DAO.ProductDAO();
     ViewBag.dhdl     = dao.GetViewIntro("Viện nông nghiệp công nghệ cao");
     ViewBag.langfarm = dao.GetViewIntro("L'ang Farm");
     return(View());
 }
コード例 #2
0
        private void cboOldProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            //List Product with same priceout to New Combo
            int productid = ((Item)cboOldProduct.SelectedItem).Value;
            DataSet ds = new DAO.ProductDAO().getSamePriceProduct(productid);
            cboNewProduct.DataSource = ds.Tables[0];
            cboNewProduct.DisplayMember = "productname";
            cboNewProduct.ValueMember = "productid";

        }
コード例 #3
0
        private void ProductInStock_Load(object sender, EventArgs e)
        {
            DataSet d = new DAO.StoreDAO().GetAllStores();
            cbStock.DataSource = d.Tables[0];
            cbStock.DisplayMember = "storename";
            cbStock.ValueMember = "storeid";
            DataSet da = new DAO.ProductDAO().getAllProductDS();
            cbProduct.DataSource = da.Tables[0];
            cbProduct.DisplayMember = "productname";
            cbProduct.ValueMember = "productid";

            DataSet dataSet = new StoreProductDAO().GetAllStoreProducts();
            dgvStoreProduct.DataSource = dataSet.Tables[0];
            Utility.setGridHeaderText("ឈ្មោះស្តុក|ឈ្មោះទំនិញ|បរិមាណ|បរិមាណប្តូវិញ", dgvStoreProduct);
            Utility.setGridHeaderWidth("200|300", dgvStoreProduct);

        }
コード例 #4
0
ファイル: FrmReport.cs プロジェクト: KH4IT/MakeOver-Paris
        public FrmReport()
        {
            InitializeComponent();
            productDAO = new DAO.ProductDAO();
            invoiceDAO = new DAO.InvoiceDAO();
            transactionDAO = new DAO.TransactionDAO();
            memberDAO = new DAO.MemberDAO();
            staffDAO = new DAO.StaffDAO();
            DataSet ds = new DAO.StaffDAO().GetAllStaffs();

            //DataRow dr = new DataRow("SELECT");
            //ds.Tables[0].Rows.InsertAt(,0);
            cboStaffs.DataSource = ds.Tables[0];
            cboStaffs.DisplayMember = "staffname";
            cboStaffs.ValueMember = "staffid";
            //cboMember.Items.Insert(0, "-Select-");
        }
コード例 #5
0
        private void grdItems_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            for (int i = 0; i < grdItems.Rows.Count; i++)
            {
                for (int j = 0; j < grdItems.Rows[i].Cells.Count; j++)
                {
                    if (grdItems.Rows[i].Cells[j].Value==null)
                    {
                        grdItems.Rows[i].Cells[j].Value = 1;
                    }
                }
            }
            DTO.Product product = new DAO.ProductDAO().getProductById(grdItems.CurrentRow.Cells[7].Value.ToString(), UserSession.Session.Staff.StoreId);
            if (product != null)
            {
                int row = checkInGrid(product.Productid);
                if (row == -1)
                {
                    if (product.Quantity >= 1)
                    {
                        grdItems.Rows.Add(grdItems.RowCount + 1, product.Productname, 1, product.Priceout, 0, product.Priceout, "-", product.Productid, product.Pricein);
                        row_calculate(e.RowIndex);
                    }
                    else
                    {
                        MessageBox.Show("No Product In Stock");
                        //MessageBox.Show(grdItems.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                        //grdItems.Rows[row].Cells[2].Value = oldValue;
                    }
                }
                else
                {
                    if (product.Quantity > int.Parse(grdItems.Rows[row].Cells[2].Value.ToString()))
                    {
                        grdItems.Rows[row].Cells[2].Value = int.Parse(grdItems.Rows[row].Cells[2].Value.ToString());
                        decimal subtotal = (decimal.Parse(grdItems.Rows[row].Cells[2].Value.ToString()) * decimal.Parse(grdItems.Rows[row].Cells[3].Value.ToString()));
                        decimal discount = subtotal * decimal.Parse(grdItems.Rows[row].Cells[4].Value.ToString()) / 100;
                        row_calculate(e.RowIndex);
                        grdItems.Rows[row].Cells[5].Value = subtotal - discount;
                    }
                    else
                    {
                        MessageBox.Show("Not enought product in stock");
                        //grdItems.CancelEdit();
                        //grdItems.RefreshEdit();
                        grdItems.Rows[row].Cells[2].Value = oldValue;
                    }

                }
                
            }
            else
            {
                MessageBox.Show("No Product Found");
            }
        }
コード例 #6
0
 private void txtName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (txtCode.Text != "")
         {
             count_enter = 0;
             DTO.Product product = new DAO.ProductDAO().getProduct(txtCode.Text, UserSession.Session.Staff.StoreId);
             if (product != null)
             {
                 addToGrid(product);
             }
             else
             {
                 MessageBox.Show("No Product Found");
             }
             txtCode.Clear();
         }
         else if (grdItems.Rows.Count > 0)
         {
             count_enter += 1;
         }
         if (count_enter >= 2)
         {
             int invoiceid = insertToDB();
             if (invoiceid != -1)
             {
                 decimal total = decimal.Parse(lblDollar.Text.Substring(0, lblDollar.Text.Length-2));
                 
                 FrmPay frmPay = new FrmPay();
                 frmPay.txtTotal.Text = total.ToString();
                 frmPay.invoiceid = invoiceid;
                 frmPay.ShowDialog();
                 grdItems.Rows.Clear();
             }
             count_enter = 0;
         }
     }
 }
コード例 #7
0
ファイル: FrmProduct.cs プロジェクト: KH4IT/MakeOver-Paris
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (id == 0)
            {
                if (    txtBarcode.Text.Trim() == ""    || txtProductCode.Text.Trim() == ""
                    ||  txtName.Text.Trim()  == ""     // || cboCategory.SelectedValue == "" 
                    ||  txtPriceIn.Text.Trim() == ""    || txtPriceOut.Text.Trim() == ""
                )
                {
                    MessageBox.Show("សូមបំពេញពត៏មានឲ្យបានត្រឹមត្រូវ!!!");
                }
                else
                {
                    DAO.ProductDAO productDAO = new DAO.ProductDAO();
                    if (productDAO.checkProduct(txtProductCode.Text))
                    {
                        MessageBox.Show("លេខកូដទំនិញរបស់លោកអ្នកមានរួចហើយ សូមបញ្ចូលលេខកូដទំនិញផ្សេង");
                        return;
                    }
                    DTO.Staff staff = new DTO.Staff();
                    staff.Staffid = UserSession.Session.Staff.Staffid;// Data.user.Staffid;
                    DTO.Category cate = new DTO.Category();
                    cate.Categoryid = (int)cboCategory.SelectedValue;
                    DTO.Product product = new DTO.Product(0,txtProductCode.Text.Trim(), txtBarcode.Text.Trim(), txtName.Text.Trim(), txtDescription.Text.Trim(),
                    Decimal.Parse(txtPriceIn.Text.Trim()), Decimal.Parse(txtPriceOut.Text.Trim()), txtRemark.Text.Trim(), staff, staff, cate);
                    if (new DAO.ProductDAO().addProduct(product))
                    {
                        ClearForm();
                        dgvProduct.DataSource = new DAO.ProductDAO().getAllProductDS().Tables[0];
                        id = 0;
                    }
                    else
                    {
                        MessageBox.Show("ប្រតិបត្តិការណ៍បរាជ័យ!!!");
                    }
                }
            }
            else
            {

                if (txtBarcode.Text.Trim() == "" || txtProductCode.Text.Trim() == ""
                   || txtName.Text.Trim() == ""     // || cboCategory.SelectedValue == ""
                   || txtPriceIn.Text.Trim() == "" || txtPriceOut.Text.Trim() == ""
               )
                {
                    MessageBox.Show("សូមបំពេញពត៏មានឲ្យបានត្រឹមត្រូវ!!!");
                }
                else
                {
                    DTO.Staff staff = new DTO.Staff();
                    staff.Staffid = UserSession.Session.Staff.Staffid;// Data.user.Staffid;
                    DTO.Category cate = new DTO.Category();
                    cate.Categoryid = (int)cboCategory.SelectedValue;
                    DTO.Product product = new DTO.Product(id, txtProductCode.Text.Trim(), txtBarcode.Text.Trim(), txtName.Text.Trim(), txtDescription.Text.Trim(),
                       Decimal.Parse(txtPriceIn.Text.Trim()), Decimal.Parse(txtPriceOut.Text.Trim()), txtRemark.Text.Trim(), staff, staff, cate);
                    if (new DAO.ProductDAO().updateProduct(product))
                    {
                        ClearForm();
                        dgvProduct.DataSource = new DAO.ProductDAO().getAllProductDS().Tables[0];
                        id = 0;
                        delete.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show("ប្រតិបត្តិការណ៍បរាជ័យ!!!");
                    }
                }
            }
        }