コード例 #1
0
        protected override void ONCREATE()
        {
            CahocBUS ca = new CahocBUS();
            PhonghocBUS phong = new PhonghocBUS();
            var dic = new System.Collections.Generic.Dictionary<string, Nullable<System.TimeSpan>[]>();
            tt = new TrangthaiphongBUS();
            txtstmaphong.Properties.Items.AddRange(phong.getdataextract());
            ClassRoomBUS.CahocBUS BUS = new ClassRoomBUS.CahocBUS();
            dic.Add("", new Nullable<System.TimeSpan>[] { new TimeSpan(), new TimeSpan() });
            ca.getdata().ForEach(i =>
            {

                txtstmaca.Properties.Items.Add(i.maca);
                dic.Add(i.maca, new Nullable<System.TimeSpan>[] { System.TimeSpan.Parse(i.thoigianbatdau.ToString()), System.TimeSpan.Parse(i.thoigianketthuc.ToString()) });

            });
            txtstmaca.SelectedIndexChanged += (o, e) =>
            {
                try
                {
                    var d = dic[(string)txtstmaca.SelectedItem];
                    ststarttime.EditValue = new DateTime(d[0].Value.Ticks);
                    stendtime.EditValue = new DateTime(d[1].Value.Ticks);
                }
                catch(Exception ex)
                {
                }
            };

            gridControl1.DataSource = tt.getdata();
            gridView1.RowClick += (o, e) =>
            {
                var row = ((DevExpress.XtraGrid.Views.Grid.GridView)o);
                if (e.RowHandle != -1)
                {

                    var column = row.Columns;
                    txtstmaphong.SelectedItem = row.GetRowCellValue(e.RowHandle, column["maphong"]);
                    txtstmaca.SelectedItem = row.GetRowCellValue(e.RowHandle, column["maca"]);
                    stday.EditValue = row.GetRowCellValue(e.RowHandle, column["thoigianbatdau"]);
                    ststarttime.EditValue = row.GetRowCellValue(e.RowHandle, column["thoigianbatdau"]);
                    stendtime.EditValue = row.GetRowCellValue(e.RowHandle, column["thoigianketthuc"]);
                    oldobj = new trangthaiphong{maphong = txtstmaphong.Text,
                                                maca = txtstmaca.Text,
                                                hientrang = txtsttrangthai.Text,
                                                thoigianbatdau = ststarttime.Time,
                                                thoigianketthuc = stendtime.Time,
                    };

                }

            };

            this.UPClick += UCStateStandart_UPClick;
            this.DELClick += UCStateStandart_DELClick;
            this.ADDClick += UCStateStandart_ADDClick;
        }
コード例 #2
0
 //AppointmentFormOutlook2007Style f = new AppointmentFormOutlook2007Style();
 public UCStateGRUD()
 {
     InitializeComponent();
     TTBUS = new TrangthaiphongBUS();
 }