private void InitControls() { LockControls = true; BtnPrint = new SimpleButton(); BtnExport = new SimpleButton(); HelpControlExt.AutoSetTabIndex(groupControl1.Controls); HelpControlExt.AutoSetTabIndex(groupControl2.Controls); FormClosing += delegate(object sender, FormClosingEventArgs e) { if (_isAdd == false) GetUpdateData(); if (_noConfirm == false && (_isAdd == true || (_isAdd == false && _doLichPhatSong.Compare(_rootLichPhatSong) == false))) { var value = AppCtrl.ShowConfirmMessgaeBeforeClose(); if (value == DialogResult.Cancel) { e.Cancel = true; return; } if (value == DialogResult.Yes) { if (Save2() == false) e.Cancel = true; } } if (_frmSearch == null) return; _frmSearch.close = true; _frmSearch.Close(); }; //HelpControlExt.AutoSetTabIndex(this); DMTietMuc.InitCtrl(TietMuc, _isAdd == null); DMDaiTruyenHinh.InitCtrl(KenhPhat, _isAdd); DMNuocSanXuat.InitCtrl(NuocSX, _isAdd); DMPostMaster.InitCtrl(PostMaster, _isAdd); AppCtrl.InitCtrlThuTrongTuan(ThuTrongTuan); NgayBatDau.Properties.DisplayFormat.FormatString = "dddd , " + FrameworkParams.option.dateFormat; NgayPhatCuoi.Properties.DisplayFormat.FormatString = "dddd , " + FrameworkParams.option.dateFormat; AppCtrl.SetMaskNam(NamSX); SoTapNgay.Properties.MinValue = 1; SoTapNgay.Properties.MaxValue = decimal.MaxValue; string sql = string.Format(@"select ct.ct_id, {0}, {1}, tm.name tiet_muc_name, (select list_name from get_nuoc_san_xuat(ct.nuoc_san_xuat)) nuoc_san_xuat_name, dmpm.name post_master,pm.ctpm_id,d.name cong_ty,pm.tong_tap from chuong_trinh ct inner join chuong_trinh_post_master pm on pm.ct_id=ct.ct_id left join dm_post_master dmpm on dmpm.id=pm.post_master_id left join dm_tiet_muc tm on ct.tiet_muc=tm.id left join DEPARTMENT d on d.id=ct.cong_ty where ( ct.is_delete='N' or ct.is_delete is null) order by ct.noi_dung,d.name, dmpm.name ", DAKeHoachLPS.GetCTSqlField("CT"), DAKeHoachLPS.GetCTPMSqlFields("PM")); DataSet dsCtr = HelpDB.getDBService().LoadDataSet(sql, CHUONG_TRINH.TABLE_NAME); NoiDung._init(dsCtr.Tables[0], "NOI_DUNG", "CTPM_ID", "", new[] { "NOI_DUNG", "POST_MASTER","TONG_TAP", "TIET_MUC_NAME", "NUOC_SAN_XUAT_NAME", "TRONG_KHO","CONG_TY", "MA_CT" }, new[] { "Nội dung", "Post/Master","Tổng tập", "Tiết mục", "Nước sản xuất", "Trong kho","Công ty", "Mã chương trình " }, new[] { 100, 100, 100, 100, 100, 100,100,100 }); NoiDung.MainCtrl.Properties.BestFitMode = BestFitMode.BestFitResizePopup; NoiDung.MainCtrl.Properties.BestFit(); NoiDung.MainCtrl.ButtonClick += delegate(object sender, ButtonPressedEventArgs e) { if (e.Button.Tag != null && e.Button.Tag.ToString() == "OPEN") { var rowView = (DataRowView) NoiDung.MainCtrl.Properties.GetDataSourceRowByKeyValue( NoiDung._getSelectedID()); if (rowView == null) return; long ctID = HelpNumber.ParseInt64(rowView.Row[QL_LICH_PHAT_SONG.CT_ID]); if ( ChuongTrinhPermission.I._CheckPerChuongTrinh( RES_PERMISSION_TYPE.READ, ctID) == false) { HelpMsgBox.ShowNotificationMessage( "Bạn không được phép xem chương trình này!"); return; } var frm = new FrmChuongTrinh( HelpNumber.ParseInt64(ctID), null); HelpProtocolForm.ShowModalDialog(this, frm); } }; }
private void gridViewDetail_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (e.Button == MouseButtons.Left && e.Clicks == 2) { GridView view = sender as GridView; DataRow r = view.GetDataRow(e.RowHandle); if (r == null) return; FrmChuongTrinh frm = new FrmChuongTrinh(HelpNumber.ParseInt64(r[CHUONG_TRINH.CT_ID]), null); HelpProtocolForm.ShowModalDialog(this, frm); } }
private void InitRowMenu(int handel, DataRow rowHandel) { barManager1.RepositoryItems.Clear(); barManager1.Items.Clear(); popupMenu1.ItemLinks.Clear(); DataRow cr = gridViewDetail.GetDataRow(handel); var itemCopy = new BarButtonItem(barManager1, "Sao chép dòng này") { Glyph = HelpImage.getImage2020("copy.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlC) }; //, -1, new BarShortcut(Shortcut.CtrlC)); var itemCut = new BarButtonItem(barManager1, "Cắt dòng này") { Glyph = HelpImage.getImage2020("cut.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlX) }; var itemPaste = new BarButtonItem(barManager1, "Dán tại dòng này") { Glyph = HelpImage.getImage2020("paste.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlV) }; var itemDelete = new BarButtonItem(barManager1, "Xóa dòng này") { Glyph = HelpImage.getImage2020("delete.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlDel) }; var itemDeleteAll = new BarButtonItem(barManager1, "Xóa cả vệt giờ này") { Glyph = HelpImage.getImage2020("deleteall.png"), ItemShortcut = new BarShortcut(Shortcut.ShiftDel) }; var itemCopyTo = new BarSubItem(barManager1, "Sao chép dòng này đến") { Glyph = HelpImage.getImage2020("copyto.png") }; var itemMoveTo = new BarSubItem(barManager1, "Di chuyển dòng này đến") { Glyph = HelpImage.getImage2020("moveto.png") }; var itemCopyAllTo = new BarSubItem(barManager1, "Sao chép cả vệt " + ((DateTime)cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]).ToString("HH:mm") + " đến") { Glyph = HelpImage.getImage2020("copyallto.png") }; var itemMoveAllTo = new BarSubItem(barManager1, "Di chuyển cả vệt " + ((DateTime)cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]).ToString("HH:mm") + " đến") { Glyph = HelpImage.getImage2020("moveallto.png") }; var itemOpen = new BarButtonItem(barManager1, "Mở chương trình") { Glyph = FWImageDic.VIEW_IMAGE20, ItemShortcut = new BarShortcut(Shortcut.CtrlO) }; var itemRefresh = new BarButtonItem(barManager1, "Làm mới") { Glyph = HelpImage.getImage2020("Restore.png"), ItemShortcut = new BarShortcut(Shortcut.F5) }; var itemCopyClipboard = new BarButtonItem(barManager1, "Sao chép dòng này đến Clipboard") { Glyph = HelpImage.getImage2020("clipboard.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlShiftC) }; var itemCopyVetClipboard = new BarButtonItem(barManager1, "Sao chép cả vệt " + ((DateTime) cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]). ToString("HH:mm") + " đến Clipboard") { Glyph = HelpImage.getImage2020("clipboard.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlShiftV) }; var itemCopyAllClipboard = new BarButtonItem(barManager1, "Sao chép cả lưới đến Clipboard") { Glyph = HelpImage.getImage2020("clipboard.png"), ItemShortcut = new BarShortcut(Shortcut.CtrlShiftA) }; //, -1, new BarShortcut(Shortcut.CtrlC)); var timeEdit = new RepositoryItemTimeEdit(); timeEdit.Mask.EditMask = "HH:mm"; timeEdit.Mask.UseMaskAsDisplayFormat = true; var timeItem = new BarEditItem(barManager1, timeEdit) { PaintStyle = BarItemPaintStyle.Standard }; itemCopyAllTo.AddItem(timeItem); itemCopyTo.AddItem(timeItem); itemMoveAllTo.AddItem(timeItem); itemMoveTo.AddItem(timeItem); timeItem.Width = 60; timeItem.Edit.DoubleClick += delegate { BarItemLink link = barManager1.ActiveEditItemLink; object obj = barManager1.ActiveEditor.EditValue; if (obj == null || !(obj is DateTime)) return; DataRow r = gridViewDetail.GetDataRow(handel); var time = (DateTime)obj; time = new DateTime(1900, 1, 1, time.Hour, time.Minute, 0); if (link.OwnerItem == itemCopyTo) { CutCopyTo(r, time, true); } else if (link.OwnerItem == itemMoveTo) { CutCopyTo(r, time, false); } else if (link.OwnerItem == itemCopyAllTo) { CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, true); } else if (link.OwnerItem == itemMoveAllTo) { CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, false); } popupMenu1.HidePopup(); }; timeItem.ItemDoubleClick += delegate(object sender, ItemClickEventArgs e) { DataRow r = gridViewDetail.GetDataRow(handel); object obj = barManager1.ActiveEditor.EditValue; if (obj == null || !(obj is DateTime)) return; var time = (DateTime)obj; time = new DateTime(1900, 1, 1, time.Hour, time.Minute, 0); if (e.Link.OwnerItem == itemCopyTo) { CutCopyTo(r, time, true); } else if (e.Link.OwnerItem == itemMoveTo) { CutCopyTo(r, time, false); } else if (e.Link.OwnerItem == itemCopyAllTo) { CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, true); } else if (e.Link.OwnerItem == itemMoveAllTo) { CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, false); } popupMenu1.HidePopup(); }; if (_dtGioPhat != null) { foreach (DataRow rTime in _dtGioPhat.Rows) { if (rTime[KE_HOACH_LPS_CT.GIO_PHAT_SONG] is DBNull || rTime[KE_HOACH_LPS_CT.GIO_PHAT_SONG].Equals(rowHandel[KE_HOACH_LPS_CT.GIO_PHAT_SONG])) continue; var time = (DateTime)rTime[KE_HOACH_LPS_CT.GIO_PHAT_SONG]; var item = new BarButtonItem(barManager1, time.ToString("HH:mm")) { PaintStyle = BarItemPaintStyle.Standard, Tag = time }; itemCopyAllTo.AddItem(item); itemCopyTo.AddItem(item); itemMoveAllTo.AddItem(item); itemMoveTo.AddItem(item); item.ItemClick += delegate(object sender, ItemClickEventArgs e) { DataRow r = gridViewDetail.GetDataRow(handel); if (e.Link.OwnerItem == itemCopyTo) { CutCopyTo(r, time, true); } else if (e.Link.OwnerItem == itemMoveTo) { CutCopyTo(r, time, false); } else if (e.Link.OwnerItem == itemCopyAllTo) { CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, true); } else if (e.Link.OwnerItem == itemMoveAllTo) { CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, false); } }; } } // ReSharper disable ImplicitlyCapturedClosure itemCopy.ItemClick += (sender, e) => { _rowCut = null; _rowCopy = gridViewDetail.GetDataRow(handel); }; itemCut.ItemClick += (sender, args) => { _rowCopy = null; _rowCut = gridViewDetail.GetDataRow(handel); }; itemPaste.ItemClick += (sender, e) => Paste(handel); itemDelete.ItemClick += (sender, e) => DeleteRow(handel); itemDeleteAll.ItemClick += (sender, e) => DeleteVetGio(handel); itemRefresh.ItemClick += (sender, e) => { gridViewDetail.RefreshData(); gridViewDetail.UpdateGroupSummary(); }; itemOpen.ItemClick += (sender, e) => { long ctID = HelpNumber.ParseInt64(cr[KE_HOACH_LPS_CT.CT_ID]); if ( ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.READ, ctID) == false) { HelpMsgBox.ShowNotificationMessage( "Bạn không được phép xem chương trình này!"); return; } var frm = new FrmChuongTrinh(ctID, null); HelpProtocolForm.ShowModalDialog(this, frm); }; itemCopyClipboard.ItemClick += (sender, e) => { gridViewDetail.BeginSelection(); gridViewDetail.ClearSelection(); gridViewDetail.SelectRow(handel); gridViewDetail.EndSelection(); gridViewDetail.CopyToClipboard(); }; itemCopyAllClipboard.ItemClick += (sender, e) => CopyClipboard(null); itemCopyVetClipboard.ItemClick += (sender, e) => CopyClipboard((DateTime)cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]); // ReSharper restore ImplicitlyCapturedClosure if (IsAdd == null) { popupMenu1.ItemLinks.AddRange(new BarItem[] { itemOpen,itemCopyClipboard,itemCopyVetClipboard,itemCopyAllClipboard, itemRefresh }); popupMenu1.ItemLinks[1].BeginGroup = true; popupMenu1.ItemLinks[4].BeginGroup = true; } else { popupMenu1.ItemLinks.AddRange(new BarItem[] { itemCopy, itemCut, itemPaste, itemDelete, itemDeleteAll, itemCopyTo, itemMoveTo, itemCopyAllTo, itemMoveAllTo, itemOpen,itemCopyClipboard,itemCopyVetClipboard,itemCopyAllClipboard, itemRefresh }); popupMenu1.ItemLinks[5].BeginGroup = true; popupMenu1.ItemLinks[7].BeginGroup = true; popupMenu1.ItemLinks[9].BeginGroup = true; popupMenu1.ItemLinks[10].BeginGroup = true; popupMenu1.ItemLinks[13].BeginGroup = true; } itemPaste.Enabled = _rowCopy != null || _rowCut != null; }
public override void ShowUpdateForm(long id) { if (_selectedGroup == groupControlCT.Name) { if (ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.UPDATE, id) == false) { HelpMsgBox.ShowNotificationMessage("Bạn không được phép sửa chương trình đang chọn!"); return; } var frm = new FrmChuongTrinh(id, false); HelpProtocolForm.ShowModalDialog(this, frm); } else if (_selectedGroup == groupControlPM.Name) { DataRow r = gridViewDetail.GetFocusedDataRow(); if (r == null) return; long ctpmId=HelpNumber.ParseInt64(r[CHUONG_TRINH_POST_MASTER.CTPM_ID]); if (ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.UPDATE, HelpNumber.ParseInt64(r[CHUONG_TRINH_POST_MASTER.CT_ID])) == false) { HelpMsgBox.ShowNotificationMessage("Bạn không được phép sửa Post/Master đang chọn!"); return; } var frm = new frmPostMaster(ctpmId, false); HelpProtocolForm.ShowModalDialog(this, frm); } else { DataRow r = gridViewBienMuc.GetFocusedDataRow(); if (r == null) return; long bmId=HelpNumber.ParseInt64(r[BIEN_MUC.BM_ID]); if (ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.UPDATE, HelpNumber.ParseInt64(r[BIEN_MUC.CT_ID])) == false) { HelpMsgBox.ShowNotificationMessage("Bạn không được phép sửa biên mục đang chọn!"); return; } var frm = new frmBienMuc(bmId, false); HelpProtocolForm.ShowModalDialog(this, frm); } }
public override void ShowViewForm(long id) { if (_selectedGroup == groupControlCT.Name) { var frm = new FrmChuongTrinh(id, null); HelpProtocolForm.ShowModalDialog(this, frm); } else if (_selectedGroup == groupControlPM.Name) { DataRow r = gridViewDetail.GetFocusedDataRow(); if (r == null) return; var frm = new frmPostMaster(HelpNumber.ParseInt64(r[CHUONG_TRINH_POST_MASTER.CTPM_ID]), null); HelpProtocolForm.ShowModalDialog(this, frm); } else { DataRow r = gridViewBienMuc.GetFocusedDataRow(); if (r == null) return; var frm = new frmBienMuc(HelpNumber.ParseInt64(r[BIEN_MUC.BM_ID]), null); HelpProtocolForm.ShowModalDialog(this, frm); } }
private void NoiDung_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (ChuongTrinh.CT_ID == -1) return; if (ChuongTrinh.DSNgayPhatDauTien == null)//detail=null DAChuongTrinh.I.LoadDetailChuongTrinh(ChuongTrinh); FrmChuongTrinh frm = new FrmChuongTrinh(ChuongTrinh, (IsAdd == true || IsAdd == false ? false : IsAdd)); long pmid = PostMaster._getSelectedID(); frm.AfterSaveSuccessfully += delegate(bool? IsAddd, DOChuongTrinh ChuongTrinhh) { //MaChuongTrinh._setSelectedID(-1); MaChuongTrinh._refresh(DAChuongTrinh.I.GetTableChuongTrinh(IsAdd, ChuongTrinh.CT_ID)); //DAChuongTrinh.InitCtrlChuongTrinh(MaChuongTrinh, IsAdd, ChuongTrinh.CT_ID); popupContainerEditCTr_EditValueChanged(null, null); PostMaster._setSelectedID(pmid); popupContainerEditPM_EditValueChanged(null, null); if (IsAdd == false) { this.BienMuc = DABienMuc.I.LoadAll(this.BienMuc.BM_ID); UpdateControl(this.BienMuc); } }; HelpProtocolForm.ShowModalDialog(this, frm); }
public override long[] ShowAddForm() { var frm = new FrmChuongTrinh("-2", true); HelpProtocolForm.ShowModalDialog(this, frm); return null; }
private void gridViewDetail_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (e.Button == MouseButtons.Left && e.Clicks == 2) { DataRow cr = gridViewDetail.GetDataRow(e.RowHandle); if (cr == null) return; long ctID = HelpNumber.ParseInt64(cr[KE_HOACH_LPS_CT.CT_ID]); if (ctID < 1) return; if ( ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.READ, ctID) == false) { HelpMsgBox.ShowNotificationMessage( "Bạn không được phép xem chương trình này!"); return; } var frm = new FrmChuongTrinh(ctID, null); HelpProtocolForm.ShowModalDialog(this, frm); } }
void gridViewSoRun_RowClick(object sender, RowClickEventArgs e) { if (e.Clicks == 2 && e.Button == System.Windows.Forms.MouseButtons.Left) { if (e.RowHandle < 0) return; DataRow r = gridViewSoRun.GetDataRow(e.RowHandle); FrmChuongTrinh c = new FrmChuongTrinh(HelpNumber.ParseInt64(r[CHUONG_TRINH.CT_ID]), null); HelpProtocolForm.ShowModalDialog(this, c); } }
public override void ShowViewForm(long id) { string sPage = xtraTabControlDetail.SelectedTabPage.Name; if (sPage == pageBanQuyen.Name) { DataRow r = gridViewMaster.GetFocusedDataRow(); if (r != null) { FrmChuongTrinh frm = new FrmChuongTrinh(HelpNumber.ParseInt64(r[CHUONG_TRINH.CT_ID]), null); HelpProtocolForm.ShowModalDialog(this, frm); } } else if (sPage == pageSoRun.Name) { DataRow r = gridViewSoRun.GetFocusedDataRow(); if (r != null) { FrmChuongTrinh frm = new FrmChuongTrinh(HelpNumber.ParseInt64(r[CHUONG_TRINH.CT_ID]), null); HelpProtocolForm.ShowModalDialog(this, frm); } } else if (sPage == pageMuonTra.Name) { DataRow r = gridViewMuonTra.GetFocusedDataRow(); if (r != null) { frmMuonTra frm = new frmMuonTra(HelpNumber.ParseInt64(r[PHIEU_MUON_TRA.PMT_ID]), null); HelpProtocolForm.ShowModalDialog(this, frm); } } }
public override void ShowUpdateForm(long id) { if (ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.UPDATE, id) == false) { HelpMsgBox.ShowNotificationMessage("Bạn không được phép sửa chương trình đang chọn!"); return; } FrmChuongTrinh frm = new FrmChuongTrinh(id, false); HelpProtocolForm.ShowModalDialog(this, frm); }
public override void ShowViewForm(long id) { var frm = new FrmChuongTrinh(id, null); HelpProtocolForm.ShowModalDialog(this, frm); }