protected void uiGridViewCompanies_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCompany") { IStock.BLL.Companies objData = new IStock.BLL.Companies(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxName.Text = objData.Name; uiTextBoxDesc.Text = objData.Description; uiTextBoxAddress.Text = objData.Address; uiPanelAllCompanies.Visible = false; uiPanelEditCompanies.Visible = true; CurrentCompany = objData; BindComapnies(); } else if (e.CommandName == "DeleteCompany") { try { IStock.BLL.Companies objData = new IStock.BLL.Companies(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentCompany = null; BindComapnies(); } catch (Exception ex) { uipanelError.Visible = true; } } }
protected void uiLinkButtonBack_Click(object sender, EventArgs e) { ClearFields(); CurrentCompany = null; uiPanelEditCompanies.Visible = false; uiPanelAllCompanies.Visible = true; BindComapnies(); }
private void BindComapnies() { IStock.BLL.Companies companies = new IStock.BLL.Companies(); companies.LoadAll(); companies.Sort = "Name"; uiGridViewCompanies.DataSource = companies.DefaultView; uiGridViewCompanies.DataBind(); }
protected void uiLinkButtonOK_Click(object sender, EventArgs e) { IStock.BLL.Companies company = new IStock.BLL.Companies(); if (CurrentCompany == null) company.AddNew(); else company = CurrentCompany; company.Name = uiTextBoxName.Text; company.Description = uiTextBoxDesc.Text; company.Address = uiTextBoxAddress.Text; company.Save(); ClearFields(); CurrentCompany = null; uiPanelEditCompanies.Visible = false; uiPanelAllCompanies.Visible = true; BindComapnies(); }