public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion //DataSet ds = new DataSet(); //StringBuilder strWhere = new StringBuilder(); //if (txtKeyword.Text.Trim() != "") //{ // #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称 // //strWhere.AppendFormat("keywordField like '%{0}%'", txtKeyword.Text.Trim()); //} //ds = bll.GetList(strWhere.ToString()); //gridView.DataSource = ds; //gridView.DataBind(); DataSet ds = new BLL.Product().GetListFromView(AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, GetComm()); AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]); gridView.DataSource = ds; gridView.DataBind(); }
public static List <Product> ToList(BLL.Product v) { List <Product> list = new List <Product>(); while (!v.EOF) { Product t = new Product(); if (!v.IsColumnNull("ID")) { t.ID = v.ID; } if (!v.IsColumnNull("Name")) { t.Name = v.IIN; } if (!v.IsColumnNull("TypeID")) { t.TypeID = v.TypeID; } list.Add(t); v.MoveNext(); } return(list); }
protected void AspNetPager1_PageChanged(object sender, EventArgs e) { DataSet ds = new BLL.Product().GetListFromView(AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, GetComm()); Repeater1.DataSource = ds; Repeater1.DataBind(); }
private void Bind() { if (!string.IsNullOrEmpty(nId)) { if (bll == null) { bll = new BLL.Product(); } Model.Product model = bll.GetModel(nId); if (model != null) { ListItem li = null; li = ddlCategory.Items.FindByValue(model.CategoryId); if (li != null) { li.Selected = true; } txtProductName.Value = model.ProductName; txtSubtitle.Value = model.Subtitle; txtPrice.Value = model.ProductPrice.ToString(); txtPNum.Value = model.PNum; txtStockNum.Value = model.StockNum.ToString(); txtMarketPrice.Value = model.MarketPrice.ToString(); txtPayOptions.Value = model.PayOptions; hCustomAttrs.Value = model.CustomAttrs; hEditor1.Value = model.Descr; //商品图片 hPImagMain.Value = model.MainImage; hUploadify.Value = model.ImagesAppend; ViewState["ProductModel"] = model; } } }
public static void SaveList(List <HCMIS.Desktop.DirectoryServices.Product> list) { BLL.Product bv = new BLL.Product(); foreach (HCMIS.Desktop.DirectoryServices.Product v in list) { // try to load by primary key bv.LoadByPrimaryKey(v.ID.Value); // if the entry doesn't exist, create it if (bv.RowCount == 0) { bv.AddNew(); } // populate the contents of v on the to the database list if (v.ID.HasValue) { bv.ID = v.ID.Value; } if (v.Name != "" && v.Name != null) { bv.IIN = v.Name; } if (v.TypeID.HasValue) { bv.TypeID = v.TypeID.Value; } bv.Save(); } }
public static List <Model.ProductInfo> GetProducts(int pageIndex, int pageSize, out int totalCount) { BLL.Product bll = new BLL.Product(); totalCount = 0; if (!enableCaching) { return(bll.GetProducts(pageIndex, pageSize, out totalCount, "", "", null)); } string key = string.Format("product_get_{0}_{1}", pageIndex, pageSize); string keyCount = string.Format("product_getCount_{0}_{1}", pageIndex, pageSize); List <Model.ProductInfo> data = (List <Model.ProductInfo>)HttpRuntime.Cache[key]; object obj = HttpRuntime.Cache[keyCount]; if (obj != null) { totalCount = (int)obj; } if (data == null) { data = bll.GetProducts(pageIndex, pageSize, out totalCount, "", "", null); AggregateCacheDependency cd = DependencyFactory.GetProductDependency(); HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(productTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null); HttpRuntime.Cache.Add(keyCount, totalCount, null, DateTime.Now.AddHours(productTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null); } return(data); }
public ActionResult CUD(Products newProduct, string CreateBtn, string UpdateBtn, string DeleteBtn) { Products Producto; //var Proxy = new Proxy(); var Proxy = new BLL.Product(); ActionResult Result = View(); if (CreateBtn != null) { Producto = Proxy.Create(newProduct); if (Producto != null) { Result = RedirectToAction("CUD", new { id = Producto.ProductID }); } } else if (UpdateBtn != null) //modificacion de producto { var IsUpdate = Proxy.Update(newProduct); if (IsUpdate) { Result = Content("El producto se ha actualizado"); } } else if (DeleteBtn != null) //eliminar producto { var DeletedProduct = Proxy.Delete(newProduct.ProductID); if (DeletedProduct) { Result = Content("El producto se ha eliminado"); } } return(Result); }
public ActionResult Index(int id) { //aqui para obtener productos de la categoria var Proxy = new BLL.Product(); var Products = Proxy.FilterByCategoryID(id); return(View("ProductList", Products)); }
public ActionResult Details(int id) { //var Proxy = new Proxy(); var Proxy = new BLL.Product(); var Model = Proxy.RetrieveById(id); return(View(Model)); }
protected void xiajia(string[] strArr) { bool result = new BLL.Product().UpdateProduteState(strArr); Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", result ? "下架成功" : "下架失败")); Response.End(); }
protected void Button1_Click(object sender, EventArgs e) { DataSet ds = new BLL.Product().GetAllList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Model.Product mo = new BLL.Product().GetModel(Convert.ToInt32(ds.Tables[0].Rows[i]["Product_ID"])); } }
protected void Button1_Click(object sender, EventArgs e) { DataSet ds = new BLL.Product().GetListFromView(AspNetPager1.PageSize, 1, GetComm()); AspNetPager1.CurrentPageIndex = 1; AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]); Repeater1.DataSource = ds; Repeater1.DataBind(); }
protected void EnterAgain()//重新入库 { //Model.Sale ml_sale = bll_sale.GetModel(Convert.ToInt32(Request.Params["Sale_ID"])); Model.EnterStock ml_es = bl_es.GetModel(EnterStock_ID); ml_es.StoreHouse_ID = Convert.ToInt32(DropDownList1.SelectedValue); bl_es.Update(ml_es); //ml_sale.GatheringWay = this.DropDownList6.SelectedItem.Text; //ml_sale.Account = this.DropDownList4.SelectedItem.Text; //ml_sale.Address = this.TextBox1.Text; //ml_sale.Customer = Convert.ToInt32(DropDownList5.SelectedValue); //bll_sale.Update(ml_sale); string Ids = this.newId.Value.Replace(" ", "").Replace("\r\n", ""); string Qtys = this.newQty.Value.Replace(" ", "").Replace("\r\n", ""); string Prices = this.newPrice.Value.Replace(" ", "").Replace("\r\n", ""); string[] ArrIds = Ids.Split(new char[] { '|' }); string[] ArrQty = Qtys.Split(new char[] { '|' }); string[] ArrPri = Prices.Split(new char[] { '|' }); for (int i = 0; i < ArrIds.Length - 1; i++) { Model.EnterStock_Detail ml_esd = new ZhangWei.Model.EnterStock_Detail(); ml_esd.EnterStock_ID = EnterStock_ID; ml_esd.Product_ID = Convert.ToInt32(ArrIds[i]); ml_esd.Quantity = Convert.ToDecimal(ArrQty[i]); ml_esd.Price = Convert.ToDecimal(ArrPri[i]); BLL.Sale_Detail bl_sd = new ZhangWei.BLL.Sale_Detail(); //ml_sa.Sale_ID = Convert.ToInt32(Request.Params["Sale_ID"]); //ml_sa.Product_ID = Convert.ToInt32(ArrIds[i]); //ml_sa.SaleOrder_ID = 0; //ml_sa.Quantity = Convert.ToDecimal(ArrQty[i]); //ml_sa.Price = Convert.ToDecimal(ArrPri[i]); Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList1.SelectedValue)); BLL.StockPile bl_sp = new ZhangWei.BLL.StockPile(); if (ml_sp == null) { Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i])); ml_sp = new ZhangWei.Model.StockPile(); ml_sp.Product_ID = Convert.ToInt32(ArrIds[i]); ml_sp.Dept_ID = 1; ml_sp.FirstEnterDate = DateTime.Now; ml_sp.LastLeaveDate = DateTime.Now; ml_sp.Price = Convert.ToDecimal(ArrPri[i]); ml_sp.Quantity = 0; ml_sp.StoreHouse_ID = Convert.ToInt32(DropDownList1.SelectedValue); ml_sp.Quantity += Convert.ToDecimal(ArrQty[i]); bl_sp.Add(ml_sp); } else { ml_sp.Quantity += Convert.ToDecimal(ArrQty[i]); //ml_sp.LastLeaveDate = DateTime.Now; bl_sp.Update(ml_sp); } bl_esd.Add(ml_esd); } }
protected void delByIds(string[] strArr) { string result = new BLL.Product().Delete(strArr).ToString(); Response.Clear(); if (result == "0") Response.Write(UtilsCommons.AjaxReturnJson("0", "删除失败")); if (result == "1") Response.Write(UtilsCommons.AjaxReturnJson("1", "删除成功")); if (result == "-1") Response.Write(UtilsCommons.AjaxReturnJson("0", "产品下有订单存在,删除失败")); Response.End(); }
public ActionResult CUD(int id = 0) { var Proxy = new BLL.Product(); var Model = new Products(); if (id != 0) { Model = Proxy.RetrieveById(id); } return(View(Model)); }
//获得图片名字 public string GetImageName(HttpContext context) { long ID = context.Request["lbID"] == "undefined" ? 0 : Convert.ToInt64(context.Request["lbID"]); if (ID == 0) { return(""); } DataSet ds = new DataSet(); ds = new BLL.Product().GetDataSetByProc(ID); return(ds.Tables[0].Rows[0]["Image"].ToString()); }
//上传图片 public void Upload(HttpContext context) { try { HttpPostedFile file; string fileName = string.Empty; string action = context.Request["isAdd"].ToString(); string result = string.Empty; long ID = 0; Model.Product model = new Model.Product(); DataSet ds = new DataSet(); if (action != "add") { ID = Convert.ToInt64(context.Request["lbID"]); } for (int i = 0; i < context.Request.Files.Count; ++i) { file = context.Request.Files[i]; if (file == null || file.ContentLength == 0 || string.IsNullOrEmpty(file.FileName)) { continue; } file.SaveAs(HttpContext.Current.Server.MapPath("../ProductPic/" + Path.GetFileName(file.FileName))); fileName = file.FileName; if (action != "add") { model.ID = ID; model.UpdateUser = Convert.ToString(((Model.BaseUser)context.Session["login"]).UserID); model.UpdateDate = DateTime.Now; model.Image = file.FileName; ds = new BLL.Product().UpdateImageByProc(model); result = ds.Tables[0].Rows[0][0].ToString(); } result = fileName; context.Response.Write(result); } } catch (Exception ex) { context.Response.StatusCode = 500; context.Response.Write(ex.Message); context.Response.End(); } finally { context.Response.End(); } }
private void Bind() { //查询条件 GetSearchItem(); if (pBll == null) { pBll = new BLL.Product(); } int totalCount = 0; rpData.DataSource = pBll.GetDataSet(1, 1, out totalCount, sqlWhere, parms == null ? null : parms.ToArray()); rpData.DataBind(); }
public static void DeleteList(List <int> list) { BLL.Product bv = new BLL.Product(); foreach (int v in list) { // try to load by primary key bv.LoadByPrimaryKey(v); // if the entry doesn't exist, create it if (bv.RowCount > 0) { bv.MarkAsDeleted(); bv.Save(); } // populate the contents of v on the to the database list } }
private void Bind() { //查询条件 GetSearchItem(); int totalCount = 0; if (bll == null) { bll = new BLL.Product(); } rpData.DataSource = bll.GetDataSet(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount, sqlWhere, parms == null ? null : parms.ToArray());; rpData.DataBind(); AspNetPager1.RecordCount = totalCount; }
protected void Page_Load(object sender, EventArgs e) { //selected = Convert.ToInt32(Session["selected"]); if (!IsPostBack) { DropDownList2.DataSource = ProductClass; DropDownList2.DataTextField = "Name"; DropDownList2.DataValueField = "ProductClass_ID"; DropDownList2.DataBind(); AspNetPager1.PageSize = 10; DataSet ds = new BLL.Product().GetListFromView(10, AspNetPager1.CurrentPageIndex, GetComm()); AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]); Repeater1.DataSource = ds; Repeater1.DataBind(); } }
private void onClientEvents() { BLL.FMCGHubClient.FMCGHub.On <BLL.Product>("Product_Save", (prod) => { this.Dispatcher.Invoke(() => { prod.Save(true); }); }); BLL.FMCGHubClient.FMCGHub.On("Product_Delete", (Action <int>)((pk) => { this.Dispatcher.Invoke((Action)(() => { BLL.Product prod = new BLL.Product(); prod.Find((int)pk); prod.Delete((bool)true); })); })); }
public string ShowDeatil(HttpContext context) { //产品ID long ID = Convert.ToInt64(context.Request["id"]); //动作 string action = context.Request["action"]; //颜色 string table = string.Empty; //string id = context.Request.Params["id"] == null ? "0" : context.Request.Params["id"].Trim(); DataSet ds = new DataSet(); ds = new BLL.Product().GetDataSetByProc(ID); table = JsonHelper.DataTable2Josn(ds.Tables[0]); return(table); }
private void btnSearch_Click(object sender, RoutedEventArgs e) { var B = new BLL.Product(); B.ErrorEvent += (s, ev) => MessageBox.Show(ev.Message); Entities.Product product = B.GetProductByID(Convert.ToInt16(tbSearchProductID.Text)); if (product != null) { tbProductID.Text = product.ProductID.ToString(); tbProductName.Text = product.ProductName; tbUnitPrice.Text = product.UnitPrice.ToString(); tbUnitsInStock.Text = product.UnitsInStock.ToString(); } }
protected void Button2_Click(object sender, EventArgs e) { DataSet ds = new BLL.Product().GetAllList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Model.Supplier mo_supp = new Model.Supplier(); string s_name = ds.Tables[0].Rows[i]["Name"].ToString(); if (s_name.Length > 1) { s_name = s_name.Substring(0, 2); } mo_supp.Name = s_name; mo_supp.Address = s_name; BLL.Supplier bl_supp = new BLL.Supplier(); bl_supp.Add(mo_supp); } }
protected void Button2_Click(object sender, EventArgs e) { Int32 Product_ID = Convert.ToInt32(this.HiddenField1.Value); DataTable dt = new BLL.ProductFlowing().GetFlowing(Product_ID, Convert.ToDateTime("2012-02-01"), Convert.ToDateTime("2012-06-01")); this.GridView5.DataSource = dt; this.GridView5.DataBind(); this.Panel1.Visible = true; DataSet ds = new BLL.Product().GetStockFromView(10, 1, "Product_ID = " + Product_ID); this.Repeater1.DataSource = ds; this.Repeater1.DataBind(); decimal TotalQTY = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i]["Quantity"] != "") { TotalQTY += Convert.ToDecimal(ds.Tables[0].Rows[i]["Quantity"]); } } Int32 RecCount = this.GridView5.Rows.Count; if (RecCount > 0) { this.GridView5.Rows[RecCount - 1].Cells[6].Text = TotalQTY.ToString(); } if (RecCount > 1) { for (int i = RecCount; i > 1; i--) { decimal RowQTY = Convert.ToDecimal(this.GridView5.Rows[i - 1].Cells[6].Text); if (this.GridView5.Rows[i - 1].Cells[1].Text == "销售" || this.GridView5.Rows[i - 1].Cells[1].Text == "出库") { this.GridView5.Rows[i - 2].Cells[6].Text = (RowQTY + Convert.ToDecimal(this.GridView5.Rows[i - 1].Cells[2].Text)).ToString(); } else { this.GridView5.Rows[i - 2].Cells[6].Text = (RowQTY - Convert.ToDecimal(this.GridView5.Rows[i - 1].Cells[2].Text)).ToString(); } } } }
public static string QueryList(string id, string action) { //产品ID //Convert.ToInt64(context.Request["id"]); //动作 //string action =action context.Request["action"]; //颜色 string table = string.Empty; //string id = context.Request.Params["id"] == null ? "0" : context.Request.Params["id"].Trim(); DataSet ds = new DataSet(); ds = new BLL.Product().GetDataSetByProc(ProductID); //table += "{\"table\":"; table = JsonHelper.DataTable2Josn(ds.Tables[0]); // table += "}"; return(table); }
protected void delByIds(string[] strArr) { string result = new BLL.Product().Delete(strArr).ToString(); Response.Clear(); if (result == "0") { Response.Write(UtilsCommons.AjaxReturnJson("0", "删除失败")); } if (result == "1") { Response.Write(UtilsCommons.AjaxReturnJson("1", "删除成功")); } if (result == "-1") { Response.Write(UtilsCommons.AjaxReturnJson("0", "产品下有订单存在,删除失败")); } Response.End(); }
public static List <Model.ProductInfo> GetProductsBySearch(string text) { BLL.Product bll = new BLL.Product(); if (!enableCaching) { return(bll.GetProductsBySearch(text)); } string key = "product_search_" + text; List <Model.ProductInfo> data = (List <Model.ProductInfo>)HttpRuntime.Cache[key]; if (data == null) { data = bll.GetProductsBySearch(text); AggregateCacheDependency cd = DependencyFactory.GetProductDependency(); HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(productTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null); } return(data); }
public static List <Model.ProductInfo> GetProductsByCategory(string category) { BLL.Product bll = new BLL.Product(); if (!enableCaching) { if (category.Contains(@"'")) { return(bll.GetProductsInCategories(category)); } else { return(bll.GetProductsByCategory(category)); } } string key = "product_by_category_" + category; List <Model.ProductInfo> data = (List <Model.ProductInfo>)HttpRuntime.Cache[key]; if (data == null) { if (category.Contains(@"'")) { data = bll.GetProductsInCategories(category); } else { data = bll.GetProductsByCategory(category); } AggregateCacheDependency cd = DependencyFactory.GetProductDependency(); HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(productTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null); } return(data); }
//删除图片 public string DelPic(HttpContext context) { try { DataSet ds = new DataSet(); long ID = Convert.ToInt64(context.Request["lbID"]); ds = new BLL.Product().GetDataSetByProc(ID); string path = System.Web.HttpContext.Current.Server.MapPath("../ProductPic/" + ds.Tables[0].Rows[0]["Image"].ToString() + ""); if (System.IO.File.Exists(path)) { string delFile = System.Web.HttpContext.Current.Server.MapPath("../ProductPic/" + ds.Tables[0].Rows[0]["Image"].ToString() + ""); System.IO.File.Delete(delFile); } Model.Product model = new Model.Product(); model.ID = ID; model.Image = ""; ds = new BLL.Product().UpdateImageByProc(model); if (ds.Tables[0].Rows[0][0].ToString() == "") { return("success"); } else { return("fail"); } } catch (Exception ex) { throw ex; } }
public static void SaveList(List<HCMIS.Desktop.DirectoryServices.Product> list) { BLL.Product bv = new BLL.Product(); foreach (HCMIS.Desktop.DirectoryServices.Product v in list) { // try to load by primary key bv.LoadByPrimaryKey(v.ID.Value); // if the entry doesn't exist, create it if (bv.RowCount == 0) { bv.AddNew(); } // populate the contents of v on the to the database list if( v.ID.HasValue ) bv.ID = v.ID.Value; if( v.Name != "" && v.Name != null ) bv.IIN = v.Name; if( v.TypeID.HasValue ) bv.TypeID = v.TypeID.Value; bv.Save(); } }
public static List<Product> GetAll() { BLL.Product v = new BLL.Product(); v.LoadAll(); return ToList(v); }
public static void DeleteList(List<int> list) { BLL.Product bv = new BLL.Product(); foreach (int v in list) { // try to load by primary key bv.LoadByPrimaryKey(v); // if the entry doesn't exist, create it if (bv.RowCount > 0) { bv.MarkAsDeleted(); bv.Save(); } // populate the contents of v on the to the database list } }