public object _RefreshAction(params object[] input)
 {
     do_TT = DATinTuc.Instance.get_TinTuc(null,true);
     if (do_TT != null) do_Luu_Tru_TT = DATinTuc.Instance.get_TapTin(do_TT.ID);
     this.ThongTinNoiBat(do_TT, do_Luu_Tru_TT);
     return null;
 }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     //Lấy tin mới hiển thị (Phải comment đoạn này lại trước khi mở xem Design)
     do_TT = DATinTuc.Instance.get_TinTuc(null, true);
     if (do_TT != null) do_Luu_Tru_TT = DATinTuc.Instance.get_TapTin(do_TT.ID);
     this.ThongTinNoiBat(do_TT, do_Luu_Tru_TT);
 }
 public void frm_UpdateTapTin1(object sender, DOLuuTruTapTin doLuuTruTapTin)
 {
     //edit lại list_do_taptin khi sửa 1 tập tin vừa mới thêm vào
     foreach (DOLuuTruTapTin do_lttt in list_do_taptin)
     {
         if (do_lttt.ID == doLuuTruTapTin.ID)
         {
             do_lttt.TIEU_DE = doLuuTruTapTin.TIEU_DE;
             do_lttt.NOI_DUNG = doLuuTruTapTin.NOI_DUNG;
             do_lttt.GHI_CHU = doLuuTruTapTin.GHI_CHU;
             do_lttt.TEN_FILE = doLuuTruTapTin.TEN_FILE;
         }
     }
 }
 private void ThongTinNoiBat(DOTinTuc TTNew,DOLuuTruTapTin TAP_TIN)
 {
     try
     {
         if (TTNew != null)
         {
             do_TT = TTNew;
             do_luu_tru_tt = TAP_TIN;
             Chu_de.Text = TTNew.TIEU_DE;
             if (TAP_TIN.TEN_FILE != string.Empty)
             {
                 lbl_TTDK.Text = TAP_TIN.TEN_FILE;
                 lbl_TTDK.Visible = true;
                 labelControl1.Visible = true;
             }
             else
             {
                 lbl_TTDK.Visible = false;
                 labelControl1.Visible = false;
             }
             lblNguoi_cap_nhat.Text = ProtocolVN.DanhMuc.DMFWNhanVien.GetFullName(TTNew.NGUOI_CAP_NHAT);
             lbl_Thoi_gian_cap_nhat.Text = TTNew.NGAY_CAP_NHAT.ToString(PLConst.FORMAT_DATETIME_STRING).Trim();
             Web_QuaTrinhDaoTao.DocumentText = HelpByte.BytesToUTF8String(TTNew.NOI_DUNG);
             popupControlContainer1.Visible =true;
             barSubItem1.Enabled = true;
         }
         else
         {
             popupControlContainer1.Visible = false;
             Web_QuaTrinhDaoTao.DocumentText = string.Empty;
             barSubItem1.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         PLException.AddException(ex);
     }
 }
 private void frmTinTucQL_Load(object sender, EventArgs e)
 {
     IsLoad = true;
     gridControlMaster.Load += new EventHandler(gridControlMaster_Load);
     //Thiết lập cho menu nghiệp vụ
     if (barSubItem1.ItemLinks.Count > 0)
     {
         item_TL = barSubItem1.ItemLinks[0].Item as BarButtonItem;
         item_HuyTL = barSubItem1.ItemLinks[1].Item as BarButtonItem;
     }
         //Gán sự kiện cho các nút
     lbl_TTDK.Click += delegate(object lbl_TTDK1, System.EventArgs Click)
     {
         frmSaveOpen frm = new frmSaveOpen(do_luu_tru_tt.NOI_DUNG, do_luu_tru_tt.TEN_FILE);
         ProtocolForm.ShowModalDialog(this, frm);
     };
     lbl_TTDK.MouseMove += delegate(object lbl_TTDK2, MouseEventArgs M_Move)
     {
         lbl_TTDK.ForeColor = Color.Red;
     };
     lbl_TTDK.MouseLeave += delegate(object lbl_TTDK3, System.EventArgs M_Leave)
     {
         lbl_TTDK.ForeColor = Color.Blue;
     };
     DataSet ds = DATinTuc.Instance.Get_5_tin(PLNhomTT._getSelectedID(), dateTungay.DateTime, dateDenngay.DateTime,DuyetSelect);
     //Load tin tức nổi bật
     if (ds.Tables[0].Rows.Count > 0)
     {
         do_TT = DATinTuc.Instance.get_TinTuc(HelpNumber.ParseInt64(ds.Tables[0].Rows[0]["ID"]));
         if (do_TT != null) do_luu_tru_tt = DATinTuc.Instance.get_TapTin(do_TT.ID);
         this.ThongTinNoiBat(do_TT, do_luu_tru_tt);
         barSubItem1.Enabled = true;
         gridControlMaster.DataSource = ds.Tables[0];
     }
     else barSubItem1.Enabled = false;
     barButtonItemDuyet.ItemClick += new ItemClickEventHandler(barButtonItemDuyet_ItemClick);
     barButtonItemK_Duyet.ItemClick += new ItemClickEventHandler(barButtonItemK_Duyet_ItemClick);
     HookFocusRow();
 }
 public void frm_UpdateTapTin(object sender, DOLuuTruTapTin doLuuTruTapTin)
 {
     DataRow r = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle);
     DADuAn.Instance.UpdateDATT(HelpNumber.ParseInt64(r["ID"]), doLuuTruTapTin.ID);
 }
 public void frm_UpdateTapTin(object sender, DOLuuTruTapTin doLuuTruTapTin)
 {
     list_do_taptin.Add(doLuuTruTapTin);
 }
        private void ImageToDB(string[] File_names)
        {
            do_TT = DALuuTruTapTin.Instance.Load_For_Image(-2);
            DataSet GridDataset = do_TT.DetailDataset.Copy();
            long PL_ID = HelpNumber.ParseInt64(itemSelect.Name);
            Load_Image_table(PL_ID);
            DataSet Ds_for_duplicated_image = Image_Dataset.Copy();
            GridDataset.Tables[0].Columns.Add("OBJECT_ID", Type.GetType("System.Int64"));
            DateTime Ngay_cap_nhat = HelpDB.getDatabase().GetSystemCurrentDateTime();
            long Nguoi_cap_nhat = FrameworkParams.currentUser.employee_id;

            WaitingMsg m = new WaitingMsg();
            foreach (string file in File_names)
            {
                //string Extension = Path.GetExtension(file).ToLower();
                //if (Extension == ".jpg" || Extension == ".jpeg" || Extension == ".gif" || Extension == ".bmp" || Extension == ".png")
                //{
                    DataRow row = GridDataset.Tables[0].NewRow();
                    row["ID"] = DABase.getDatabase().GetID("G_NGHIEP_VU");
                    row["TEN_FILE"] = Path.GetFileName(file);
                    row["NOI_DUNG"] = HelpByte.FileToBytes(file);
                    row["NGAY_CAP_NHAT"] = Ngay_cap_nhat;
                    row["NGUOI_CAP_NHAT"] = Nguoi_cap_nhat;
                    row["OBJECT_ID"] = PL_ID;
                    GridDataset.Tables[0].Rows.Add(row);
                    HelpDataSet.MergeDataSet(new string[] { "OBJECT_ID", "TEN_FILE" }, Ds_for_duplicated_image, GridDataset);
                    if (Ds_for_duplicated_image.Tables[0].Rows.Count == Image_Dataset.Tables[0].Rows.Count)//Duplicate image has just inserted.
                    {
                        m.Finish();
                        if (HelpMsgBox.ShowConfirmMessage("Ảnh '" + row["TEN_FILE"] + "' đã tồn tại." + Environment.NewLine + "Bạn có muốn ảnh này thay thế ảnh cũ không?") == DialogResult.Yes)
                        {
                            Application.DoEvents();
                            m = new WaitingMsg();
                            DataRow[] Task_row = Image_Dataset.Tables[0].Select("OBJECT_ID=" + PL_ID);
                            foreach (DataRow row_item in Task_row)
                            {
                                if (row_item["TEN_FILE"].ToString() == row["TEN_FILE"].ToString())
                                {
                                    //Delete duplicated image from DB
                                    DALuuTruTapTin.Instance.Delete(HelpNumber.ParseInt64(row_item["ID"]));
                                    //-------------------------------
                                    //Delete duplicated image from folder
                                    FileInfo fi = new FileInfo(Temp_Path + itemSelect.Caption.ToString() + @"\" + row_item["TEN_FILE"].ToString());
                                    fi.Delete();
                                    //-----------------------------------
                                    Image_Dataset.Tables[0].Rows.Remove(row_item);
                                    Image_Dataset.Tables[0].AcceptChanges();
                                    break;
                                }
                            }
                        }
                        else
                            GridDataset.Tables[0].Rows.Remove(row);
                    //}
                }
            }
            if (GridDataset.Tables[0].Rows.Count > 0)
            {
                HelpDataSet.MergeDataSet(new string[] { "ID" }, do_TT.DetailDataset, GridDataset);
                HelpDataSet.MergeDataSet(new string[] { "ID" }, Image_Dataset, GridDataset);
                DALuuTruTapTin.Instance.UpdateDataset(do_TT);
                foreach (DataRow row in GridDataset.Tables[0].Rows)
                {
                    InsertTo_HINH_ANH_TAP_TIN(PL_ID, HelpNumber.ParseInt64(row["ID"]));
                }
            }
            if (m != null) m.Finish();
            Application.DoEvents();
            HelpMsgBox.ShowNotificationMessage("Lưu ảnh hoàn tất!");
            Application.DoEvents();
        }
        private void initform()
        {
            AppCtrl.InitTreeChonNhanVien_Choice1(NguoiThucHien, true);
            DMCMucDoUuTien.I.InitCtrl(cboMuc_uu_tien, true, true);
            DMCTinhTrangFax.Instance.InitCtrl(PLTinhtrang);
            lblThoiGianGui.Text = HelpDB.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING);
            plMultiChoiceFiles1._Init(IsAdd, true);
            plMultiChoiceFiles1.repImageFax.Click += new EventHandler(repImageFax_Click);
            if (IsAdd == true)
            {
                do_Fax = DAHoTroFax.Instance.Load(-2);
                do_Fax.ID = HelpDB.getDatabase().GetID("G_NGHIEP_VU");
                _ID = do_Fax.ID;
                do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(-2);
                plMultiChoiceFiles1._DataSource = DALuuTruTapTin.Instance.GetTapTinByObjectID(-2, 11);
                btnLuu.Visible = true;
                lblNguoiGui.Text = DMNhanVienX.I.GetEmployeeFullName(FrameworkParams.currentUser.employee_id);
                PLTinhtrang._setSelectedID(1);
            }
            else
            {
                do_Fax = DAHoTroFax.Instance.Load(_ID);
                plMultiChoiceFiles1._DataSource = DALuuTruTapTin.Instance.GetTapTinByObjectID(_ID, 11);
                do_luu_tru_tt = DADocument.Instance.load_DOTapTin(_ID);
                NguoiThucHien._setSelectedID(HelpNumber.ParseInt64(do_Fax.NGUOI_NHAN_ID));
                cboMuc_uu_tien._setSelectedID(HelpNumber.ParseInt64(do_Fax.MUC_DO_UU_TIEN_ID));
                lblNguoiGui.Text = DMNhanVienX.I.GetEmployeeFullName(do_Fax.NGUOI_GUI_ID);
                txtGuiDenSo.Text = do_Fax.GUI_DEN_SO;
                txtNguoiNhan.Text = do_Fax.TEN_NGUOI_NHAN;
                memoNoiDung.Text = do_Fax.NOI_DUNG_KEM_THEO;
                PLTinhtrang._setSelectedID(do_Fax.TINH_TRANG_FAX_ID);
                if (do_Fax.ID == 0)
                {
                    HelpMsgBox.ShowErrorMessage("Dữ liệu đã bị mất.....");
                    if (HelpMsgBox.ShowConfirmMessage("Bạn có muốn thêm dữ liệu.") == DialogResult.No)
                        return;
                    else
                    {

                        do_Fax = DAHoTroFax.Instance.Load(-2);
                        btnLuu.Visible = true;
                        IsAdd = true;
                        return;
                    }
                }
                if (IsAdd == false)
                {
                    btnLuu.Visible = true;
                }
            }
        }
 /// <summary>
 /// Khởi tạo dữ liệu 
 /// </summary>
 /// <param name="ID"></param>
 private void InitData(long ID)
 {
     if (this.IsAdd == true)
     {
         if (ID > 0)
         {
             PLNhomDienDan._setSelectedID(_Nhom_DD_ID);
             PLNhomDienDan.Enabled = false;
             PLChuyenMuc._setSelectedID(_Chuyen_muc_ID);
             PLChuyenMuc.Enabled = false;
             txtTieude.Enabled = false;
             doBaiViet = null;
         }
         doBaiViet = DABaiViet.Instance.LoadAll(-2);
         do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(-2);
         lblNguoiCapNhat.Text = DMNhanVienX.I.GetEmployeeFullName(FrameworkParams.currentUser.employee_id);
         lblThoiGianCapNhat.Text = DABase.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING);
     }
     else
     {
         doBaiViet = DABaiViet.Instance.LoadAll(ID);
         do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(DABaiViet.Instance.get_TapTin(ID).ID);
         if (DABaiViet.Instance.Da_tra_loi(ID))
         {
             PLNhomDienDan.Enabled = false;
             PLChuyenMuc.Enabled = false;
             txtTieude.Enabled = false;
         }
         lblNguoiCapNhat.Text = DMFWNhanVien.GetFullName(doBaiViet.NGUOI_GUI);
         lblThoiGianCapNhat.Text = doBaiViet.NGAY_GUI.ToString(PLConst.FORMAT_DATETIME_STRING);
         txtTieude.Text = doBaiViet.CHU_DE;
         PLNhomDienDan._setSelectedID(doBaiViet.ID_NHOM_DIEN_DAN);
         PLChuyenMuc._setSelectedID(_Chuyen_muc_ID);
         NoiDung._setValue(doBaiViet.NOI_DUNG);
         //CHAUTV: Áp dụng control mới
         this.fileDinhKem._setFileName(do_luu_tru_tt.TEN_FILE, do_luu_tru_tt.NOI_DUNG);
         if (this.IsAdd == null)
             this.fileDinhKem.ReadOnly(true);
     }
 }
 /// <summary>
 /// Khởi tạo dữ liệu 
 /// </summary>
 /// <param name="ID"></param>
 private void InitData(long ID)
 {
     try
     {
         if (this.IsAdd == true)
         {
             doTinTuc = DATinTuc.Instance.LoadAll(-2);
             do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(-2);
             lblNguoiCapNhat.Text = DMFWNhanVien.GetFullName(FrameworkParams.currentUser.employee_id);
             lblThoiGianCapNhat.Text = DABase.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING);
             doTinTuc.DUYET = "1";
         }
         else
         {
             doTinTuc = DATinTuc.Instance.LoadAll(ID);
             do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(DATinTuc.Instance.get_TapTin(ID).ID);
             lblNguoiCapNhat.Text = DMFWNhanVien.GetFullName(doTinTuc.NGUOI_CAP_NHAT);
             lblThoiGianCapNhat.Text = doTinTuc.NGAY_CAP_NHAT.ToString(PLConst.FORMAT_DATETIME_STRING);
             PLNhomTT._setSelectedID(doTinTuc.NHOM_TIN);
             checkTin_noi_bat.Checked = (doTinTuc.PRIOR == "Y");
             txtTieude.Text = doTinTuc.TIEU_DE;
             PLNoidung._setHTMLText(HelpByte.BytesToUTF8String(doTinTuc.NOI_DUNG));
             btnTaptin.Text = do_luu_tru_tt.TEN_FILE;
         }
         Duyet.SetDuyet(doTinTuc);
     }
     catch (Exception ex)
     {
         PLException.AddException(ex);
     }
 }
 public void frm_UpdateTapTin(object sender, DOLuuTruTapTin doLuuTruTapTin)
 {
     DataRow r = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle);
     DAReplyBugProduct.Luu_TaiLieu_TapTin(HelpNumber.ParseInt64(r["ID"]), doLuuTruTapTin.ID);
 }
 private void ThongTinNoiBat(DOTinTuc TTNew, DOLuuTruTapTin TAP_TIN)
 {
     ///Định dạng font chữ
     this.Chu_de.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.lbl_Thoi_gian_cap_nhat.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
     this.lblNguoi_cap_nhat.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
     this.lbl_TTDK.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
     try
     {
         if (TTNew != null)
         {
             do_TT = TTNew;
             Chu_de.Text = TTNew.TIEU_DE;
             if (TAP_TIN.TEN_FILE != string.Empty)
             {
                 if (TAP_TIN.TEN_FILE != string.Empty)
                 {
                     lbl_TTDK.Text = TAP_TIN.TEN_FILE;
                     lbl_TTDK.Visible = true;
                     labelControl1.Visible = true;
                 }
             }
             else
             {
                 lbl_TTDK.Visible = false;
                 labelControl1.Visible = false;
             }
             lblNguoi_cap_nhat.Text = ProtocolVN.DanhMuc.DMFWNhanVien.GetFullName(TTNew.NGUOI_CAP_NHAT);
             lbl_Thoi_gian_cap_nhat.Text = TTNew.NGAY_CAP_NHAT.ToString(PLConst.FORMAT_DATETIME_STRING);
             Web_QuaTrinhDaoTao.DocumentText = HelpByte.BytesToUTF8String(TTNew.NOI_DUNG);
             popupControlContainer1.Visible = true;
         }
         else
         {
             popupControlContainer1.Visible = false;
             Web_QuaTrinhDaoTao.Visible = false; ;
             pictureEdit1.Visible = true;
         }
     }
     catch (Exception ex)
     {
         HelpMsgBox.ShowErrorMessage(ex.Message);
     }
 }
        private void initform()
        {
            #region cardView tài liệu
            XtraGridSupportExt.TextLeftColumn(lvTieuDe, "TIEU_DE");
            XtraGridSupportExt.TextLeftColumn(lvFile_dinh_kem, "TEN_FILE");
            XtraGridSupportExt.TextLeftColumn(lvNguoiCapNhat, "TEN_NGUOI_CN");
            XtraGridSupportExt.TextLeftColumn(lvNgayCapNhat, "NGAY_CAP_NHAT");
            HelpGridColumn.CotMemoExEdit(lvGhi_chu, "GHI_CHU");
            HelpGridColumn.CotTextLeft(lvSize, "SIZE");
            XtraGridSupportExt.TextLeftColumn(cotID, "ID");
            XtraGridSupportExt.TextLeftColumn(cot_xoa, "xoa_file");
            XtraGridSupportExt.TextLeftColumn(cot_luufile, "luu_file");
            XtraGridSupportExt.TextLeftColumn(cot_mofile, "mo_file");
            XtraGridSupportExt.TextLeftColumn(cot_suafile, "sua_file");
            toolTip1.BackColor = Color.LightYellow;
            layoutView1.Appearance.CardCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            layoutView1.OptionsCustomization.AllowSort = false;
            layoutView1.OptionsCustomization.AllowFilter = false;
            lvSize.OptionsColumn.AllowEdit = false;
            lvSize.OptionsColumn.AllowFocus = false;
            lvGhi_chu.OptionsColumn.ReadOnly = true;
            layoutView1.OptionsBehavior.AllowSwitchViewModes = true;
            layoutView1.OptionsBehavior.AllowExpandCollapse = true;
            layoutView1.OptionsView.ShowCardCaption = true;
            layoutView1.OptionsHeaderPanel.EnableCustomizeButton = false;
            #endregion
            repositoryItemButtonEdit2.ButtonClick += new ButtonPressedEventHandler(repositoryItemButtonEdit2_ButtonClick);
            repositoryItemPictureEdit1.SizeMode = PictureSizeMode.Squeeze;
            DADocument.InitCtrl(LoaiTL, true);

            lblNguoiCapNhat.Text = DMFWNhanVien.GetFullName(FrameworkParams.currentUser.employee_id);
            TxtTg_cap_nhat.Text = HelpDB.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING);
            if (IsAdd == true)
            {
                do_tl = DADocument.Instance.Load(-2);
                do_tl.ID = HelpDB.getDatabase().GetID(PLConst.G_NGHIEP_VU);
                _ID = do_tl.ID;
                do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(-2);
                TenTL.Enabled = true;
                btnSave.Visible = true;
                xtraTabControl1.TabPages[1].PageEnabled = false;
            }
            else
            {
                if (IsAdd == false)
                {
                    if (TaiLieuPermission.I._checkPermissionRes(_ID, PermissionOfResource.RES_PERMISSION_TYPE.UPDATE) == false)
                    {
                        HelpMsgBox.ShowNotificationMessage("Bạn không có quyền sửa tài liệu này!");
                        HelpXtraForm.CloseFormNoConfirm(this);
                        return;
                    }
                }
                do_tl = DADocument.Instance.Load(_ID);
                do_luu_tru_tt = DADocument.Instance.load_DOTapTin(_ID);
                TenTL.Text = do_tl.NAME;
                LoaiTL._setSelectedID(HelpNumber.ParseInt64(do_tl.LOAI_TAI_LIEU_ID));
                Phien_ban.Text = do_tl.PHIEN_BAN;
                Noidung.DocumentText = do_tl.MO_TA;
                Load_TapTin(_ID);

                if (do_tl.ID == 0)
                {
                    HelpMsgBox.ShowErrorMessage("Dữ liệu đã bị mất.....");
                    if (HelpMsgBox.ShowConfirmMessage("Bạn có muốn thêm dữ liệu.") == DialogResult.No)
                        return;
                    else
                    {
                        do_tl = DADocument.Instance.Load(-2);
                        TenTL.Enabled = true;
                        btnSave.Visible = true;
                        IsAdd = true;
                        return;
                    }
                }
                if (IsAdd == false)
                {
                    TenTL.Enabled = true;
                    btnSave.Visible = true;
                    themtt = true;
                }
                else
                {
                    cot_suafile.LayoutViewField.Visibility = cot_xoa.LayoutViewField.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }
            }
        }
 private void UpDate_TinTuc(DOTinTuc doTinTuc,DOLuuTruTapTin doLuu_Tru)
 {
     try
     {
         ThongTinNoiBat(doTinTuc, doLuu_Tru);
     }
     catch (Exception ex)
     {
         PLException.AddException(ex);
     }
 }
 public void InitData()
 {
     try
     {
         doLuuTruTapTin = DALuuTruTapTin.Instance.Load(_ID_TapTin);
         doTapTinInAn = DATapTinInAn.Instance.Load(_ID_TapTin, _ID_HoTroInAn);
     }
     catch (Exception ex)
     {
         PLException.AddException(ex);
     }
     if (_IsAdd == true)
     {
         this.FileDinhKem.EditValue = "";
         this.GhiChu.EditValue = "";
     }
     if (_IsAdd == false)
     {
         if (do_InAn == null)
         {
             this.FileDinhKem.EditValue = doLuuTruTapTin.TEN_FILE;
             this.GhiChu.EditValue = doLuuTruTapTin.GHI_CHU;
             this.spinSo_ban.Value = doTapTinInAn.SO_TO;
         }
         else
         {
             this.FileDinhKem.EditValue = do_InAn.TEN_FILE;
             this.GhiChu.EditValue = do_InAn.GHI_CHU;
             this.spinSo_ban.Value = do_InAn.SO_TO;
         }
     }
     if (_IsAdd == null)
     {
         this.GhiChu.Properties.ReadOnly = true;
         this.btnLuu.Visible = false;
         this.FileDinhKem.Properties.Buttons[0].Visible = false;
     }
 }
 public override void HookFocusRow()
 {
     DataRow row = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle);
     try
     {
         if (row != null)
         {
             barButtonItemDuyet.Enabled = true;
             barButtonItemK_Duyet.Enabled = true;
             barButtonItemXem.Enabled = true;
             for (int i = 0; i < barSubItem1.ItemLinks.Count; i++)
             {
                 if (row["PRIOR"].ToString() == "Y")
                 {
                     item_TL.Visibility = BarItemVisibility.Never;
                     item_HuyTL.Visibility = BarItemVisibility.Always;
                 }
                 else
                 {
                     item_TL.Visibility = BarItemVisibility.Always;
                     item_HuyTL.Visibility = BarItemVisibility.Never;
                 }
                 break;
             }
             if (IsLoad)
             {
                 IsLoad = false;
                 goto SetState;
             }
             do_TT = DATinTuc.Instance.get_TinTuc(HelpNumber.ParseInt64(row["ID"]));
             if (do_TT != null) do_luu_tru_tt = DATinTuc.Instance.get_TapTin(do_TT.ID);
             this.ThongTinNoiBat(do_TT, do_luu_tru_tt);
         }
         else
         {
             this.ThongTinNoiBat(null, null);
             barButtonItemDuyet.Enabled = false;
             barButtonItemK_Duyet.Enabled = false;
         }
         SetState:
         if (row["DUYET"].ToString() == ((Int32)DuyetSupportStatus.ChoDuyet).ToString())
             {
                 barSubItem1.Enabled = false;
                 barButtonItemDuyet.Enabled = true;
                 barButtonItemK_Duyet.Enabled = true;
                 barButtonItemDelete.Enabled = true;
                 barButtonItemUpdate.Enabled = true;
             }
             else if (row["DUYET"].ToString() == ((Int32)DuyetSupportStatus.Duyet).ToString())
             {
                 barSubItem1.Enabled = true;
                 barButtonItemDuyet.Enabled = false;
                 barButtonItemK_Duyet.Enabled = true;
                 barButtonItemDelete.Enabled = false;
                 barButtonItemUpdate.Enabled = false;
             }
             else
             {
                 barSubItem1.Enabled = false;
                 barButtonItemDuyet.Enabled = true;
                 barButtonItemK_Duyet.Enabled = false;
                 barButtonItemDelete.Enabled = true;
                 barButtonItemUpdate.Enabled = true;
             }
     }
     catch (Exception ex)
     {
         PLException.AddException(ex);
     }
 }
        private void initform()
        {
            XtraGridSupportExt.TextLeftColumn(cot_xoa, "xoa_file");
            XtraGridSupportExt.TextLeftColumn(cot_luufile, "luu_file");
            XtraGridSupportExt.TextLeftColumn(cot_mofile, "mo_file");
            XtraGridSupportExt.TextLeftColumn(cot_suafile, "sua_file");
            toolTip1.BackColor = Color.LightYellow;
            layoutView1.OptionsCustomization.AllowSort = false;
            layoutView1.OptionsCustomization.AllowFilter = false;
            repositoryItemButtonEdit2.ButtonClick += new ButtonPressedEventHandler(repositoryItemButtonEdit2_ButtonClick);
            repositoryItemPictureEdit1.SizeMode = PictureSizeMode.Squeeze;
            DMLoaiTaiLieu.I.InitCtrl(LoaiTL, true, true);
            LoaiTL.ToolTip = string.Empty;
            lblNguoiCapNhat.Text = DMFWNhanVien.GetFullName(FrameworkParams.currentUser.employee_id);
            TxtTg_cap_nhat.Text = DABase.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING);

            if (IsAdd == true)
            {
                do_tl = DADocument.Instance.Load(-2);
                do_tl.ID = DABase.getDatabase().GetID(PLDBUtil.G_NGHIEP_VU);
                _ID = do_tl.ID;

                do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(-2);
                TenTL.Enabled = true;
                btnSave.Visible = true;
                themtt = true;
                do_tl.DUYET = "1";
            }
            else
            {

                do_tl = DADocument.Instance.Load(_ID);
                do_luu_tru_tt = DADocument.Instance.load_DOTapTin(_ID);
                TenTL.Text = do_tl.TEN_TAI_LIEU;
                LoaiTL._setSelectedID(HelpNumber.ParseInt64(do_tl.LOAI_TAI_LIEU_ID));
                Phien_ban.Text = do_tl.PHIEN_BAN;
                Noidung.DocumentText = do_tl.MO_TA;
                load_TapTin(_ID);
                if (do_tl.ID == 0)
                {
                    PLMessageBox.ShowErrorMessage("Dữ liệu đã bị mất.....");
                    if (PLMessageBox.ShowConfirmMessage("Bạn có muốn thêm dữ liệu.") == DialogResult.No)
                        return;
                    else
                    {
                        do_tl = DADocument.Instance.Load(-2);
                        TenTL.Enabled = true;
                        btnSave.Visible = true;
                        IsAdd = true;
                        return;
                    }
                }

                if (IsAdd == false)
                {

                    TenTL.Enabled = true;
                    btnSave.Visible = true;
                    if (DADocument.check_exists_taptin_in_tailieu(_ID))
                    {
                        ///
                    }

                    themtt = true;

                }
            }
            Duyet.SetDuyet(do_tl);
        }
        private void InitForm()
        {
            AppCtrl.InitTreeChonNhanVien_Choice1(NhanVien, true);
            DMCMucDoUuTien.I.InitCtrl(cboMuc_uu_tien, true, true);
            DATapTinInAn.InitCtrl(PLTinhtrang);
            lblThoiGianGui.Text = HelpDB.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING);
            if (IsAdd == true)
            {
                do_InAn = DAHoTroInAn.Instance.Load(-2);
                do_InAn.ID = HelpDB.getDatabase().GetID("G_NGHIEP_VU");
                _ID = do_InAn.ID;
                lblNguoiGui.Text = DACongViec.getNameNV(FrameworkParams.currentUser.employee_id);
                do_luu_tru_tt = DALuuTruTapTin.Instance.LoadAll(-2);
                btnLuu.Visible = true;
                btnThemTT.Visible = true;
                PLTinhtrang._setSelectedID(1);
            }
            else
            {
                do_InAn = DAHoTroInAn.Instance.Load(_ID);
                do_luu_tru_tt = DADocument.Instance.load_DOTapTin(_ID);
                NhanVien._setSelectedID(HelpNumber.ParseInt64(do_InAn.NGUOI_NHAN_ID));
                cboMuc_uu_tien._setSelectedID(HelpNumber.ParseInt64(do_InAn.MUC_DO_UU_TIEN_ID));
                lblNguoiGui.Text = DACongViec.getNameNV(do_InAn.NGUOI_GUI_ID);
                PLTinhtrang._setSelectedID(do_InAn.TINH_TRANG_IN_ID);
                memoMucDich.Text = do_InAn.MUC_DICH;
                if (do_InAn.ID == 0)
                {
                    HelpMsgBox.ShowErrorMessage("Dữ liệu đã bị mất.....");
                    if (HelpMsgBox.ShowConfirmMessage("Bạn có muốn thêm dữ liệu.") == DialogResult.No)
                        return;
                    else
                    {
                        do_InAn = DAHoTroInAn.Instance.Load(-2);
                        btnLuu.Visible = true;
                        IsAdd = true;
                        return;
                    }
                }
                if (IsAdd == false)
                {
                    btnLuu.Visible = true;
                    btnThemTT.Visible = true;
                }
                else
                {
                    cot_suafile.LayoutViewField.Visibility = cot_xoa.LayoutViewField.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    btnThemTT.Visible = false;
                    lblThoiGianGui.Text = do_InAn.THOI_GIAN_CAP_NHAT.ToString();

                }
                LoadTapTin(_ID);
            }
        }
Exemple #20
0
 public void frm_UpdateTapTin1(object sender, DOLuuTruTapTin doLuuTruTapTin)
 {
     foreach (DOLuuTruTapTin do_lttt in list_do_tap_tin)
     {
         if (do_lttt.ID == doLuuTruTapTin.ID)
         {
             do_lttt.TIEU_DE = doLuuTruTapTin.TIEU_DE;
             do_lttt.NOI_DUNG = doLuuTruTapTin.NOI_DUNG;
             do_lttt.GHI_CHU = doLuuTruTapTin.GHI_CHU;
             do_lttt.TEN_FILE = doLuuTruTapTin.TEN_FILE;
         }
     }
 }