예제 #1
0
        protected void SaveIndBtn_Click(object sender, EventArgs e)
        {
            if (IndicatorIdHiddenField.Value != null)
            {
                int indID = int.Parse(IndicatorIdHiddenField.Value);
                Data_Access.fsda_indicators theIndicator = (from data in db.fsda_indicators
                                                            where data.id == indID
                                                            select data).SingleOrDefault();

                theIndicator.indicator = FSDAIndicator.Text.Trim();

                if (db.SaveChanges() > 0)
                {
                    db.SaveChanges();
                    GridView1.DataBind();
                }
            }
        }
예제 #2
0
        protected void AddIndBtn_Click(object sender, EventArgs e)
        {
            string code = FSDAIndicatorCode.Text.Trim();
            string ind  = FSDAIndicator.Text.Trim();

            var theCode = from data in db.fsda_indicators
                          where data.fsda_indicator_code == code
                          select data;

            if (theCode.Count() > 0)
            {
                AlertLabel.Text = "That code has already been used";

                ScriptManager.RegisterStartupScript(
                    Page,
                    Page.GetType(),
                    "alertModal", "$('#alertModal').modal('show');",
                    true);

                return;
            }
            else
            {
                Data_Access.fsda_indicators newInd = new Data_Access.fsda_indicators();
                newInd.fsda_indicator_code = code;
                newInd.indicator           = ind;

                db.fsda_indicators.Add(newInd);

                if (db.SaveChanges() > 0)
                {
                    db.SaveChanges();
                    GridView1.DataBind();
                }

                ScriptManager.RegisterStartupScript(
                    Page,
                    Page.GetType(),
                    "FSDAIndicatorModal", "$('#FSDAIndicatorModal').modal('hide');",
                    true);
            }
        }