public ActionResult AddSup() { teethLabEntities db = new teethLabEntities(); string name = Request.Form["name"]; supplier sup = new supplier(); sup.name = name; db.suppliers.Add(sup); db.SaveChanges(); return Redirect(Url.Action("Index", "Supplier")); }
public IHttpActionResult Postsupplier(supplier supplier) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.suppliers.Add(supplier); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = supplier.ID }, supplier)); }
public override int ModifyAll(supplier model) { foreach (var item in model.demonstrate) { if (item.did > 0) { IDBSession.IDemonstrate_imageRepository.DelBy(d => d.did == item.did); } } IDBSession.IDemonstrateRepository.DelBy(d => d.itemid == model.sid); idal.ModifyAll(model); return(IDBSession.SaveChanges()); }
public ActionResult Create([Bind(Include = "SupplierID,SupplierName,SupplierAddress,SupplierPhone,SupplierEmail")] supplier supplier) { if (ModelState.IsValid) { db.suppp.Add(supplier); db.SaveChanges(); // return RedirectToAction("Index"); } ModelState.Clear(); ViewBag.Message = supplier.SupplierName + " successfully registered"; return(View()); }
public int Remove(supplier t, out string error) { try { error = "删除成功"; return(dal.Remove(t)); } catch (Exception) { error = "对应外键数据不能直接删除"; } return(0); }
public ActionResult SupplierMaster(supplier supplier) { supplier.StoreName = "FixedAssets"; if (ModelState.IsValid) { db.supplier.Add(supplier); db.SaveChanges(); var data = db.supplier.Where(p => p.StoreName == "FixedAssets").OrderByDescending(p => p.Supplier_Code).ToList(); return(PartialView("~/Areas/Procurement/Views/Shared/_SupplierList.cshtml", data)); } return(View()); }
public JsonResult InsertSupplier(supplier supplier) { var y = db.insertsupplier(supplier.company_name, supplier.company_contact, supplier.company_mail, supplier.company_location); if (y != 0) { return(Json("Added", JsonRequestBehavior.AllowGet)); } else { return(Json("Not added", JsonRequestBehavior.AllowGet)); } }
public void addsupplier(string name, string contactname, string phonenNO, string faxno, string address, string gst) { supplier ac = new supplier(); ac.compName = name; ac.contactName = contactname; ac.phoneNo = phonenNO; ac.faxNo = faxno; ac.address = address; ac.GST_RegistrationNo = gst; ctx.suppliers.Add(ac); ctx.SaveChanges(); }
public int GetSupplierTerm(int?id) { if (id == null) { return(0); } supplier supplier = db.suppliers.Find(id); if (supplier == null || supplier.CreditTermSupplier == null) { return(0); } return(supplier.CreditTermSupplier.CreditTermSupplierId); }
public bool DeleteSupp(int pID) { try { supplier sp = _Coffee.suppliers.Where(t => t.ID.Equals(pID)).FirstOrDefault(); _Coffee.suppliers.DeleteOnSubmit(sp); _Coffee.SubmitChanges(); return(true); } catch { return(false); } }
// Convert From Auto Generated DB Model to APIModel private static SupplierModel ConvertDBSupToAPISup(supplier sup) { SupplierModel sm = new SupplierModel( sup.supid, sup.supname, sup.supemail, sup.supphone, sup.contactname, sup.gstregno, sup.active ); return(sm); }
public IHttpActionResult Getsupplier(string s_email, string s_password) { supplier supp = db.suppliers.Where(adm => adm.s_email.Equals(s_email) && adm.s_password.Equals(s_password)).FirstOrDefault(); if (s_email == null && s_password == null) { return(null); } else { return(Ok(supp)); } }
public ActionResult DeleteConfirmed(int id) { try { supplier supplier = db.supplier.Find(id); db.supplier.Remove(supplier); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception e) { return(RedirectToAction("DeleteUserSuccess", "Home", new { message = e.Message })); } }
public ActionResult delete_supplier(string suppId) { using (var db = new dbsmsEntities()) { if (!String.IsNullOrEmpty(suppId)) { supplier data = db.suppliers.Find(Convert.ToInt64(suppId)); data.status = 0; } db.SaveChanges(); } TempData["success"] = "Your data has been deleted."; return(RedirectToAction("Master_Supplier", "Master")); }
// GET: suppliers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } supplier supplier = db.suppliers.Find(id); if (supplier == null) { return(HttpNotFound()); } return(View(supplier)); }
public void editsupplier(int id, string name, string contactname, string phonenNO, string faxno, string address, string gst) { supplier ac = (from a in ctx.suppliers where a.supplierId == id select a).SingleOrDefault(); ac.compName = name; ac.contactName = contactname; ac.phoneNo = phonenNO; ac.faxNo = faxno; ac.address = address; ac.GST_RegistrationNo = gst; ctx.SaveChanges(); }
// DELETE: odata/suppliers(5) public IHttpActionResult Delete([FromODataUri] int key) { supplier supplier = db.suppliers.Find(key); if (supplier == null) { return(NotFound()); } db.suppliers.Remove(supplier); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Deletesupplier(int id) { supplier supplier = db.suppliers.Find(id); if (supplier == null) { return(NotFound()); } db.suppliers.Remove(supplier); db.SaveChanges(); return(Ok(supplier)); }
// GET: suppliers/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } supplier supplier = await db.suppliers.FindAsync(id); if (supplier == null) { return(HttpNotFound()); } return(View(supplier)); }
private void SaveButton_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { //serviceDA = new DBControllerWSClient(); purchase p = new purchase(); p.state = 1; p.serialCode = txtSerialCode.Text; p.totalPurchase = float.Parse(txtTotal.Text); //para el supplier supplier c = new supplier(); serviceDA = new DBControllerWSClient(); c = serviceDA.querySupplierByCode(txtIdProv.Text); p.supplier = c; //para los purchase lanes purchaseLane[] salelanes; salelanes = new purchaseLane[dgvPurchaseDetails.RowCount - 1]; for (int i = 0; i < dgvPurchaseDetails.RowCount - 1; i++) { purchaseLane purchaselane = new purchaseLane(); purchaselane.subtotal = float.Parse(dgvPurchaseDetails.Rows[i].Cells[4].Value.ToString()); purchaselane.quantity = int.Parse(dgvPurchaseDetails.Rows[i].Cells[3].Value.ToString()); //purchaselane.purchase = p; product pr = new product(); pr = serviceDA.queryProductBySKUCode(dgvPurchaseDetails.Rows[i].Cells[0].Value.ToString()); purchaselane.product = pr; salelanes[i] = purchaselane; } p.currency = "Soles"; p.purchaseLanes = salelanes; //Cursor.Current = Cursors.WaitCursor; int salio = serviceDA.insertPurchase(p); if (salio == 1) { MessageBox.Show("Se ingresó la compra correctamente"); } else { MessageBox.Show("¡Hubo un problema!"); } //Cursor.Current = Cursors.Arrow; this.Close(); } }
public ActionResult editsupplier(long editID, HttpPostedFileBase supply_logo, string company, string contact_name, string type_service, int category, string address, string phone, string email, string supplier_from, string web_page, int status) { try { supplier supplier = entities.suppliers.Find(editID); if (supply_logo != null && supply_logo.ContentLength > 0) { var fileName = Path.GetFileName(supply_logo.FileName); if (!Directory.Exists(Path.Combine(Server.MapPath("~/"), "Upload"))) { Directory.CreateDirectory(Path.Combine(Server.MapPath("~/"), "Upload")); } if (!Directory.Exists(Path.Combine(Server.MapPath("~/Upload/"), "Supplier_Logo"))) { Directory.CreateDirectory(Path.Combine(Server.MapPath("~/Upload/"), "Supplier_Logo")); } var path = Path.Combine(Server.MapPath("~/Upload/Supplier_Logo"), fileName); supply_logo.SaveAs(path); supplier.logo = fileName; } supplier.company = company; supplier.contact_name = contact_name; supplier.type_service = type_service; supplier.category_id = category; supplier.address = address; supplier.phone = phone; supplier.email = email; supplier.status = status; supplier.supplier_from = DateTime.ParseExact(supplier_from, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture); supplier.web_page = web_page; entities.SaveChanges(); return(Redirect(Url.Action("listado", "suplidores", new { area = "webmaster" }))); } catch (Exception ex) { return(Redirect(Url.Action("editar", "suplidores", new { area = "webmaster", exception = ex.Message }))); } }
public JsonResult delete_supplier(int id) { try { supplier s = DB.supplier.Where(x => x.id == id).Single(); DB.supplier.Remove(s); DB.SaveChanges(); return(Json(new { msg = "تمت حذف المورد بنجاح" })); } catch { return(Json(new { msg = "لم تتم عمليه الحذف .. حاول مره اخري" })); } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { supplier s = new supplier(); s = (supplier)Session["supplier"]; int k = Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text); SupplieritemMix sup = new SupplieritemMix(); sup = clerk.showsingleitem(k, s.supplierId); ItemDescription.Text = sup.Itemdescription; ItemCode.Text = sup.itemid.ToString(); ExisitingPricer.Text = sup.price.ToString(); Unit.Text = sup.Unit.ToString(); ClientScript.RegisterStartupScript(this.GetType(), "SayHello2", "$('#exampleModal').modal({})", true); }
private void button1_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable("table"); dt.Columns.Add("退款日期", typeof(string)); dt.Columns.Add("单据号", typeof(string)); dt.Columns.Add("退款金额", typeof(string)); dt.Columns.Add("结算方式", typeof(string)); dt.Columns.Add("备注", typeof(string)); dt.Columns.Add("供应商", typeof(string)); ZijinDao p = new ZijinDao(); List <Tuikuan> ps = new List <Tuikuan>(); if (comboBox1.Text == "") { ps = p.selectTuikuan_date(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text)); Console.Write("寇肖萌"); } if (comboBox1.Text != "") { string[] suppliername = comboBox1.Text.Split(' '); ps = p.selectTuikuan_dateandkehuname(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text), suppliername[0]); } foreach (Tuikuan tui in ps) { supplier s1 = new supplier(); supplierdao sdao = new supplierdao(); Console.WriteLine(tui.Tuikuan_suppliernumber); s1 = sdao.selectNumber(tui.Tuikuan_suppliernumber); Console.WriteLine(tui.Tuikuan_money); Console.WriteLine(tui.Tuikuan_way); Console.WriteLine(tui.Mark); Console.WriteLine(s1.Supplier_name); Console.WriteLine(tui.Date); Console.WriteLine(tui.Tuikuan_danjuid); dt.Rows.Add(tui.Date, tui.Tuikuan_danjuid, tui.Tuikuan_money, tui.Tuikuan_way, tui.Mark, s1.Supplier_name); } dataGridView1.DataSource = dt; } catch (SystemException) { MessageBox.Show("操作不当"); } }
//use object of type customer to get value from formview // the value will be bound to customer automaticlly // or you can use the method TryUpdateMedel to populate your model public void FormView1_InsertItem(supplier supplier) { using (SupplierDBModel context = new SupplierDBModel()) { //Customer customer=new Customer() //TryUpdateModel(customer) if (ModelState.IsValid) { supplier.webstatus = "Invited To Portal"; context.suppliers.Add(supplier); context.SaveChanges(); } } }
public ActionResult Create(supplier sup) { try { using (invtModel) { invtModel.suppliers.Add(sup); invtModel.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } supplier supplier = db.suppliers.Find(id); if (supplier == null) { return(HttpNotFound()); } ViewBag.CreditTermSupplierId = new SelectList(db.CreditTermSuppliers, "CreditTermSupplierId", "Name", supplier.CreditTermSupplierId); ViewBag.PaymentMoodSupplierId = new SelectList(db.PaymentMoodSuppliers, "PaymentMoodSupplierId", "Name", supplier.PaymentMoodSupplierId); return(View(supplier)); }
public List <supplier> SelectAll() { var car = pEntity.ref_supplier_SelectAll(); List <supplier> ls = new List <supplier>(); foreach (ref_supplier_SelectAll_Result c in car) { supplier result = new supplier(); result.supplier_id = c.supplier_id; result.Supplier_name = c.Supplier_name; result.Supplier_address = c.Supplier_address; result.Supplier_contact = c.Supplier_contact; ls.Add(result); } return(ls); }
public bool DeleteSupplier(long supplier_id, long updated_by) { try { supplier oSupplier = _entities.suppliers.FirstOrDefault(c => c.supplier_id == supplier_id); oSupplier.is_deleted = true; oSupplier.updated_by = updated_by; oSupplier.updated_date = DateTime.Now; _entities.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public ActionResult Page5() { customer1 cust1 = new customer1() { CustomerID = 1, CustomerName = "Shaik", Email = "*****@*****.**" }; supplier supp1 = new supplier() { SupplierID = 1, SupplierName = "Binladen", OrderID = 6363 }; CustomerAndSupplierViewModel cs1 = new CustomerAndSupplierViewModel { cust = cust1, supp = supp1 }; return(View(cs1)); }
public ActionResult editar(long?editID) { if (Session["USER_ID"] != null) { if (editID != null) { List <category> listC = entities.categories.ToList(); if (listC.Count > 0) { supplier editSupplier = entities.suppliers.Find(editID); if (editSupplier != null) { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); editarSuplidoresViewModel viewModel = new editarSuplidoresViewModel(); viewModel.side_menu = "suplidores"; viewModel.side_sub_menu = "supplier_directory"; viewModel.editSupplier = editSupplier; viewModel.categoryList = entities.categories.ToList(); viewModel.curUser = curUser; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); return(View(viewModel)); } else { return(Redirect(Url.Action("listado", "suplidores", new { area = "webmaster", Error = "No existe ese elemento" }))); } } else { return(Redirect(Url.Action("listado", "suplidores", new { area = "webmaster", Error = "Se necesita crear una categoria para editar suplidores" }))); } } else { return(Redirect(Url.Action("listado", "suplidores", new { area = "webmaster" }))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
//modify in 3/11 public void selectAddNewSupplier(string supplierId, string supplierName, string contact, string phone, string fax, string Address) { supplier s = new supplier(); s.address = Address; s.contactName = contact; s.name = supplierName; s.supplierId = supplierId; s.phoneNo = Convert.ToDecimal(phone); s.faxNo = Convert.ToDecimal(fax); s.status = "Active"; supplierFacade.createSupplier_Lingna(s); List<item> items = catalogueFacade.getItems_Lingna(); foreach (item i in items) { supplierPrice sp = new supplierPrice(); sp.supplierId = supplierId; sp.itemId = i.itemId; sp.price = 0; supplierFacade.createSupplierPrice_Lingna(sp); } }
public void updateSupplier_Lingna(supplier s) { ctx.Entry(s).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); }
public void createSupplier_Lingna(supplier s) { ctx.suppliers.Add(s); ctx.SaveChanges(); }