protected void GridViewDesigners_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "editDesigner") { GeneralLookup designer = new GeneralLookup(); designer.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); txtDesignerAddress.Text = designer.Address; txtDesignerEmail.Text = designer.Email; txtDesignerName.Text = designer.Name; txtDesignerTelephone.Text = designer.Telephone; EditDesigner = int.Parse(e.CommandArgument.ToString()); panelDesignersEdit.Visible = true; panelDesignersGrid.Visible = false; } else if (e.CommandName == "deleteDesigner") { GeneralLookup designer = new GeneralLookup(); designer.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); designer.MarkAsDeleted(); designer.Save(); bindData(); } }
protected void btnSave_Click(object sender, EventArgs e) { GeneralLookup designer = new GeneralLookup(); if (EditDesigner > 0) { designer.LoadByPrimaryKey(EditDesigner); } else { designer.AddNew(); } designer.Name = txtDesignerName.Text; designer.Address = txtDesignerAddress.Text; designer.Email = txtDesignerEmail.Text; designer.Telephone = txtDesignerTelephone.Text; designer.CategoryID = 1; designer.Save(); ClearFields(); bindData(); panelDesignersGrid.Visible = true; panelDesignersEdit.Visible = false; }