protected void InitInfo() { categoryId = CECRequest.GetQueryInt("categoryid", 0); Action = CECRequest.GetQueryString("action"); if (Action.ToLower() == "del") { bool isDelete = ProductCategoryManage.Delete(categoryId); if (!isDelete) { Page.ClientScript.RegisterStartupScript(this.GetType(), "DelError", "alert('该分类可能有字分类,请先删掉子分类!');window.location.href='categorylist.aspx';", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "DeleSuccess", "alert('删除成功!');window.location.href='categorylist.aspx';", true); } return; } this.ddlcategoryList.BuildTree(ProductCategoryManage.GetCategoryForTable(), "CategoryName", "CategoryId"); this.ddlcategoryList.SelectedValue = categoryId.ToString(); if (Action.ToLower() == "edit") { categoryInfo = ProductCategoryManage.GetCategoryInfo(categoryId); this.ddlcategoryList.SelectedValue = categoryInfo.ParentId.ToString(); } }
public override IDataReader SearchProductCategory(ProductCategoryInfo proc) { return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("usp_Product_SearchProductCategory") , GetNull(proc.product_category_id) , GetNull(proc.title) )); }
public List <ComboTree> GetComboTreeChildren(ComboTree comboTree, ProductCategoryInfo category, List <ProductCategoryInfo> data) { var childrens = data.Where(s => s.Depth == category.Depth + 1 && s.Lft > category.Lft && s.Rgt < category.Rgt); var childs = new List <ComboTree>(); foreach (var productCategoryInfo in childrens) { var child = new ComboTree(); child.Id = productCategoryInfo.Id; child.Text = productCategoryInfo.Name; childs.Add(child); } comboTree.Children = childs; foreach (var child in comboTree.Children) { var temp = data.FirstOrDefault(s => s.Id == child.Id); if (temp != null) { this.GetComboTreeChildren(child, temp, data); } } return(comboTree.Children); }
public object UpdateProductCategoryByCategoryId() { var model = new ProductCategoryInfo(); model.Id = Convert.ToInt32(HttpContext.Current.Request.Params["CategoryId"]); model.Name = HttpContext.Current.Request.Params["CategoryName"]; model.Desc = (string)HttpContext.Current.Request.Params["desc"]; model.BigPicture = HttpContext.Current.Request.Params["BigPicture"]; model.SmallPicture = HttpContext.Current.Request.Params["SmallPicture"]; model.MediumPicture = HttpContext.Current.Request.Params["mediumpicture"]; model.Content = HttpContext.Current.Request.Params["desc"]; var display = 0; if (int.TryParse(HttpContext.Current.Request.Form["DisplayOrder"], out display)) { model.DisplayOrder = display; } else { model.DisplayOrder = display; } //model.ParentId = int.Parse(HttpContext.Current.Request.Form["parentSelect"]); IProductCategoryService productCategoryService = new ProductCategoryService(); return(productCategoryService.Update(model)); }
private bool save() { if (string.IsNullOrEmpty(TB_Name.Text)) { MessageBox.Show("Bạn chưa nhập tên nhóm sản phẩm"); return(false); } int id = UntilityFunction.IntegerForNull(HD_ID.Value); //upload image if (Upload_Images.HasFile) { string sfile = UploadImage(); if (sfile != "") { HD_Image.Value = sfile; } } if (Upload_Banner.HasFile) { string sfile = UploadImage2(); if (sfile != "") { HD_ImageBanner.Value = sfile; } } var info = new ProductCategoryInfo { Id = id, Name = TB_Name.Text.Trim(), Link = "/" + (id == 0 ? UntilityFunction.nextId("ProductCategory").ToString() : id.ToString()) + "/" + UnicodeUtility.UrlRewriting(TB_Name.Text.Trim()) + ".htm", Sort = 0, Description = TB_Description.Text.Trim(), MetaDescription = TB_MetaDescription.Text.Trim(), MetaKeyword = TB_MetaKeyword.Text.Trim(), MetaHeading = TB_MetaHeading.Text.Trim(), ParentId = UntilityFunction.IntegerForNull(DDL_ProductType.SelectedValue), Summary = TB_Summary.Text.Trim(), Image = HD_Image.Value, Zone = "", RewriteTitle = "", imgbanner = HD_ImageBanner.Value, linkbanner = TB_linkbanner.Text, titbanner = TB_titbanner.Text }; if (id > 0) { ProductCategoryImpl.Instance.Update(info); MessageBox.Show("Cập nhật thành công"); } else { HD_ID.Value = ProductCategoryImpl.Instance.Add(info).ToString(); MessageBox.Show("Thêm mới thành công"); } return(true); }
public static List <ProductInfo> SearchProductCategory(string product_category_id, string title) { ProductCategoryInfo pro = new ProductCategoryInfo(); pro.product_category_id = product_category_id; pro.title = title; return(CBO.FillCollection <ProductInfo>(DataProvider.Instance().SearchProductCategory(pro))); }
public override IDataReader AddProductCategory(ProductCategoryInfo pcate) { return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("usp_Product_AddProductCategory") , GetNull(pcate.title) , GetNull(pcate.description) , GetNull(pcate.create_by) )); }
void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtContent.Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "SaveError", "alert('请输入内容!');", true); return; } if (Action.ToLower() == "edit") { categoryInfo = new ProductCategoryInfo(); categoryInfo.CategoryName = txtName.Text; categoryInfo.Sort = Convert.ToInt32(txtSort.Text); categoryInfo.CategoryId = categoryId; categoryInfo.Content = this.txtContent.Text; categoryInfo.LinkUrl = this.txtLinkUrl.Text; ProductCategoryManage.Update(categoryInfo); } else { if (this.ddlcategoryList.SelectedValue != "0") { int _id = Utils.StrToInt(this.ddlcategoryList.SelectedValue, 0); categoryInfo = ProductCategoryManage.GetCategoryInfo(_id); if (categoryInfo != null) { string parentIdList = string.Empty; if (categoryInfo.ParentIdList == "0") { parentIdList = categoryInfo.CategoryId.ToString(); } else { parentIdList = categoryInfo.ParentIdList + "," + categoryInfo.CategoryId; } int maxOrder = 0; DataTable dt = ProductCategoryManage.GetSubCategoryListTable(_id); if (dt.Rows.Count > 0) { maxOrder = TypeConverter.ObjectToInt(dt.Compute("Max(Sort)", "")); } else { maxOrder = categoryInfo.Sort; } InsertCategory(_id, categoryInfo.Layer + 1, parentIdList, 0, maxOrder, txtContent.Text); ProductCategoryManage.UpdateSubCategoryCount(_id); } } else { int maxdisplayorder = TypeConverter.ObjectToInt(ProductCategoryManage.GetCategoryForTable().Compute("Max(Sort)", "")) + 1; InsertCategory(0, 0, "0", 0, maxdisplayorder, txtContent.Text); } } Page.ClientScript.RegisterStartupScript(this.GetType(), "SaveSuccess", "alert('添加成功!');window.location.href='postcategory.aspx';", true); }
public string getTitle(int id) { if (id == 0) { return("此項目為主類別"); } ProductCategoryInfo info = pcBLL.getEditdata(id); return(info.pc_name); }
private void SearchHierarchyVailNow(int pc_fid) { ProductCategoryInfo info = getEditdata(pc_fid); if (info.pc_id != 0) { HerichCountMath += 1; SearchHierarchyVailNow(info.pc_fatherid); } }
public List <ProductCategoryInfo> getallFather(int FatherId, int lidValue) { List <ProductCategoryInfo> infos = new List <ProductCategoryInfo>(); IDataReader reader = db.GetFatherClass(FatherId, lidValue).CreateDataReader(); while (reader.Read()) { infos.Add(ProductCategoryInfo.Populate(reader)); } return(infos); }
public ProductCategoryInfo getEditdata(int pc_id) { ProductCategoryInfo info = new ProductCategoryInfo(); IDataReader reader = db.GetEditData(pc_id).CreateDataReader(); while (reader.Read()) { info = ProductCategoryInfo.Populate(reader); } return(info); }
public override IDataReader SetProductCategory(ProductCategoryInfo pcate) { return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("usp_Product_SetProductCategory") , GetNull(pcate.product_category_id) , GetNull(pcate.title) , GetNull(pcate.description) , GetNull(pcate.display_sort) , GetNull(pcate.lastupdate_by) , GetNull(pcate.is_del) )); }
public List <ProductCategoryInfo> UpdataSorting(int fatherid, int sorting) { List <ProductCategoryInfo> infos = new List <ProductCategoryInfo>(); IDataReader reader = db.UpdateSorting(fatherid, sorting, lidValue).CreateDataReader(); while (reader.Read()) { infos.Add(ProductCategoryInfo.Populate(reader)); } return(infos); }
public ProductCategoryInfo GetProductCategoryById(int id) { var model = new ProductCategoryInfo(); using (DataCommand cmd = DataCommandManager.GetDataCommand("GetProductCategoryById")) { cmd.SetParameterValue("@Id", id); using (IDataReader dr = cmd.ExecuteDataReader()) { while (dr.Read()) { if (!Convert.IsDBNull(dr["Id"])) { model.Id = (int)dr["Id"]; } if (!Convert.IsDBNull(dr["Name"])) { model.Name = (string)dr["Name"]; } if (!Convert.IsDBNull(dr["Lft"])) { model.Lft = Convert.ToInt32(dr["Lft"]); } if (!Convert.IsDBNull(dr["Rgt"])) { model.Rgt = Convert.ToInt32(dr["Rgt"]); } if (!Convert.IsDBNull(dr["ParentId"])) { model.ParentId = Convert.ToInt32(dr["ParentId"]); } if (!Convert.IsDBNull(dr["Content"])) { model.Content = Convert.ToString(dr["Content"]); } if (!Convert.IsDBNull(dr["Description"])) { model.Desc = Convert.ToString(dr["Description"]); } if (!Convert.IsDBNull(dr["MediumPicture"])) { model.MediumPicture = Convert.ToString(dr["MediumPicture"]); } if (!Convert.IsDBNull(dr["DataStatus"])) { model.DataStatus = Convert.ToInt32(dr["DataStatus"]); } return(model); } } } return(model); }
public int getFatherSorting(int fatherid) { ProductCategoryInfo info = new ProductCategoryInfo(); IDataReader reader = db.GetFatherSortWithLid(fatherid, lidValue).CreateDataReader(); if (reader.Read()) { info = ProductCategoryInfo.Populate(reader); return(info.pc_sorting); } return(1); }
public List <ProductCategoryInfo> GetList(int pageIndex, int pageSize, out int total) { List <ProductCategoryInfo> list = null; var t = 0; SqlParameter[] param = { new SqlParameter("@pageIndex", pageIndex), new SqlParameter("@pageSize", pageSize), new SqlParameter("@totalrow", DbType.Int32) { Direction = ParameterDirection.Output } }; SqlCommand comx; var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_ProductCategory_GetList", param, out comx); if (r != null) { list = new List <ProductCategoryInfo>(); while (r.Read()) { var info = new ProductCategoryInfo(); info.Id = Int32.Parse(r["Id"].ToString()); info.Name = r["Name"].ToString(); info.Link = r["Link"].ToString(); info.Sort = Int32.Parse(r["Sort"].ToString()); info.Description = r["Description"].ToString(); info.MetaDescription = r["MetaDescription"].ToString(); info.MetaKeyword = r["MetaKeyword"].ToString(); info.MetaHeading = r["MetaHeading"].ToString(); info.ParentId = Int32.Parse(r["ParentId"].ToString()); info.Summary = r["Summary"].ToString(); info.Image = r["Image"].ToString(); info.Zone = r["Zone"].ToString(); info.RewriteTitle = r["RewriteTitle"].ToString(); info.imgbanner = r["imgbanner"].ToString(); info.linkbanner = r["linkbanner"].ToString(); info.titbanner = r["titbanner"].ToString(); list.Add(info); } r.Close(); r.Dispose(); t = int.Parse(comx.Parameters[2].Value.ToString()); } total = t; return(list); }
public bool SearchHierarchyEqualVail(int pc_id, int Hierarchy) { ProductCategoryInfo info = getEditdata(pc_id); if (info.pc_id != 0) { SearchHierarchyVailNow(info.pc_fatherid); } if (Hierarchy == HerichCountMath) { return(true); } return(false); }
protected void InsertData() { ProductCategoryInfo info = new ProductCategoryInfo(); info.pc_fatherid = Tools.TryParseMethod(ddlCategory.SelectedValue); info.pc_name = txtName.Text; info.pc_image = Image1.AlternateText; info.pc_show = bool.Parse(rbShow.SelectedValue); info.l_id = lid; if (pcBLL.Insert(info) > 0) { Response.Redirect("List.aspx?header=" + Getmessage("30009"), true); } }
public static int Update(ProductCategoryInfo model) { string strSQL = "UPDATE ProductCategories SET CategoryName = @CategoryName ,Sort = @Sort,[Content] = @Content,LinkUrl = @LinkUrl WHERE CategoryId = @CategoryId"; SqlParameter[] parms = { new SqlParameter("@CategoryId", model.CategoryId), new SqlParameter("@CategoryName", model.CategoryName), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Content", model.Content), new SqlParameter("@LinkUrl", model.LinkUrl) }; return(Goodspeed.Library.Data.SQLPlus.ExecuteNonQuery(CommandType.Text, strSQL, parms)); }
/// <summary> /// Resolve hotel details url to a friendly one /// </summary> /// <param name="ProductPropertyID"></param> /// <returns>string</returns> public static string GetResolvedProductDetailsLink(int hotelPropertyID) { ProductCategoryInfo productCategory = ProductCategoryController.Instance.GetByID(hotelPropertyID); if (productCategory != null) { return(PageLink.ProductDetailsPageFriendlyUrl .Replace("[ProductDetailsLink]", HttpUtility.UrlEncode(FormatHelper.CleanUpNonAlphaNumericCharachtersWithDash(productCategory.Category.Name + " " + productCategory.Name))) .Replace("[ProductPropertyID]", productCategory.ID.ToString())); } else { return(null); } }
protected void ViewControl() { ProductCategoryInfo info = pcBLL.getEditdata(id); if (info.pc_id != 0) { if (info.pc_fatherid != 0) { lbcategory.Text = pcBLL.getEditdata(info.pc_fatherid).pc_name; } lbTitle.Text = info.pc_name; img1.ImageUrl = Tools.GetAppSettings("ProductImageTruePath") + info.pc_image; lbshow.Text = info.pc_show.ToString(); } }
public int Update(ProductCategoryInfo model) { using (DataCommand cmd = DataCommandManager.GetDataCommand("UpdateProductCategoryByCategoryId")) { cmd.SetParameterValue("@CategoryId", model.Id); cmd.SetParameterValue("@Title", model.Name); cmd.SetParameterValue("@Name", model.Name); cmd.SetParameterValue("@Content", model.Content); cmd.SetParameterValue("@Desc", model.Desc); cmd.SetParameterValue("@SmallPicture", model.SmallPicture); cmd.SetParameterValue("@MediumPicture", model.MediumPicture); cmd.SetParameterValue("@BigPicture", model.BigPicture); cmd.SetParameterValue("@DisplayOrder", model.DisplayOrder); return(cmd.ExecuteNonQuery()); } }
public int Insert(ProductCategoryInfo info) { //加入條件,假使新增不為主類別,l_id強制依附語系 //目的就在於:在不同語系下,最上層主類別排序依舊以1.2.3.4.5執行 DT = new DataTable(); DT = db.GetFatherSortWithLid(info.pc_fatherid, info.l_id); if (DT.Rows.Count > 0) { info.pc_sorting = int.Parse(DT.Rows[0]["pc_sorting"].ToString()) + 1; } else { info.pc_sorting = 1; } return(db.Insert(info.pc_name, info.pc_fatherid, info.pc_sorting, info.pc_image, info.pc_thumb, info.pc_show, info.l_id)); }
public static int Insert(ProductCategoryInfo model) { string strSQL = "INSERT INTO ProductCategories(ParentId,Layer,ParentIdList,SubCategoryCount,CategoryName,Sort,[Content],LinkUrl) VALUES(@ParentID,@Layer,@ParentIdList,@SubCategoryCount,@CategoryName,@Sort,@Content,@LinkUrl);SELECT @@IDENTITY;"; SqlParameter[] parms = { new SqlParameter("@ParentId", model.ParentId), new SqlParameter("@Layer", model.Layer), new SqlParameter("@ParentIdList", model.ParentIdList), new SqlParameter("@SubCategoryCount", model.SubCategoryCount), new SqlParameter("@CategoryName", model.CategoryName), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Content", model.Content), new SqlParameter("@LinkUrl", model.LinkUrl) }; return(Convert.ToInt32(Goodspeed.Library.Data.SQLPlus.ExecuteScalar(CommandType.Text, strSQL, parms))); }
void InsertCategory(int parentId, int layer, string parentIdList, int subCategoryCount, int order, string content) { categoryInfo = new ProductCategoryInfo(); categoryInfo.CategoryId = categoryId; categoryInfo.CategoryName = txtName.Text; categoryInfo.ParentId = parentId; categoryInfo.ParentIdList = parentIdList; categoryInfo.Layer = layer; categoryInfo.SubCategoryCount = subCategoryCount; categoryInfo.Sort = order; categoryInfo.Content = content; categoryInfo.LinkUrl = txtLinkUrl.Text; ProductCategoryManage.Insert(categoryInfo); this.txtName.Text = string.Empty; }
public List <ProductCategoryInfo> GetListByParent(int ParentId) { List <ProductCategoryInfo> list = null; var t = 0; SqlParameter[] param = { new SqlParameter("@ParentId", ParentId) }; //SqlCommand comx; //var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_ProductCategory_GetList", param, out comx); var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_ProductCategory_GetListByParent", param); if (r != null) { list = new List <ProductCategoryInfo>(); while (r.Read()) { var info = new ProductCategoryInfo(); info.Id = Int32.Parse(r["Id"].ToString()); info.Name = r["Name"].ToString(); info.Link = r["Link"].ToString(); info.Sort = Int32.Parse(r["Sort"].ToString()); info.Description = r["Description"].ToString(); info.MetaDescription = r["MetaDescription"].ToString(); info.MetaKeyword = r["MetaKeyword"].ToString(); info.MetaHeading = r["MetaHeading"].ToString(); info.ParentId = Int32.Parse(r["ParentId"].ToString()); info.Summary = r["Summary"].ToString(); info.Image = r["Image"].ToString(); info.Zone = r["Zone"].ToString(); info.RewriteTitle = r["RewriteTitle"].ToString(); info.imgbanner = r["imgbanner"].ToString(); info.linkbanner = r["linkbanner"].ToString(); info.titbanner = r["titbanner"].ToString(); list.Add(info); } r.Close(); r.Dispose(); //t = int.Parse(comx.Parameters[2].Value.ToString()); } //total = t; return(list); }
private void addProductCategory() { ProductCategoryInfo procate = new ProductCategoryInfo(); procate.title = txtTitle.Text; procate.description = txtDesciption.Text; procate.create_by = (SessionApp.user_info == null) ? "No Login" : SessionApp.user_info.user_name; var result = ProductController.AddProductCategory(procate); if (result == null) { ShowMessage(Page, "ชื่อหมวดหมู่นี้มีอยู่ในระบบแล้ว"); } else { ShowMessage(Page, "เพิ่มหมวดหมู่สำเร็จ"); } }
private void setProductCategory() { ProductCategoryInfo procate = new ProductCategoryInfo(); procate.product_category_id = product_category_id; procate.title = txtTitle.Text; procate.description = txtDesciption.Text; procate.lastupdate_by = (SessionApp.user_info == null) ? "No Login" : SessionApp.user_info.user_name; var result = ProductController.SetProductCategory(procate); if (result == null) { ShowMessage(Page, "แก้ไขผิดพลาด"); } else { ShowMessage(Page, "แก้ไขหมวดหมู่สำเร็จ"); } }
public static ProductCategoryInfo GetCategoryInfoByDataRow(DataRow dr) { ProductCategoryInfo model = null; if (dr != null) { model = new ProductCategoryInfo(); model.CategoryId = Convert.ToInt32(dr["CategoryId"]); model.CategoryName = dr["CategoryName"].ToString(); model.Layer = Convert.ToInt32(dr["Layer"]); model.ParentId = Convert.ToInt32(dr["ParentId"]); model.ParentIdList = dr["ParentIdList"].ToString(); model.Sort = Convert.ToInt32(dr["Sort"]); model.SubCategoryCount = Convert.ToInt32(dr["SubCategoryCount"]); model.Content = dr["Content"].ToString(); model.LinkUrl = dr["LinkUrl"].ToString(); } return(model); }