コード例 #1
0
        // try
        //    {
        //        using (DEWSRMEntities db = new DEWSRMEntities())
        //        {
        //            List<Category> _Categorys = db.Categorys.OrderBy(c=>c.Code).ToList();

        //            ListViewItem item = null;
        //             lsvCategory.Items.Clear();

        //            if (_Categorys != null)
        //            {
        //                foreach (Category grd in _Categorys)
        //                {
        //                    item = new ListViewItem();
        //                    item.Text = grd.Code;
        //                    item.SubItems.Add(grd.Description);
        //                    //item.SubItems.Add(((EnumCategoryType)grd.CategoryType).ToString());
        //                    item.Tag = grd;
        //                    lsvCategory.Items.Add(item);
        //                }

        //                lblTotal.Text = "Total :" + _Categorys.Count().ToString();
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}

        #region Events
        private void btnNew_Click(object sender, EventArgs e)
        {
            fBank frm = new fBank();

            frm.ItemChanged = RefreshList;
            frm.ShowDlg(new Bank(), true);
        }
コード例 #2
0
        private void btnNewItem_Click(object sender, EventArgs e)
        {
            fBank oF = new fBank();

            oF.ShowDlg(new Bank(), true);
            // PopulateCategoryCbo();
        }
コード例 #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                using (DEWSRMEntities db = new DEWSRMEntities())
                {
                    int[]       selRows = ((GridView)grdBanks.MainView).GetSelectedRows();
                    DataRowView oBankD  = (DataRowView)(((GridView)grdBanks.MainView).GetRow(selRows[0]));

                    int  nBankID = Convert.ToInt32(oBankD["BankID"]);
                    Bank oBank   = db.Banks.FirstOrDefault(p => p.BankID == nBankID);


                    if (oBank == null)
                    {
                        MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    fBank frm = new fBank();
                    frm.ItemChanged = RefreshList;
                    frm.ShowDlg(oBank, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //if (lsvCategory.SelectedItems.Count <= 0)
            //{
            //    MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            //Category Category = null;
            //fCategory frm = new fCategory();

            //if (lsvCategory.SelectedItems != null && lsvCategory.SelectedItems.Count > 0)
            //{
            //    Category = (Category)lsvCategory.SelectedItems[0].Tag;
            //}
            //frm.ItemChanged = RefreshList;
            //frm.ShowDlg(Category,false);
        }