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

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

                uiPanelAllSupp.Visible = false;
                uiPanelEditSupplier.Visible = true;
                CurrentSupplier = objData;

                BindSupplier();
            }
            else if (e.CommandName == "DeleteSupp")
            {
                try
                {
                    IStock.BLL.Suppliers objData = new IStock.BLL.Suppliers();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentSupplier = null;
                    BindSupplier();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Esempio n. 2
0
 protected void uiLinkButtonBack_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentSupplier = null;
     uiPanelEditSupplier.Visible = false;
     uiPanelAllSupp.Visible = true;
     BindSupplier();
 }
Esempio n. 3
0
 private void BindSupplier()
 {
     IStock.BLL.Suppliers Supps = new IStock.BLL.Suppliers();
     Supps.LoadAll();
     Supps.Sort = "Name";
     uiGridViewSupps.DataSource = Supps.DefaultView;
     uiGridViewSupps.DataBind();
 }
Esempio n. 4
0
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            IStock.BLL.Suppliers Supp = new IStock.BLL.Suppliers();
            if (CurrentSupplier == null)
                Supp.AddNew();
            else
                Supp = CurrentSupplier;

            Supp.Name = uiTextBoxName.Text;
            Supp.Description = uiTextBoxDesc.Text;
            Supp.Save();
            ClearFields();
            CurrentSupplier = null;
            uiPanelEditSupplier.Visible = false;
            uiPanelAllSupp.Visible = true;
            BindSupplier();
        }