コード例 #1
0
ファイル: Shopform.cs プロジェクト: talhasyed11/Point-of-sale
        private void label12_Click(object sender, EventArgs e)
        {
            if (ProName.Text == "" || ProPrice.Text == "" || ProQty.Text == "" || ProQty.Text == "0" || Convert.ToInt32(ProQty.Text) < 1)
            {
                MessageBox.Show("Please select the Valid entries");
            }
            else
            {
                int        remainingitems;
                SqlCommand command =
                    new SqlCommand("select ProductQty from ProductTable WHERE Productid= " + Productid.Text + "", Con);
                Con.Open();

                SqlDataReader read = command.ExecuteReader();

                read.Read();

                dbproqty = (read["ProductQty"].ToString());

                Con.Close();
                remainingitems = Convert.ToInt32(dbproqty) + Convert.ToInt32(ProQty.Text);

                String     query = "update ProductTable set ProductQty='" + remainingitems + "'where Productid = " + Productid.Text + "";
                SqlCommand cmd   = new SqlCommand(query, Con);
                Con.Open();
                cmd.ExecuteNonQuery();

                //MessageBox.Show("Category is Updated Successfully");
                Con.Close();



                DataGridViewRow newrow = new DataGridViewRow();
                newrow.CreateCells(Orderdgv);
                newrow.Cells[0].Value = Productid.Text;
                newrow.Cells[1].Value = ProName.Text;
                newrow.Cells[2].Value = ProPrice.Text;
                newrow.Cells[3].Value = ProQty.Text;
                newrow.Cells[4].Value = -(Convert.ToInt32(ProPrice.Text) * Convert.ToInt32(ProQty.Text));
                int totalprice = Convert.ToInt32(ProPrice.Text) * Convert.ToInt32(ProQty.Text);
                Orderdgv.Rows.Add(newrow);
                //gridtotal = (gridtotal + totalprice);
                //TotalPrice.Text = gridtotal.ToString();
                int sum = 0;
                for (int i = 0; i < Orderdgv.Rows.Count; ++i)
                {
                    sum += Convert.ToInt32(Orderdgv.Rows[i].Cells[4].Value);
                }
                TotalPrice.Text = sum.ToString();
                ProQty.Clear();
                ProName.Clear();
                ProPrice.Clear();
                Productid.Clear();
                populate();



                read.Close();
            }
        }
コード例 #2
0
        public override int GetHashCode() {
            int hash = GetType().GetHashCode();
            hash = (hash * 397) ^ Productid.GetHashCode();
			hash = (hash * 397) ^ Startdate.GetHashCode();

            return hash;
        }
コード例 #3
0
ファイル: Shopform.cs プロジェクト: talhasyed11/Point-of-sale
        private void label1_Click(object sender, EventArgs e)
        {
            if (ProName.Text == "" || ProPrice.Text == "" || ProQty.Text == "" || ProQty.Text == "0" || Convert.ToInt32(ProQty.Text) < 1)
            {
                MessageBox.Show("Please select the Valid entries");
            }
            else
            {
                int        remainingitems;
                SqlCommand command =
                    new SqlCommand("select ProductQty from ProductTable WHERE Productid= " + Productid.Text + "", Con);
                Con.Open();

                SqlDataReader read = command.ExecuteReader();

                read.Read();

                dbproqty = (read["ProductQty"].ToString());
                if (Convert.ToInt32(ProQty.Text) > Convert.ToInt32(dbproqty))
                {
                    MessageBox.Show("Number of items are low so please enter valid quantity\n Current Quantity = " + dbproqty + "");
                    Con.Close();
                }

                else
                {
                    Con.Close();
                    remainingitems = Convert.ToInt32(dbproqty) - Convert.ToInt32(ProQty.Text);

                    String     query = "update ProductTable set ProductQty='" + remainingitems + "'where Productid = " + Productid.Text + "";
                    SqlCommand cmd   = new SqlCommand(query, Con);
                    Con.Open();
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Category is Updated Successfully");
                    Con.Close();



                    DataGridViewRow newrow = new DataGridViewRow();
                    newrow.CreateCells(Orderdgv);
                    newrow.Cells[0].Value = Productid.Text;
                    newrow.Cells[1].Value = ProName.Text;
                    newrow.Cells[2].Value = ProPrice.Text;
                    newrow.Cells[3].Value = ProQty.Text;
                    newrow.Cells[4].Value = Convert.ToInt32(ProPrice.Text) * Convert.ToInt32(ProQty.Text);
                    int totalprice = Convert.ToInt32(ProPrice.Text) * Convert.ToInt32(ProQty.Text);
                    Orderdgv.Rows.Add(newrow);
                    gridtotal       = gridtotal + totalprice;
                    TotalPrice.Text = gridtotal.ToString();
                    ProQty.Clear();
                    ProName.Clear();
                    ProPrice.Clear();
                    Productid.Clear();
                    populate();
                }

                read.Close();
            }
        }
コード例 #4
0
 public override bool Equals(object obj)
 {
     if (obj is Product product)
     {
         return(Productid.Equals(product.Productid));
     }
     return(false);
 }
コード例 #5
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 397) ^ Locationid.GetHashCode();
            hash = (hash * 397) ^ Productid.GetHashCode();

            return(hash);
        }
コード例 #6
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 397) ^ Documentnode.GetHashCode();
            hash = (hash * 397) ^ Productid.GetHashCode();

            return(hash);
        }
コード例 #7
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 397) ^ Businessentityid.GetHashCode();
            hash = (hash * 397) ^ Productid.GetHashCode();

            return(hash);
        }
コード例 #8
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 397) ^ Specialofferid.GetHashCode();
            hash = (hash * 397) ^ Productid.GetHashCode();

            return(hash);
        }
コード例 #9
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 397) ^ Operationsequence.GetHashCode();
            hash = (hash * 397) ^ Productid.GetHashCode();
            hash = (hash * 397) ^ Workorderid.GetHashCode();

            return(hash);
        }
コード例 #10
0
ファイル: Basket.cs プロジェクト: fadynashat/microservices
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Productid != 0)
            {
                hash ^= Productid.GetHashCode();
            }
            if (Productname.Length != 0)
            {
                hash ^= Productname.GetHashCode();
            }
            if (Unitprice != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Unitprice);
            }
            if (Oldunitprice != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Oldunitprice);
            }
            if (Quantity != 0)
            {
                hash ^= Quantity.GetHashCode();
            }
            if (Pictureurl.Length != 0)
            {
                hash ^= Pictureurl.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }