Esempio n. 1
0
        protected void uiGridViewLines_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditLine")
            {
                IStock.BLL.Lines objData = new IStock.BLL.Lines();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxName.Text = objData.Name;
                uiTextBoxDesc.Text = objData.Description;

                uiPanelAllLines.Visible = false;
                uiPanelEditLine.Visible = true;
                CurrentLine = objData;

                BindLines();
            }
            else if (e.CommandName == "DeleteLine")
            {
                try
                {
                    IStock.BLL.Lines objData = new IStock.BLL.Lines();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentLine = null;
                    BindLines();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Esempio n. 2
0
 protected void uiLinkButtonBack_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentLine = null;
     uiPanelEditLine.Visible = false;
     uiPanelAllLines.Visible = true;
     BindLines();
 }
Esempio n. 3
0
 private void BindLines()
 {
     IStock.BLL.Lines Supps = new IStock.BLL.Lines();
     Supps.LoadAll();
     Supps.Sort = "Name";
     uiGridViewLines.DataSource = Supps.DefaultView;
     uiGridViewLines.DataBind();
 }
Esempio n. 4
0
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            IStock.BLL.Lines line = new IStock.BLL.Lines();
            if (CurrentLine == null)
                line.AddNew();
            else
                line = CurrentLine;

            line.Name = uiTextBoxName.Text;
            line.Description = uiTextBoxDesc.Text;
            line.Save();
            ClearFields();
            CurrentLine = null;
            uiPanelEditLine.Visible = false;
            uiPanelAllLines.Visible = true;
            BindLines();
        }