Beispiel #1
0
        public string UpdateElementByEID([FromBody] Element element)
        {
            ElementBLL elementBLL = new ElementBLL();

            elementBLL.UpdateElementByEID(element);
            return("要素目录修改成功");
        }
Beispiel #2
0
        public String DeleteElementByEID(string EID)
        {
            ElementBLL elementBLL = new ElementBLL();

            elementBLL.DeleteElementByEID(EID);
            return("要素信息删除成功");
        }
Beispiel #3
0
        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";
                    }
                }
            }
        }
Beispiel #5
0
        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;
        }
Beispiel #7
0
        public List <Element> GetAllElementByEID(string EID)
        {
            ElementBLL elementBLL = new ElementBLL();

            return(elementBLL.GetAllElementByEID(EID));
        }
Beispiel #8
0
        public List <Element> GetAllElementByResourceID(string RID)
        {
            ElementBLL elementBLL = new ElementBLL();

            return(elementBLL.GetAllElementByResourceID(RID));
        }