public ActionResult Suppliers() { List <Supplier> suppliers = new SupplierDAO().GetAllSuppliers(); ViewData["Suppliers"] = suppliers; return(View()); }
public ActionResult AddSupplier(Supplier supplier) { SupplierDAO suppDAO = new SupplierDAO(); bool saved = false; //string duplicateMsg = "supplier ID already exist"; Supplier existingSupp = suppDAO.FindSupplierById(supplier.Id); if (supplier.Id == existingSupp.Id) { SetFlash(Enums.FlashMessageType.Error, "Supplier information for supplier name: " + supplier.Name + " was not added due to duplicate Supplier ID: " + supplier.Id + "."); return(RedirectToAction("Suppliers")); } else if (supplier.Id != existingSupp.Id) { saved = suppDAO.AddSupplier(supplier); if (saved) { SetFlash(Enums.FlashMessageType.Success, "Supplier record for Supplier ID: " + supplier.Id + " successfully added!"); return(RedirectToAction("Suppliers")); } SetFlash(Enums.FlashMessageType.Error, "Failed to add supplier record for Supplier ID: " + supplier.Id + "."); return(RedirectToAction("Suppliers")); } else { SetFlash(Enums.FlashMessageType.Error, "Supplier record for Supplier ID: " + supplier.Id + " not saved."); return(RedirectToAction("Suppliers")); } }
/// <summary> /// Displays supplier information to the user. /// </summary> /// <param name="supplyInfo"></param> static void DisplaySuppliers(List <SupplierDO> items) { string currentMethod = "DisplaySuppliers"; try { //Prints all rows. if (items.Count > 0) { for (int i = 0; i < items.Count; i++) { Console.WriteLine(new string('-', 80)); Console.WriteLine($"SupplierID: { items[i].SupplierId}---| Name: {items[i].ContactName} | Title: " + $"{ items[i].ContactTitle}\n Postal Code: { items[i].PostalCode} | Country: " + $"{items[i].Country} | Phone number: {items[i].PhoneNumber}"); } } Console.WriteLine("\n\t\t\tPress any key to continue."); Console.ReadKey(); } catch (Exception ex) { string currentClass = "Program"; SupplierDAO supplierDAO = new SupplierDAO(); //Prints error to console, logs, and restarts the menu. supplierDAO.SupplierErrorHandler(ex, currentClass, currentMethod, ex.StackTrace); throw ex; } }
public FrmSuppData() { InitializeComponent(); dao = new SupplierDAO(Setting.GetConnectionString()); this.dgvSuppData.AutoGenerateColumns = false; }
public InformationWareHouse() { this._ingredientDAO = (IngredientDAO) new IngredientDAOImpl(); this._supplierDAO = (SupplierDAO) new SupplierDAOImpl(); this._receiptDAO = (ReceiptDAO) new ReceiptDAOImpl(); this._receiptDetailDAO = (ReceiptDetailDAO) new ReceiptDetailDAOImpl(); }
public string InsertSupplier(Supplier aSupplier) { SupplierDAO aDao = new SupplierDAO(); string sr = aDao.InsertSupplier(aSupplier); return(sr); }
private void btnXoa_Click(object sender, EventArgs e) { if (btnXoa.Text == "Xóa") { DialogResult rs = MessageBox.Show("Bạn có chắc chắn muốn xóa ?", "Thông báo", MessageBoxButtons.YesNo); if (rs == DialogResult.Yes) { long Emp_ID = Convert.ToInt32(grv_NCC.GetFocusedRowCellValue("ID")); bool result = new SupplierDAO().Delete_Supplier(Emp_ID); if (result) { MessageBox.Show("Xóa nhà cung cấp thành công"); Disable_Control(); Load_dgr_NCC(); } else { MessageBox.Show("Có lỗi xảy ra"); } } } if (btnXoa.Text == "Hủy") { btnThem.Text = "Thêm"; btnSua.Text = "Sửa"; btnXoa.Text = "Xóa"; Disable_Control(); Load_dgr_NCC(); } }
private void LoadData() { SupplierDAO SupplierDAO = new SupplierDAO(); List <string> listNCC = SupplierDAO.ListAll().Select(x => x.mancc).ToList(); cbSupplier.DataSource = listNCC; }
public FrmReportIN() { InitializeComponent(); _suppDAO = new SupplierDAO(Setting.GetConnectionString()); _transDAO = new TransactionDAO(Setting.GetConnectionString()); }
private void frmInsertOrUpdateProduct_Load(object sender, EventArgs e) { DataTable dt = new SupplierDAO().GetAllData(); cboSupplier.DataSource = dt; cboSupplier.DisplayMember = "Name"; cboSupplier.ValueMember = "Id"; }
public List <Supplier> GetAllSupplier() { List <Supplier> aList = new List <Supplier>(); SupplierDAO aDao = new SupplierDAO(); aList = aDao.GetAllSupplier(); return(aList); }
protected void SearchBind() { List <Supplier> supplierList = new List <Supplier>(); supplierList = SupplierDAO.SearchSupplier(txtSuppName.Text, txtCompany.Text, txtTitle.Text, txtCity.Text, txtCountry.Text, txtPhone.Text, txtFax.Text); grdSupplier.DataSource = supplierList; grdSupplier.DataBind(); }
private void btnSuppliers_Click(object sender, EventArgs e) { SupplierDAO dao = new SupplierDAO(); List <Suppliers> list = dao.getAllSuppliers(); dgvAll.DataSource = list; menu = 2; }
public BillController(SneakerStoreContext context) { this.context = context; importBillDao = new ImportBillDAO(context); exportBillDao = new ExportBillDAO(context); supplierDao = new SupplierDAO(context); shoesDao = new ShoesDAO(context); }
/*** FINE CLICK EVENT ***/ /******* HELPERS *******/ protected void BindGrid() { List <Supplier> supplierList = new List <Supplier>(); supplierList = SupplierDAO.GetSupplierList(); grdSupplier.DataSource = supplierList; grdSupplier.DataBind(); }
public void XoaThanhCongNCC()//Test pass { SupplierDAO u = new SupplierDAO(); double expected = 1; double actual = u.Delete("Mã NCC"); Assert.AreEqual(expected, actual); }
public void XoaKhongNhapMaNCC()//Test pass { SupplierDAO u = new SupplierDAO(); double expected = -1; double actual = u.Delete(""); Assert.AreEqual(expected, actual); }
public Supplier GetSupplierByid(int toInt32) { SupplierDAO aDao = new SupplierDAO(); Supplier aSupplier = new Supplier(); aSupplier = aDao.GetSupplierByid(toInt32); return(aSupplier); }
//CONSTRUCTOR public SupplierController() { _ConnectionString = ConfigurationManager.ConnectionStrings["dataSource"].ConnectionString; string relativePath = ConfigurationManager.AppSettings["logPath"]; _LogPath = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~"), relativePath); _SupplierDAO = new SupplierDAO(_ConnectionString, _LogPath); _ProductDAO = new ProductDAO(_ConnectionString, _LogPath); }
public ActionResult EditSupplier(Supplier supp) { SupplierDAO suppDAO = new SupplierDAO(); Supplier supplier = suppDAO.EditSupplier(supp.Id); ViewData["supplier"] = supplier; return(View()); }
public ActionResult ViewBySupplier(string supID) { PhoneDAO dao = new PhoneDAO(); SupplierDAO daoSup = new SupplierDAO(); Session["MANAGE"] = "Shop"; ViewData["SUPPLIER"] = daoSup.GetSupplier(supID); ViewData["PHONE"] = dao.GetAllCurrentPhoneBySup(supID); return(View("Index")); }
// GET: Home public ActionResult Index() { PhoneDAO dao = new PhoneDAO(); SupplierDAO daoSup = new SupplierDAO(); ViewData["PHONE"] = dao.GetLastestPhone(); ViewData["SUPPLIER"] = daoSup.GetAllSupplier(); Session["MANAGE"] = "Home"; return(View()); }
public void ThemChiNhapMaNCCVaTenNCC()//pass { SupplierDAO u = new SupplierDAO(); ncc1 = new Supplier("MNCC", "Tên NCC", ""); double expected = 1; double actual = u.Add(ncc1); Assert.AreEqual(expected, actual); }
public void ThemChiNhapDiaChi()//fail { SupplierDAO u = new SupplierDAO(); ncc1 = new Supplier("", "", "ĐịaChỉ"); double expected = -1; double actual = u.Add(ncc1); Assert.AreEqual(expected, actual); }
public void ThemNCCThanhCong()//pass { SupplierDAO u = new SupplierDAO(); ncc1 = new Supplier("Mã NCC", "Tên NCC", "Địa Chỉ"); double expected = 1; double actual = u.Add(ncc1); Assert.AreEqual(expected, actual); }
public void SuaKhongNhapMaNCC() { SupplierDAO u = new SupplierDAO();//pass ncc2 = new Supplier("", "Suntory Pepsico", "Lầu 51, Cao Ốc Sheraton, 88 Đồng Khởi, Q. 2 "); double expected = -1; double actual = u.Update(ncc2); Assert.AreEqual(expected, actual); }
public void SuaTenNCC() { SupplierDAO u = new SupplierDAO();//pass ncc2 = new Supplier("Pepsico", "Suntory Pepsicoo", "Lầu 5, Cao Ốc Sheraton, 88 Đồng Khởi, Q. 1 "); double expected = 1; double actual = u.Update(ncc2); Assert.AreEqual(expected, actual); }
// create the method to view all suppliers public List <SupplierDAO> ViewAllSuppliers() { // create a new instance of supplierDOA that is a list List <SupplierDAO> supplierList = new List <SupplierDAO>(); // create try catch to catch any possible errors try { // create a using statment to use the connection string using (SqlConnection _Connection = new SqlConnection(connectionString)) { // create using statment to specify the stored procedure using (SqlCommand _Command = new SqlCommand("sp_SupplierViewAllSuppliers", _Connection)) { // specify the command is a stored procedure _Command.CommandType = System.Data.CommandType.StoredProcedure; // open the connection _Connection.Open(); // create a using statement using the reader to reader through the list using (SqlDataReader _Reader = _Command.ExecuteReader()) { // create a while loop to read throught the whole record while (_Reader.Read()) { // create a new instance of SupplierDOA to retrieve each item SupplierDAO supplierToList = new SupplierDAO(); // get the product elements supplierToList.supplierID = Convert.ToInt32(_Reader["supplierID"]); supplierToList.supplierName = (String)_Reader["supplierName"]; supplierToList.supplierAddress = (String)_Reader["supplierAddress"]; supplierToList.supplierCity = (String)_Reader["supplierCity"]; supplierToList.supplierState = (String)_Reader["supplierState"]; supplierToList.supplierZip = Convert.ToInt32(_Reader["supplierZip"]); supplierToList.supplierPhoneNumber = (String)_Reader["supplierPhoneNumber"]; // return the info in a complete list supplierList.Add(supplierToList); } } //close the connection _Connection.Close(); } } } //pass the error message catch (Exception error) { // call the error method and pass the error ErrorMessage.logger(error); } // return the list return(supplierList); }
public ActionResult ViewUpdate(string phoneID) { SupplierDAO dao = new SupplierDAO(); PhotoPhoneDAO daoPhoto = new PhotoPhoneDAO(); PhoneDAO daoPhone = new PhoneDAO(); ViewData["SUPPLIER_LIST"] = dao.GetAllSupplier(); ViewData["UPDATE"] = daoPhone.GetPhone(phoneID); ViewData["PHOTO"] = daoPhoto.GetPhotoOfPhone(phoneID); return(View()); }
public FrmTransaction(bool itemOUT) { InitializeComponent(); _itemDAO = new ItemDAO(Setting.GetConnectionString()); _suppDAO = new SupplierDAO(Setting.GetConnectionString()); _transDAO = new TransactionDAO(Setting.GetConnectionString()); _custDAO = new CustomerDAO(Setting.GetConnectionString()); this.dgvItemData.AutoGenerateColumns = false; _itemOUT = itemOUT; }
public List<SupplierDAO> GetSupplier() { List<SupplierDAO> list = new List<SupplierDAO>(); try { using ( I4IDBEntities context = new I4IDBEntities()) { SupplierDAO obj = new SupplierDAO(); //var data= context.Suppliers ; var data = context.RegisterUsers.Where(u => u.UserRole == "S"); //var data=from sup in context.Suppliers join forwQry in context.ForwardQueries on sup.; foreach(RegisterUser item in data) { list.Add(new SupplierDAO {Id=item.Id,Company=item.Company +"-" +item.UserFirstName +" " +item.UserLastName }); } } } catch { } return list; }