Esempio n. 1
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            ItemBatch itemBatch = new ItemBatch();

            itemBatch.Save(Convert.ToInt32(Request.QueryString["itemId"]), Batch.Text, Convert.ToInt32(Quantity.Text));
            Response.Redirect("Default.aspx");
        }
Esempio n. 2
0
        protected void DelBtn_Click(object sender, EventArgs e)
        {
            GridViewRow grdrow = (GridViewRow)((LinkButton)sender).NamingContainer;
            int         del_id = Convert.ToInt32(grdrow.Cells[0].Text);

            Item.Delete(del_id);
            ItemBatch.Delete(del_id);
            Response.Redirect("Default.aspx");
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dr = ItemBatch.ReadAll();

            //DBConnectExecute con = new DBConnectExecute();
            //SqlDataReader dr = con.FetchItems();
            GridView1.DataSource = dr;
            GridView1.DataBind();
        }
Esempio n. 4
0
 protected void Submit_Click(object sender, EventArgs e)
 {
     if (validate(Name.Text))
     {
         int  itemID;
         Item item = new Item();
         itemID = item.Save(Name.Text);
         ItemBatch itemBatch = new ItemBatch();
         itemBatch.Save(itemID, Batch.Text, Convert.ToInt32(Quantity.Text));
         Response.Redirect("Default.aspx");
     }
 }
Esempio n. 5
0
        public static ItemBatch Read(int id)
        {
            DBExecutor <ItemBatch> db = new DBExecutor <ItemBatch>();

            return(db.Execute(delegate(SqlCommand cmd)
            {
                cmd.CommandText = "SELECT * FROM STOCK WHERE ID=" + id;
                var dr = cmd.ExecuteReader();
                ItemBatch ib = new ItemBatch();
                while (dr.Read())
                {
                    ib.Id = Convert.ToInt32(dr["ID"]);
                    ib.item.id = Convert.ToInt32(dr["ItemID"]);
                    ib.item.Name = Item.Read(ib.item.id);
                    ib.Batch = Convert.ToString(dr["BatchNo"]);
                    ib.CP = Convert.ToDouble(dr["CostPrice"]);
                    ib.SP = Convert.ToDouble(dr["SellingPrice"]);
                    ib.OpStock = Convert.ToInt32(dr["NoOfItems"]);
                }
                return ib;
            }));
        }
Esempio n. 6
0
        public static List <ItemBatch> ReadAll()
        {
            DBExecutor <List <ItemBatch> > db = new DBExecutor <List <ItemBatch> >();

            return(db.Execute(delegate(SqlCommand cmd)
            {
                List <ItemBatch> ret = new List <ItemBatch>();
                cmd.CommandText = "SELECT * FROM STOCK ORDER BY ItemID";
                var dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    ItemBatch ib = new ItemBatch();
                    ib.Id = Convert.ToInt32(dr["ID"]);
                    ib.item.id = Convert.ToInt32(dr["ItemID"]);
                    ib.item.Name = Item.Read(ib.item.id);
                    ib.Batch = Convert.ToString(dr["BatchNo"]);
                    ib.CP = Convert.ToDouble(dr["CostPrice"]);
                    ib.SP = Convert.ToDouble(dr["SellingPrice"]);
                    ib.OpStock = Convert.ToInt32(dr["NoOfItems"]);
                    ret.Add(ib);
                }
                return ret;
            }));
        }