Ejemplo n.º 1
0
        protected void ButtonAddSupplierContact_Click(object sender, EventArgs e)
        {
            LabelError.Text = "";
            bool hasError = false;

            PanelError.Visible = false;

            if (Convert.ToInt32(DropDownListSupplierContact.SelectedValue) == 0)
            {
                LabelError.Text   += "Supplier Contact is required.\n";
                PanelError.Visible = true;
                hasError           = true;
            }

            if (hasError == false)
            {
                try
                {
                    SupplierContactLink.InsertSupplierContactLink(this.supplierId, Convert.ToInt32(DropDownListSupplierContact.SelectedValue), this.Master.LoggedOnAccount);
                    BindSupplierContactList();
                }
                catch (System.Data.SqlClient.SqlException sqlEx)
                {
                    LabelError.Text = "";
                    for (int i = 0; i < sqlEx.Errors.Count; i++)
                    {
                        LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                    }
                    PanelError.Visible = true;
                }
            }
        }
Ejemplo n.º 2
0
        protected void GridViewSupplierContact_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removesuppliercontact":
                {
                    SupplierContactLink.DeleteSupplierContactLinkBySupplierContactLinkId(Convert.ToInt32(e.CommandArgument));
                    BindSupplierContactList();

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                LabelError.Text = "";
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
        }
Ejemplo n.º 3
0
 private void BindSupplierContact()
 {
     DropDownListSupplierContact.DataSource     = SupplierContactLink.GetSupplierContactListBySupplierId(this.supplierId);
     DropDownListSupplierContact.DataTextField  = "FormattedSupplierContact";
     DropDownListSupplierContact.DataValueField = "SupplierContactId";
     DropDownListSupplierContact.DataBind();
     DropDownListSupplierContact.Items.Insert(0, new ListItem("Please Select", "0"));
 }
Ejemplo n.º 4
0
 private void BindSupplierContactList()
 {
     GridViewResultSupplierContact.DataSource = SupplierContactLink.GetSupplierContactLinkListBySupplierId(this.supplierId);
     GridViewResultSupplierContact.DataBind();
 }