Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (this.ViewState["Mode"] == null) // Add mode
            {
                SupplySystem.Level level = new SupplySystem.Level { LevelID = Public.ToShort(this.txtCode.Text), LevelName = this.txtLevelName.Text };
                level.SubLevels.Add(new SupplySystem.SubLevel { SubLevelName = "Employees" });
                db.Levels.InsertOnSubmit(level);
            }
            else if (this.ViewState["Mode"].ToString() == "edit") // Edit mode
            {
                db.Levels.First<SupplySystem.Level>(sk => sk.LevelID == Public.ToShort(this.txtCode.Text)).LevelName = this.txtLevelName.Text;
            }

            db.SubmitChanges();
            this.grdLevels.DataSource = db.Levels.ToList<SupplySystem.Level>();
            this.grdLevels.DataBind();
            this.lblMessage.Text = Public.SUCCESSMESSAGE;
            ClearControls();
        }
    }
Пример #2
0
 partial void DeleteLevel(Level instance);
Пример #3
0
 partial void UpdateLevel(Level instance);
Пример #4
0
 partial void InsertLevel(Level instance);