Ejemplo n.º 1
0
 void frm_RefreshAfterInsert(DOYeuCau doYeuCau)
 {
     DataRow row = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle);
     row["LOAI_YEU_CAU_ID"] = doYeuCau.LOAI_YEU_CAU_ID;
     row["TEN_YEU_CAU"] = DAYeuCau.GetTenYeuCau(doYeuCau.LOAI_YEU_CAU_ID);
     row["CHU_DE"] = doYeuCau.CHU_DE;
     row["NGUOI_GUI_ID"] = doYeuCau.NGUOI_GUI_ID;
     row["NGUOI_NHAN"] = GetNameOfRecipient(doYeuCau.NGUOI_NHAN_ID);
     row["NGAY_CAP_NHAT"] = doYeuCau.NGAY_CAP_NHAT;
     row["TINH_TRANG"] = doYeuCau.TINH_TRANG;
     row["MUC_UU_TIEN"] = doYeuCau.MUC_UU_TIEN;
     gridViewMaster.RefreshData();
 }
Ejemplo n.º 2
0
 private void Refresh_Data(object sender, DOYeuCau e)
 {
 }
Ejemplo n.º 3
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (IsValidate())
            {
                //try...catch dùng trong TH người dùng chọn định dạng giờ của hệ thống trong đó có chứa "t"(AM/PM)
                try
                {
                    System.Convert.ToDateTime(lblThoiGianGui.Text);
                }
                catch {
                    lblThoiGianGui.Text += "M";
                }

                List<long> lstUser = new List<long>(NguoiNhanEmail._SelectedIDs);
                DataTable dt = new DataTable();
                string title = "";
                //Thêm người hỗ trợ vào danh sách gửi mail trong trường hợp ko chọn
                foreach (long id in NguoiHoTro._SelectedIDs)
                    if (!lstUser.Contains(id))
                        lstUser.Add(id);
                //----------------------
                if (IsAdd == true && AfterAddReplySuccesfully == null)
                {
                    try
                    {
                        title = "Có yêu cầu hỗ trợ mới được cập nhật";
                        if (DAYeuCau.Insert(out _YEU_CAU_ID, FrameworkParams.currentUser.employee_id, System.Convert.ToDateTime(lblThoiGianGui.Text), NguoiHoTro._SelectedStrIDs, PLTinhtrang._getSelectedID(), PLLoaiYeuCau._getSelectedID(), PLMucuutien._getSelectedID()
                            , txtChude.Text, NoiDung._getValue(), plMultiChoiceFiles1._DataSource))
                            HelpXtraForm.CloseFormNoConfirm(this);
                    }
                    catch
                    {
                        ErrorMsg.ErrorSave(this);
                    }
                }
                //Save in case ReplySupport.
                else if (IsAdd == true && AfterAddReplySuccesfully != null)
                {
                    DateTime currentDate = HelpDB.getDatabase().GetSystemCurrentDateTime();
                    DOPhanHoi doPhanHoi = new DOPhanHoi(_YEU_CAU_ID, FrameworkParams.currentUser.employee_id,NguoiHoTro._SelectedStrIDs , currentDate, NoiDung._getValue(), FrameworkParams.currentUser.employee_id, currentDate);
                    doPhanHoi.DSTapTinDinhKem = plMultiChoiceFiles1._DataSource;
                    if (DAPhanHoi.Insert(doPhanHoi))
                    {
                        title = "Có phản hồi yêu cầu hỗ trợ mới được cập nhật";
                        HelpXtraForm.CloseFormNoConfirm(this);
                        AfterAddReplySuccesfully(doPhanHoi);
                        //Update status of Support
                        DAYeuCau.UpdateTinhTrangYeuCau(_YEU_CAU_ID, PLTinhtrang._getSelectedID());
                        if (AfterUpdateStatusOfSupport != null) AfterUpdateStatusOfSupport(PLTinhtrang._getSelectedID(), null);
                    }
                    else
                        ErrorMsg.ErrorSave(this);

                }
                else if (IsAdd == false)
                {
                    if (AfterAddReplySuccesfully == null && AfterUpdateReplySuccesfully == null)
                    {
                        title = "Có yêu cầu hỗ trợ mới được cập nhật";
                        DOYeuCau doYeuCau = new DOYeuCau(this._YEU_CAU_ID, FrameworkParams.currentUser.employee_id
                            , NguoiHoTro._SelectedStrIDs, PLLoaiYeuCau._getSelectedID()
                            , HelpNumber.ParseInt32(PLMucuutien._getSelectedID())
                            , txtChude.Text.ToString(), NoiDung._getValue(), System.Convert.ToDateTime(lblThoiGianGui.Text), FrameworkParams.currentUser.employee_id, DateTime.Now, HelpNumber.ParseInt32(PLTinhtrang._getSelectedID()));
                        if (DAYeuCau.Update(this._YEU_CAU_ID, NguoiHoTro._SelectedStrIDs, PLTinhtrang._getSelectedID(), PLLoaiYeuCau._getSelectedID(), PLMucuutien._getSelectedID(), txtChude.Text, NoiDung._getValue(), plMultiChoiceFiles1._DataSource))
                        {
                            if (this.RefreshAfterInsert != null) this.RefreshAfterInsert(doYeuCau);
                            if (AfterUpdateSupportSuccesfully != null) AfterUpdateSupportSuccesfully(doYeuCau);
                            if (AfterUpdateStatusOfSupport != null) AfterUpdateStatusOfSupport(PLTinhtrang._getSelectedID()
                                , new object[]{PLLoaiYeuCau._getSelectedID(),txtChude.Text
                                    ,PLMucuutien._getSelectedID(),NguoiHoTro._SelectedStrIDs,System.Convert.ToDateTime(lblThoiGianGui.Text)});
                            HelpXtraForm.CloseFormNoConfirm(this);
                        }
                        else ErrorMsg.ErrorSave(this);
                    }
                    else
                    {
                        DateTime currentDate = HelpDB.getDatabase().GetSystemCurrentDateTime();
                        DOPhanHoi doPhanHoi = new DOPhanHoi(_YEU_CAU_ID, FrameworkParams.currentUser.employee_id, NguoiHoTro._SelectedStrIDs, currentDate, NoiDung._getValue(), FrameworkParams.currentUser.employee_id, currentDate);
                        doPhanHoi.ID = _YEU_CAU_TL_ID;
                        doPhanHoi.DSTapTinDinhKem = plMultiChoiceFiles1._DataSource;
                        if (DAPhanHoi.Update(doPhanHoi))
                        {
                            title = "Có phản hồi yêu cầu hỗ trợ mới được cập nhật";
                            HelpXtraForm.CloseFormNoConfirm(this);
                            doPhanHoi.DSTapTinDinhKem = plMultiChoiceFiles1._DataSource;
                            if (AfterUpdateReplySuccesfully != null) AfterUpdateReplySuccesfully(doPhanHoi);
                            //Update status of Support
                            DAYeuCau.UpdateTinhTrangYeuCau(_YEU_CAU_ID, PLTinhtrang._getSelectedID());
                            if (AfterUpdateStatusOfSupport != null) AfterUpdateStatusOfSupport(PLTinhtrang._getSelectedID(), null);
                        }
                        else ErrorMsg.ErrorSave(this);
                    }
                }
                //Gửi mail
                if (lstUser.Count > 0 )
                {
                    AddressList To = new AddressList();

                    title = HelpStringBuilder.GetTitleMailNewPageper(title);
                    StringBuilder Subject = new StringBuilder();
                    IDataReader reader = FWDBService.LoadRecord("DM_LOAI_YEU_CAU", "ID", this.PLLoaiYeuCau._getSelectedID());
                    using (reader)
                    {
                        if (reader.Read())
                        {
                            Subject.Append(string.Format(PLConst.DES_MAIL_YCHT, txtChude.Text, reader["NAME"].ToString(), lblNguoiGui.Text, NoiDung.richEditControl.HtmlText));
                        }
                    }
                    if (!lstUser.Contains(FrameworkParams.currentUser.employee_id))
                        lstUser.Add(FrameworkParams.currentUser.employee_id);
                    To = HelpZPLOEmail.GetAddressList(lstUser.ToArray());
                    HelpZPLOEmail.SendSmartHost(
                        HelpAutoOpenForm.GeneratingCodeFromForm(this, _YEU_CAU_ID),
                        title, null, To, null, null, Subject.ToString(), "");
                }
                //-----------------------------------------
            }
        }