public Property(int Id, propertytype.PropertyType pt) { _pt = pt; _id = Id; _data = _pt.DataTypeDefinition.DataType.Data; _data.PropertyId = Id; }
// GET: Admin/propertytypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } propertytype propertytype = db.propertytypes.Find(id); if (propertytype == null) { return(HttpNotFound()); } return(View(propertytype)); }
//Selecting value from dropdown public static void Selectdropdown(string webelementvalue, string Text, propertytype elementtype) { if (elementtype == propertytype.Id) { new SelectElement(PropertiesCollection.ngdriver.FindElement(By.Id(webelementvalue))).SelectByText(Text); } else if (elementtype == propertytype.Name) { new SelectElement(PropertiesCollection.ngdriver.FindElement(By.Name(webelementvalue))).SelectByText(Text); } else if (elementtype == propertytype.XPath) { new SelectElement(PropertiesCollection.ngdriver.FindElement(By.XPath(webelementvalue))).SelectByText(Text); } else if (elementtype == propertytype.CssSelector) { new SelectElement(PropertiesCollection.ngdriver.FindElement(By.CssSelector(webelementvalue))).SelectByText(Text); } }
// EnterText public static void Entertext(string webelementvalue, string value, propertytype elementtype) { if (elementtype == propertytype.Model) { PropertiesCollection.ngdriver.FindElement(NgBy.Model(webelementvalue)).SendKeys(value); } else if (elementtype == propertytype.Name) { PropertiesCollection.ngdriver.FindElement(By.Name(webelementvalue)).SendKeys(value); } else if (elementtype == propertytype.XPath) { PropertiesCollection.ngdriver.FindElement(By.XPath(webelementvalue)).SendKeys(value); } else if (elementtype == propertytype.CssSelector) { PropertiesCollection.ngdriver.FindElement(By.CssSelector(webelementvalue)).SendKeys(value); } }
public static Property MakeNew(propertytype.PropertyType pt, Content c, Guid versionId) { int newPropertyId = 0; // The method is synchronized SqlHelper.ExecuteNonQuery("INSERT INTO cmsPropertyData (contentNodeId, versionId, propertyTypeId) VALUES(@contentNodeId, @versionId, @propertyTypeId)", SqlHelper.CreateParameter("@contentNodeId", c.Id), SqlHelper.CreateParameter("@versionId", versionId), SqlHelper.CreateParameter("@propertyTypeId", pt.Id)); newPropertyId = SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM cmsPropertyData"); interfaces.IData d = pt.DataTypeDefinition.DataType.Data; d.MakeNew(newPropertyId); return new Property(newPropertyId, pt); }
/// <summary> /// Get an true/false if the Member can edit the given data defined in the propertytype /// </summary> /// <param Name="pt">Propertytype to edit</param> /// <returns>True if the Member can edit the data</returns> public bool MemberCanEdit(propertytype.PropertyType pt) { if(propertyTypeRegistered(pt)) { return (bool.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(_ConnString,CommandType.Text,"Select memberCanEdit from cmsMemberType where NodeId = " + this.Id +" And propertytypeId = "+pt.Id).ToString())); } return false; }
/// <summary> /// Set if the data should be displayed on members of this type's profilepage /// </summary> /// <param Name="pt">PropertyType</param> /// <param Name="value">True/False if the data should be displayed</param> public void setMemberViewOnProfile(propertytype.PropertyType pt, bool value) { int tmpval = 0; if (value) tmpval = 1; if (propertyTypeRegistered(pt)) Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString,CommandType.Text,"Update cmsMemberType set viewOnProfile = " + tmpval + " where NodeId = " + this.Id +" And propertytypeId = "+pt.Id); else Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString,CommandType.Text,"insert into cmsMemberType (NodeId, propertytypeid, viewOnProfile) values ("+this.Id+","+pt.Id+", "+tmpval+")"); }
private bool propertyTypeRegistered(propertytype.PropertyType pt) { return (int.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(_ConnString,CommandType.Text,"Select count(pk) as tmp from cmsMemberType where NodeId = " + this.Id +" And propertytypeId = "+pt.Id).ToString()) > 0); }