public List <SpecificationCategory> GetSpecificationCategory() { List <SpecificationCategory> listspecificationmaster = new List <SpecificationCategory>(); SpecificationCategory objspecificationmaster = null; try { db.OpenConn(); SqlCommand cmd = new SqlCommand("select S.SpecificationCategoryID, P.ProductID,P.ProductName,S.SpecificationCategoryName from Products P,SpecificationCategory S where P.ProductID=S.ProductID", db.conn); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { objspecificationmaster = new SpecificationCategory(); objspecificationmaster.ProductID = long.Parse(dr["ProductID"].ToString()); objspecificationmaster.ProductName = dr["ProductName"].ToString(); objspecificationmaster.SpecificationCategoryName = dr["SpecificationCategoryName"].ToString(); objspecificationmaster.SpecificationCategoryID = long.Parse(dr["SpecificationCategoryID"].ToString()); listspecificationmaster.Add(objspecificationmaster); } dr.Close(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(listspecificationmaster); }
public int GetSCCount(long pid) { int result; List <SpecificationCategory> listOfCategories = new List <SpecificationCategory>(); SpecificationCategory objspeccate = new SpecificationCategory(); try { db.OpenConn(); string query = "select count(*) from specificationcategory where productid=@productid "; SqlCommand CmdRows = new SqlCommand(query, db.conn); CmdRows.Parameters.AddWithValue("@productid", pid); result = (int)CmdRows.ExecuteScalar(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(result); }
public List <SpecificationCategory> GetSCategories(long pcid) { List <SpecificationCategory> listOfCategories = new List <SpecificationCategory>(); SpecificationCategory sctgry = null; try { db.OpenConn(); SqlCommand cmd = new SqlCommand("select * from SpecificationCategory where productid=@productid", db.conn); cmd.Parameters.AddWithValue("@productid", pcid); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { sctgry = new SpecificationCategory(); sctgry.SpecificationCategoryID = long.Parse(dr["SpecificationCategoryID"].ToString()); sctgry.SpecificationCategoryName = dr["SpecificationCategoryName"].ToString(); listOfCategories.Add(sctgry); } db.CloseConn(); } catch (Exception ee) { db.CloseConn(); throw ee; } return(listOfCategories); }
public List <SpecificationCategory> GetSCategoryCount(long pid) { //int result; List <SpecificationCategory> listOfCategories = new List <SpecificationCategory>(); SpecificationCategory objspeccate = new SpecificationCategory(); try { db.OpenConn(); string query = "select SpecificationCategoryID from specificationcategory where productid=@productid "; SqlCommand CmdRows = new SqlCommand(query, db.conn); CmdRows.Parameters.AddWithValue("@productid", pid); SqlDataReader dr = CmdRows.ExecuteReader(); while (dr.Read()) { objspeccate = new SpecificationCategory(); objspeccate.SpecificationCategoryID = long.Parse(dr["SpecificationCategoryID"].ToString()); listOfCategories.Add(objspeccate); } dr.Close(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(listOfCategories); }
public IActionResult Add(Item Item, SpecificationCategory SpecificationCategory, string Name, string Value) { int max_id = 0; try { max_id = _db.Specification.Max((sp) => sp.Id); } catch { } Specification sp = new Specification() { Id = max_id + 1, SpecificationCategory = SpecificationCategory, Item = Item, Name = Name, Value = Value }; _db.Specification.Add(sp); _db.SaveChanges(); return(Ok()); }
public List <SpecificationCategory> GetSpecificationCategories() { List <SpecificationCategory> lstprdts = new List <SpecificationCategory>(); SpecificationCategory objp = new SpecificationCategory(); lstprdts = objp.GetSpecificationCategory(); return(lstprdts); }
//public void Bindddlproductcategory() //{ // ddlproductcategory.DataSource = pcobj.GetProductCategory(true); // ddlproductcategory.DataTextField = "ProductCategoryName"; // ddlproductcategory.DataValueField = "ProductCategoryID"; // ddlproductcategory.DataBind(); //} public void BindPcategory() { SpecificationCategory objspec = new SpecificationCategory(); ddlPCname.DataSource = pcobj.GetProductCategory(true); ddlPCname.DataTextField = "ProductCategoryName"; ddlPCname.DataValueField = "ProductCategoryID"; ddlPCname.DataBind(); }
public IActionResult Edit(int Id, SpecificationCategory SpecificationCategory, Item Item, string Name, string Value) { _db.Specification.Update( new Specification() { Id = Id, SpecificationCategory = SpecificationCategory, Item = Item, Name = Name, Value = Value }); _db.SaveChanges(); return(Ok()); }
protected void Createtab() { string pridn = Request.QueryString["prid"]; SpecificationValue objspecval = new SpecificationValue(); List <SpecificationCategory> lstspec = new List <SpecificationCategory>(); SpecificationCategory objspec = new SpecificationCategory(); long pcid = long.Parse(pridn); lstspec = objspec.GetSCategories(pcid); tbcDynamic = new AjaxControlToolkit.TabContainer(); StringBuilder html = new StringBuilder(); for (int i = 0; i < lstspec.Count; i++) { html.Append("<table class='table table-striped table-hover table-bordered'>"); html.Append("<tbody>"); Table tbl = new Table(); TabPanel objtabpanel = new TabPanel(); objtabpanel.HeaderText = lstspec[i].SpecificationCategoryName; objtabpanel.ID = lstspec[i].SpecificationCategoryID.ToString(); tbcDynamic.Tabs.Add(objtabpanel); List <SpecificationValue> lstspecnam = objspecval.GetProductSpecs(long.Parse(objtabpanel.ID)); foreach (SpecificationValue items in lstspecnam) { if (items.SpecificationMasterName == "* Grade") { gradetype = items.SpecificationValueName; Session["gradetype"] = gradetype; } else { html.Append("<tr>"); html.Append("<td>"); html.Append(items.SpecificationMasterName); html.Append("</td >"); html.Append("<td>"); html.Append(items.SpecificationValueName); html.Append("</td>"); html.Append("</tr>"); } } html.Append("</tbody>"); html.Append("</table>"); } PLH.Controls.Add(new Literal { Text = html.ToString() }); }
public void BindSpecificationategory() { if (Session["id"] != null && Session["id"].ToString() != "") { SpecificationCategory objspec = new SpecificationCategory(); objspec.ProductID = long.Parse(Session["id"].ToString()); ddlspecificationCategoryname.DataSource = objspec.GetSpecCategValues(true); ddlspecificationCategoryname.DataTextField = "SpecificationCategoryName"; ddlspecificationCategoryname.DataValueField = "SpecificationCategoryID"; ddlspecificationCategoryname.DataBind(); } else { Response.Redirect("Product.aspx"); } }
public List <SpecificationCategory> GetSpecCategValues(bool istitlerequired) { List <SpecificationCategory> lstspeccatgry = new List <SpecificationCategory>(); SpecificationCategory objspecgry = null; try { db.OpenConn(); string query = "select * from SpecificationCategory where ProductID=@ProductID "; if (istitlerequired) { objspecgry = new SpecificationCategory(); objspecgry.SpecificationCategoryID = 0; objspecgry.SpecificationCategoryName = "-Select SpecificationCategory-"; lstspeccatgry.Add(objspecgry); } SqlCommand cmd = new SqlCommand(query, db.conn); cmd.Parameters.AddWithValue("@ProductID", ProductID); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { objspecgry = new SpecificationCategory(); objspecgry.SpecificationCategoryID = long.Parse(dr["SpecificationCategoryID"].ToString()); objspecgry.SpecificationCategoryName = dr["SpecificationCategoryName"].ToString(); lstspeccatgry.Add(objspecgry); } dr.Close(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(lstspeccatgry); }
public List <SpecificationCategory> GetSpecBasedOnPC(long PcId) { List <SpecificationCategory> listspemaster = new List <SpecificationCategory>(); SpecificationCategory objspmaster; string Sqlquery = ""; if (PcId != 0) { Sqlquery = "select P.ProductID,P.ProductName,S.SpecificationCategoryID,S.SpecificationCategoryName from Products P inner join SpecificationCategory S on P.ProductID=S.ProductID where P.ProductCategoryID= " + PcId + " "; } else { Sqlquery = "select P.ProductID,P.ProductName,S.SpecificationCategoryID,S.SpecificationCategoryName from Products P inner join SpecificationCategory S on P.ProductID=S.ProductID "; } try { db.OpenConn(); SqlCommand cmd = new SqlCommand(Sqlquery, db.conn); //cmd.Parameters.AddWithValue("@ProductCategoryID", PcId); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { objspmaster = new SpecificationCategory(); objspmaster.ProductName = dr["ProductName"].ToString(); objspmaster.ProductID = long.Parse(dr["ProductID"].ToString()); objspmaster.SpecificationCategoryID = long.Parse(dr["SpecificationCategoryID"].ToString()); objspmaster.SpecificationCategoryName = dr["SpecificationCategoryName"].ToString(); listspemaster.Add(objspmaster); } dr.Close(); db.CloseConn(); } catch (Exception ex) { db.CloseConn(); throw ex; } return(listspemaster); }
public IActionResult Add(Item Item, string Title, string Description) { int max_id = 0; try { max_id = _db.SpecificationCategories.Max((sp) => sp.Id); } catch { } SpecificationCategory sp = new SpecificationCategory() { Id = max_id, Item = Item, Title = Title, Descriptiopn = Description }; _db.SpecificationCategories.Add(sp); _db.SaveChanges(); return(Ok()); }
protected bool Equals(SpecificationCategory other) { return string.Equals(ContextName, other.ContextName) && string.Equals(CategoryName, other.CategoryName); }
public static ExpectingEvent New(SpecificationCategory category) { var instance = new MessageBasedSpecification(category); return new ExpectingEvent(instance); }
protected MessageBasedSpecification(SpecificationCategory category) { SpecificationCategory = category; }