protected void uiButtonUpdate_Click(object sender, EventArgs e) { OrderStatus status = new OrderStatus(); if (CurrentStatus != null) { status = CurrentStatus; } else { status.AddNew(); } status.Name = uiTextBoxName.Text; status.Save(); uiPanelEdit.Visible = false; uiPanelViewStatus.Visible = true; Clearfields(); BindData(); CurrentStatus = null; }
protected void uiGridViewStatus_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditStatus") { OrderStatus orderStatus = new EGEMech.BLL.OrderStatus(); orderStatus.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument)); CurrentStatus = orderStatus; uiTextBoxName.Text = orderStatus.Name; uiPanelViewStatus.Visible = false; uiPanelEdit.Visible = true; } else if (e.CommandName == "DeleteStatus") { try { OrderStatus orderStatus = new EGEMech.BLL.OrderStatus(); orderStatus.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument)); orderStatus.MarkAsDeleted(); orderStatus.Save(); BindData(); } catch (Exception ex) { uiLabelError.Visible = true; } } }