private void GridProduct_Click(object sender, EventArgs e) { try { if (GridProduct.Rows.Count > 0 && GridProduct.CurrentRow.Index != -1) { TxtProductID.Tag = GridProduct.Rows[GridProduct.CurrentRow.Index].Cells["ProductID"].Value.ToString(); DataTable dt = new DataTable(); DAL.Products obj = new DAL.Products(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(" AND ProductID='" + TxtProductID.Tag.ToString() + "'"); TxtProductID.Text = dt.Rows[0]["ProductId"].ToString(); TxtProductName.Text = dt.Rows[0]["ProductName"].ToString(); //DataTable dt = objDAL.getRecord(" AND ProductID='" + TxtProductID.Tag.ToString() + "'"); vOpenMode = true; } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void DisplayData() { string vWhere = string.Empty; if (!string.IsNullOrEmpty(txtFilter.Text)) { vWhere = " AND Products.ProductName Like '%" + txtFilter.Text + "%'"; } //if (int.Parse(CmbFilter.SelectedValue.ToString()) > 0) //{ // vWhere += " AND ChartOfAccounts.AccountType=" + CmbFilter.SelectedValue; //} try { DAL.Products objDAL = new DAL.Products(); objDAL.connectionstring = vConnectionString; dt = objDAL.getSchRecord(vWhere); Grid.AutoGenerateColumns = false; Grid.DataSource = dt; } catch (Exception exc) { MessageBox.Show(exc.Message.ToString()); } }
public Entities.Products RemoveProduct(int ID) { DAL.Products products = new DAL.Products(); Entities.Products product; product = products.RemoveProduct(ID); return(product); }
public override string ToString() { string value = string.Empty; DAL.Products products = new DAL.Products(); List <Entities.Products> productsList = products.GetProducts(); foreach (Entities.Products p in productsList) { value += p.Id + " - " + p.ProductName + " - " + p.Stock + " - " + p.Price + "\n"; } return(value); }
public ActionResult DeleteProducts(int?p_id) { if (p_id != 0) { System.Web.HttpContext.Current.Application.Lock(); DAL.Products delete = _db.Products.Where(p => p.prod_id == p_id).FirstOrDefault(); _db.Products.Remove(delete); _db.SaveChanges(); System.Web.HttpContext.Current.Application.UnLock(); return(Json(true, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }
public void Delete(int id) { var context = new DAL.Products(); context.Delete(id); }
public Product Put(Product product) { var context = new DAL.Products(); return(context.Update(product)); }
public Product Post(Product product) { var context = new DAL.Products(); return(context.Add(product)); }
public Product Get(int id) { var context = new DAL.Products(); return(context.GetById(id)); }
public IEnumerable <Product> Get() { var context = new DAL.Products(); return(context.GetAll()); }
public ActionResult SaveProduct(Models.Product_ICModel data) { if (!ModelState.IsValid) { if (data.prod_id == 0) { _db = new QSoft_WUEntities(); DAL.Products code = _db.Products.Where(p => p.pcode == data.pcode).FirstOrDefault(); if (code != null) { return(Json(false, JsonRequestBehavior.AllowGet)); } else { System.Web.HttpContext.Current.Application.Lock(); _db = new QSoft_WUEntities(); _db.Products.Add(new DAL.Products { pcode = data.pcode, pname1 = data.pname1, pname11 = data.pname11, pname2 = data.pname2, pname21 = data.pname21, ptype = data.ptype, pqty = data.pqty, pbook = data.pbook, pcost = data.pcost, grpcode = data.grpcode, wcode = data.wcode, pstatus = data.pstatus, pinactive = data.pinactive, psvat = data.psvat, ppvat = data.ppvat, pcst = data.pcst, prpt = data.prpt, ctype = data.ctype, stduid = data.stduid, buid = data.buid, suid = data.suid, stuid = data.stuid, stbuid = data.stbuid, stsuid = data.stsuid, bnum = data.bnum, snum = data.snum, stnum = data.stnum, stbnum = data.stbnum, stsnum = data.stsnum, u0s = data.u0s, u1s = data.u1s, u2s = data.u2s, u3s = data.u3s, u4s = data.u4s, s1 = data.s1, s2 = data.s2, s3 = data.s3, s4 = data.s4, s5 = data.s5, s6 = data.s6, ss1 = data.ss1, ss2 = data.ss2, ss3 = data.ss3, ss4 = data.ss4, stddiscount = data.stddiscount, xprice = data.xprice, xname = data.xname, a1 = data.a1, a2 = data.a2, a3 = data.a3, a4 = data.a4, a5 = data.a5, b1 = data.b1, b2 = data.b2, b3 = data.b3, b4 = data.b4, b5 = data.b5, c1 = data.c1, c2 = data.c2, c3 = data.c3, c4 = data.c4, c5 = data.c5, d1 = data.d1, d2 = data.d2, d3 = data.d3, d4 = data.d4, d5 = data.d5, note1 = data.note1, note2 = data.note2, note3 = data.note3, note4 = data.note4, note5 = data.note5, note6 = data.note6, note7 = data.note7, note8 = data.note8, note9 = data.note9, note10 = data.note10, imgpath = data.imgpath, ccode = data.ccode, mstatus = data.mstatus, ltsale = data.ltsale, ltsend = data.ltsend, barcodeid = data.barcodeid, AmountSet = data.AmountSet, file_img = data.file_img, file_type = data.file_type, dayupSent = data.dayupSent, moq = data.moq, st2uid = data.st2uid, st2num = data.st2num, LotSerialExpireFlag = data.LotSerialExpireFlag, grpcode2 = data.grpcode2, grpcode3 = data.grpcode3, grpcode4 = data.grpcode4, grpcode5 = data.grpcode5 }); _db.SaveChanges(); System.Web.HttpContext.Current.Application.UnLock(); return(Json(true, JsonRequestBehavior.AllowGet)); } } } if (ModelState.IsValid) { if (data.prod_id != 0) { _db = new QSoft_WUEntities(); DAL.Products code = _db.Products.Where(p => p.pcode == data.pcode && p.prod_id != data.prod_id).FirstOrDefault(); if (code != null) { return(Json(false, JsonRequestBehavior.AllowGet)); } else { DAL.Products edit = _db.Products.Where(p => p.prod_id == data.prod_id).FirstOrDefault(); edit.pcode = data.pcode; edit.pname1 = data.pname1; edit.pname11 = data.pname11; edit.pname2 = data.pname2; edit.pname21 = data.pname21; edit.ptype = data.ptype; edit.pqty = data.pqty; edit.pbook = data.pbook; edit.pcost = data.pcost; edit.grpcode = data.grpcode; edit.wcode = data.wcode; edit.pstatus = data.pstatus; edit.pinactive = data.pinactive; edit.psvat = data.psvat; edit.ppvat = data.ppvat; edit.pcst = data.pcst; edit.prpt = data.prpt; edit.ctype = data.ctype; edit.stduid = data.stduid; edit.buid = data.buid; edit.suid = data.suid; edit.stuid = data.stuid; edit.stbuid = data.stbuid; edit.stsuid = data.stsuid; edit.bnum = data.bnum; edit.snum = data.snum; edit.stnum = data.stnum; edit.stbnum = data.stbnum; edit.stsnum = data.stsnum; edit.u0s = data.u0s; edit.u1s = data.u1s; edit.u2s = data.u2s; edit.u3s = data.u3s; edit.u4s = data.u4s; edit.s1 = data.s1; edit.s2 = data.s2; edit.s3 = data.s3; edit.s4 = data.s4; edit.s5 = data.s5; edit.s6 = data.s6; edit.ss1 = data.ss1; edit.ss2 = data.ss2; edit.ss3 = data.ss3; edit.ss4 = data.ss4; edit.stddiscount = data.stddiscount; edit.xprice = data.xprice; edit.xname = data.xname; edit.a1 = data.a1; edit.a2 = data.a2; edit.a3 = data.a3; edit.a4 = data.a4; edit.a5 = data.a5; edit.b1 = data.b1; edit.b2 = data.b2; edit.b3 = data.b3; edit.b4 = data.b4; edit.b5 = data.b5; edit.c1 = data.c1; edit.c2 = data.c2; edit.c3 = data.c3; edit.c4 = data.c4; edit.c5 = data.c5; edit.d1 = data.d1; edit.d2 = data.d2; edit.d3 = data.d3; edit.d4 = data.d4; edit.d5 = data.d5; edit.note1 = data.note1; edit.note2 = data.note2; edit.note3 = data.note3; edit.note4 = data.note4; edit.note5 = data.note5; edit.note6 = data.note6; edit.note7 = data.note7; edit.note8 = data.note8; edit.note9 = data.note9; edit.note10 = data.note10; edit.imgpath = data.imgpath; edit.ccode = data.ccode; edit.mstatus = data.mstatus; edit.ltsale = data.ltsale; edit.ltsend = data.ltsend; edit.barcodeid = data.barcodeid; edit.AmountSet = data.AmountSet; edit.file_img = data.file_img; edit.file_type = data.file_type; edit.dayupSent = data.dayupSent; edit.moq = data.moq; edit.st2uid = data.st2uid; edit.st2num = data.st2num; edit.LotSerialExpireFlag = data.LotSerialExpireFlag; edit.grpcode2 = data.grpcode2; edit.grpcode3 = data.grpcode3; edit.grpcode4 = data.grpcode4; edit.grpcode5 = data.grpcode5; _db.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); } } } return(View(data)); }
public Entities.Products GetProductsByID(int ID) { DAL.Products products = new DAL.Products(); return(products.GetProductByID(ID)); }
public Entities.Products AddProduct(Entities.Products product) { DAL.Products products = new DAL.Products(); products.AddProduct(product); return(product); }
public List <Entities.Products> GetProducts() { DAL.Products products = new DAL.Products(); return(products.GetProducts()); }