Ejemplo n.º 1
0
 private void SupplierForm_Load(object sender, EventArgs e)
 {
     try
     {
         supplierController.GetAllSuppliers(ref dataGridViewSuppliers);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (SupplierId > 0)
                {
                    lblSearchBusiness.Visible = ddlSuppliers.Visible = false;
                }
                else
                {
                    lblSearchBusiness.Visible = ddlSuppliers.Visible = true;
                    //fill suppliers dropDown
                    if (ddlSuppliers.Items.Count == 0)
                    {
                        List <AppSupplier> suppliers = SupplierController.GetAllSuppliers();
                        foreach (var item in suppliers)
                        {
                            ddlSuppliers.Items.Add(new ListItem(item.BusinessName, item.SupplierId.ToString()));
                        }
                    }
                }
                //fill status dropDown
                string[] names  = Enum.GetNames(typeof(CommentStatus));
                Array    values = Enum.GetValues(typeof(CommentStatus));
                for (int i = 0; i < names.Length; i++)
                {
                    ddlStatus.Items.Add(new ListItem(CommentsStrings.GetText(names[i]), ((int)values.GetValue(i)).ToString()));
                }
            }
            int CurrentPageIndex = 0;

            if (!int.TryParse(hfCurrentPageIndex_dgComments.Value, out CurrentPageIndex))
            {
                CurrentPageIndex = 0;
            }
            if (CurrentPageIndex < 0)
            {
                CurrentPageIndex = 0;
            }
            dgComments.CurrentPageIndex = CurrentPageIndex;
            LoadItems();
        }