public string UpdateElementByEID([FromBody] Element element) { ElementBLL elementBLL = new ElementBLL(); elementBLL.UpdateElementByEID(element); return("要素目录修改成功"); }
public String DeleteElementByEID(string EID) { ElementBLL elementBLL = new ElementBLL(); elementBLL.DeleteElementByEID(EID); return("要素信息删除成功"); }
public string CreateElement(Element element) { ElementBLL elementBLL = new ElementBLL(); elementBLL.CreateElement(element); return("要素目录新增成功"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string protonNum = Request.QueryString["id"]; ElementBLL eleBLL = new ElementBLL(); Element element = eleBLL.GetElement(int.Parse(protonNum)); if (element == null) { stateLabel.Text = "Error in finding Element details"; } else { protonNumberLabel.Text = element.ProtonNumber.ToString(); nameLabel.Text = element.Name; chemicalSymbolLabel.Text = element.ChemicalSymbol; atomicRadiusLabel.Text = element.AtomicRadius.ToString(); relativeAtomicMassLabel.Text = element.RelativeAtomicMass.ToString(); densityLabel.Text = element.Density.ToString(); isMetalRadioButtonList.SelectedValue = element.IsMetal.ToString(); boilingPointLabel.Text = element.BoilingPoint.ToString(); meltingPointLabel.Text = element.MeltingPoint.ToString(); descriptionTextBox.Text = element.Description; if (element.MeltingPoint < 30) { stateLabel.Text = "Solid"; } if (element.MeltingPoint == 30) { stateLabel.Text = "Liquid"; } if (element.BoilingPoint < 30 && element.MeltingPoint > 30) { stateLabel.Text = "Liquid"; } if (element.BoilingPoint == 30) { stateLabel.Text = "Liquid + Gas"; } if (element.BoilingPoint > 30) { stateLabel.Text = "Gas"; } } } }
protected void gvElements_RowCommand(object sender, GridViewCommandEventArgs e) { int rowNum = int.Parse(e.CommandArgument.ToString()); GridViewRow grRow = gvElements.Rows[rowNum]; string protonNum = grRow.Cells[0].Text; if (e.CommandName == "Select") { Response.Redirect(String.Format("ElementDetails.aspx?id={0}", protonNum)); } else if (e.CommandName == "Delete") { ElementBLL deleteValue = new ElementBLL(); int results = deleteValue.DeleteElement(int.Parse(protonNum)); Response.Redirect("VoewElements.aspx"); } }
protected void okButton_Click(object sender, EventArgs e) { string error; ElementBLL eleELL = new ElementBLL(); string image = ""; if (elementImageFileUpload.HasFile) { image = "Images\\" + elementImageFileUpload.FileName; } string msg = eleELL.InsertElement(protonNumberTextBox.Text, nameTextBox.Text, chemicalSymbolTextBox.Text, atomicRadiusTextBox.Text, relativeAtomicMassTextBox.Text, densityTextBox.Text, isMetalRadioButtonList.SelectedValue, boilingPointTextBox.Text, meltingPointTextBox.Text, descriptionTextBox.Text, elementImageFileUpload.FileName); if (msg == "Insert Sucess") { string saveimg = Server.MapPath(" ") + "\\" + image; statusLabel.Text = msg.ToString(); elementImageFileUpload.SaveAs(saveimg); } statusLabel.Text = msg; }
public List <Element> GetAllElementByEID(string EID) { ElementBLL elementBLL = new ElementBLL(); return(elementBLL.GetAllElementByEID(EID)); }
public List <Element> GetAllElementByResourceID(string RID) { ElementBLL elementBLL = new ElementBLL(); return(elementBLL.GetAllElementByResourceID(RID)); }