public async Task <ActionResult> DeleteConfirmed(int id) { T_Supplier t_Supplier = await db.T_Supplier.FindAsync(id); db.T_Supplier.Remove(t_Supplier); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "SupplierID,SupplierName,Address,PhoneNo,Balance,IsRemoved,IUser,EUser,IDate,EDate")] T_Supplier t_Supplier) { if (ModelState.IsValid) { db.Entry(t_Supplier).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(t_Supplier)); }
// GET: T_Supplier/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_Supplier t_Supplier = await db.T_Supplier.FindAsync(id); if (t_Supplier == null) { return(HttpNotFound()); } return(View(t_Supplier)); }
/// <summary> /// 供应商编辑查询 /// </summary> /// <param name=""></param> /// <returns></returns> public static T_Supplier SupplierEditSelect(int SupplierID) { string sql = string.Format("select * from T_Supplier where SupplierID={0}", SupplierID); var db = DBHelper.Read(sql); T_Supplier supplier = new T_Supplier { SupplierName = db.Rows[0]["SupplierName"].ToString(), LinkMan = db.Rows[0]["LinkMan"].ToString(), Mobile = db.Rows[0]["Mobile"].ToString(), Address = db.Rows[0]["Address"].ToString(), Status = Convert.ToInt32(db.Rows[0]["Status"].ToString()), }; return(supplier); }
/// <summary> /// 查询供应商 /// </summary> /// <returns></returns> public static List <T_Supplier> SupplierSelect() { string sql = string.Format("select * from T_Supplier"); var db = DBHelper.Read(sql); List <T_Supplier> lst = new List <T_Supplier>(); foreach (DataRow item in db.Rows) { T_Supplier supplier = new T_Supplier { SupplierID = Convert.ToInt32(item["SupplierID"].ToString()), SupplierName = item["SupplierName"].ToString(), Status = Convert.ToInt32(item["Status"].ToString()) }; lst.Add(supplier); } return(lst); }
/// <summary> /// 新增供应商 /// </summary> private void SupplierAdd() { T_Supplier supplier = new T_Supplier { SupplierName = HttpContext.Current.Request.Form["SupplierName"].ToString(), LinkMan = HttpContext.Current.Request.Form["LinkMan"].ToString(), Address = HttpContext.Current.Request.Form["Address"].ToString(), Mobile = HttpContext.Current.Request.Form["Mobile"].ToString(), Status = Convert.ToInt32(HttpContext.Current.Request.Form["Status"]) }; var obj = new { status = 200, msg = "no" }; if (supplierBll.SupplierAdd(supplier)) { obj = new { status = 201, msg = "yes" }; } JavaScriptSerializer js = new JavaScriptSerializer(); string str = js.Serialize(obj); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
public static T_SupplierModel DTO(this T_Supplier node) { if (node == null) { return(null); } var model = new T_SupplierModel() { Id = node.Id, COGS = node.COGS, COGS2 = node.COGS2, CategoryId = node.CategoryId, Company = node.Company, Rebates = node.Rebates, Cycle = node.Cycle, Contact = node.Contact, Hp = node.Hp, Tel = node.Tel, Tel2 = node.Tel2, Fax = node.Fax, Fax2 = node.Fax2, Email = node.Email, Remark = node.Remark, BankName = node.BankName, BankCode = node.BankCode, BankNumber = node.BankNumber, Collect = node.Collect, Category = node.Category != null ? node.Category.Name:null, Parent_CategoryId = node.Category != null ? (node.Category.ParSysList != null ? node.Category.ParSysList.Id : 0) : 0, Parent_Category = node.Category != null ? (node.Category.ParSysList != null ? node.Category.ParSysList.Name : null) : null, }; return(model); }
/// <summary> /// 查询供应商表 /// </summary> /// <param name="">供应商名称</param> /// <returns></returns> public static object SupplierSelect(string supplierName, int page, int limit) { string sql = string.Format("select * from (select ROW_NUMBER() OVER(ORDER BY SupplierID desc) as row,* from T_Supplier) as o where SupplierName like '%{0}%'", supplierName); string sqlpages = sql + string.Format(" and o.row between ({0}-1)*{1}+1 and {2}*{3}", page, limit, page, limit); //总查询记录 var supplierTabCount = DBHelper.Read(sql).Rows.Count; //分页后查询数据 var supplierTabPage = DBHelper.Read(sqlpages); List <T_Supplier> supplierlst = new List <T_Supplier>(); foreach (DataRow item in supplierTabPage.Rows) { T_Supplier supplier = new T_Supplier { SupplierID = Convert.ToInt32(item["SupplierID"].ToString()), SupplierName = item["SupplierName"].ToString(), Address = item["Address"].ToString(), LinkMan = item["LinkMan"].ToString(), Mobile = item["Mobile"].ToString(), Status = Convert.ToInt32(item["Status"].ToString()) }; supplierlst.Add(supplier); } //定义匿名类型 接受供应商总数用于分页 var obj = new { status = supplierTabCount, lst = supplierlst }; return(obj); }
/// <summary> /// 供应商新增 /// </summary> /// <param name=""></param> /// <returns></returns> public static bool SupplierAdd(T_Supplier supplier) { return(supplierDal.SupplierAdd(supplier)); }
/// <summary> /// 供应商信息修改 /// </summary> /// <param name=""></param> /// <returns></returns> public static bool SupplierEdit(T_Supplier supplier) { return(supplierDal.SupplierEdit(supplier)); }
public SupplierDTO Add(SupplierDTO supplier) { T_Supplier FruitResult = _dal.Insert <T_Supplier>(Mapper.Map <T_Supplier>(supplier)); return(Mapper.Map <SupplierDTO>(FruitResult)); }
/// <summary> /// 供应商信息修改 /// </summary> /// <param name=""></param> /// <returns></returns> public static bool SupplierEdit(T_Supplier supplier) { string sql = string.Format("update T_Supplier SET SupplierName='{0}',LinkMan='{1}',Mobile='{2}',[Address]='{3}',[Status]='{4}' where SupplierID={5}", supplier.SupplierName, supplier.LinkMan, supplier.Mobile, supplier.Address, supplier.Status, supplier.SupplierID); return(DBHelper.Write(sql)); }
/// <summary> /// 供应商新增 /// </summary> /// <param name=""></param> /// <returns></returns> public static bool SupplierAdd(T_Supplier supplier) { string sql = string.Format("insert T_Supplier(SupplierName,[LinkMan],[Mobile],[Address],[Status]) values('{0}','{1}','{2}','{3}','{4}')", supplier.SupplierName, supplier.LinkMan, supplier.Mobile, supplier.Address, supplier.Status); return(DBHelper.Write(sql)); }