public ActionResult Action(tblManufacturer objSubmit) { if (objSubmit.ID == 0) { objSubmit.DateCreated = DateTime.Now; objSubmit.DateUpdated = DateTime.Now; objSubmit.IsDeleted = false; objSubmit.IsShow = true; manufacturerRepository.Add(objSubmit); } else { var obj = manufacturerRepository.GetById <tblManufacturer>(objSubmit.ID); UpdateModel(obj); objSubmit.DateUpdated = DateTime.Now; manufacturerRepository.Update(obj); } return(Json(new { Error = false }, JsonRequestBehavior.AllowGet)); }
private void BtnAdd_Click(object sender, EventArgs e) { if (txtName.Text == "") { MessageBox.Show("Fill textboxes to process.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { try { AddManufacturerBLL bll = new AddManufacturerBLL(); tblManufacturer manufac = new tblManufacturer(); manufac.MName = txtName.Text; generateID(); manufac.ID = txtID.Text; bool ret = bll.InsertManufac(manufac); if (ret == true) { MessageBox.Show("Inserted successfully"); } else { MessageBox.Show("Insert failure"); } } catch (SqlException ex) { MessageBox.Show("Re-input again. Your Company may already be added to database!"); MessageBox.Show(ex.Message); } } }
public bool InsertManufac(tblManufacturer manufac) { string sql = "insert into tblManufacturer values(@id,@name)"; SqlParameter parid = new SqlParameter("@id", SqlDbType.VarChar); parid.Value = manufac.ID; SqlParameter parname = new SqlParameter("@name", SqlDbType.VarChar); parname.Value = manufac.MName; bool ret = WriteData(sql, new[] { parid, parname }); return(ret); }
public List <tblManufacturer> GetManuValue() { List <tblManufacturer> manu = new List <tblManufacturer>(); var manuresult = uok.manufacturer.GetAll(); foreach (var item in manuresult) { tblManufacturer m = new tblManufacturer(); m.ManufacturerID = item.ManufacturerID; m.ManufacturerName = item.ManufacturerName; manu.Add(m); } return(manu); }
public bool Delete(tblManufacturer OldManufacturer) { ServiceDirectDBEntities objDB = new ServiceDirectDBEntities(); objDB.tblManufacturer.DeleteObject(OldManufacturer); try { objDB.SaveChanges(); return(true); } catch { return(false); } }
public bool Insert(tblManufacturer NewManufacturer) { ServiceDirectDBEntities objDB = new ServiceDirectDBEntities(); try { objDB.tblManufacturer.AddObject(NewManufacturer); objDB.SaveChanges(); return(true); } catch { return(false); } }
public bool Delete(tblManufacturer OldManufacturer) { ServiceDirectDBEntities objDB = new ServiceDirectDBEntities(); objDB.tblManufacturer.DeleteObject(OldManufacturer); try { objDB.SaveChanges(); return true; } catch { return false; } }
public bool Insert(tblManufacturer NewManufacturer) { ServiceDirectDBEntities objDB = new ServiceDirectDBEntities(); try { objDB.tblManufacturer.AddObject(NewManufacturer); objDB.SaveChanges(); return true; } catch { return false; } }
public bool Update(tblManufacturer NewManufacturer) { ServiceDirectDBEntities objDB = new ServiceDirectDBEntities(); tblManufacturer OldManufacturer = objDB.tblManufacturer.First(c => c.MfrID == NewManufacturer.MfrID); try { OldManufacturer.MfrName = NewManufacturer.MfrName; OldManufacturer.MfrType = NewManufacturer.MfrType; objDB.SaveChanges(); return(true); } catch { return(false); } }
public bool Update(tblManufacturer NewManufacturer) { ServiceDirectDBEntities objDB = new ServiceDirectDBEntities(); tblManufacturer OldManufacturer= objDB.tblManufacturer.First(c=>c.MfrID==NewManufacturer.MfrID); try { OldManufacturer.MfrName = NewManufacturer.MfrName; OldManufacturer.MfrType = NewManufacturer.MfrType; objDB.SaveChanges(); return true; } catch { return false; } }
public void remove(tblManufacturer entity) { throw new NotImplementedException(); }
public IEnumerable <tblManufacturer> find(tblManufacturer v) { throw new NotImplementedException(); }
public bool InsertManufac(tblManufacturer manufac) { AddManufacDAL dal = new AddManufacDAL(); return(dal.InsertManufac(manufac)); }