Esempio n. 1
0
        private void OnDisplayYKienKhachHangList()
        {
            Result result = TuVanKhachHangBus.GetTuVanKhachHangList(_fromDate, _toDate, _tenBenhNhan, _tenNguoiTao, _bacSiPhuTrach, _inOut);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    dgYKienKhachHang.DataSource = result.QueryResult;
                    lbKetQuaTimDuoc.Text        = string.Format("Kết quả tìm được: {0}", (result.QueryResult as DataTable).Rows.Count);
                    //RefreshNo();
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("TuVanKhachHangBus.GetTuVanKhachHangList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("TuVanKhachHangBus.GetTuVanKhachHangList"));
            }
        }
Esempio n. 2
0
        private void dgYKienKhachHang_DoubleClick(object sender, EventArgs e)
        {
            if (dgYKienKhachHang.SelectedRows == null || dgYKienKhachHang.SelectedRows.Count <= 0)
            {
                return;
            }
            if (dgYKienKhachHang.CurrentCell != null && dgYKienKhachHang.CurrentCell.ColumnIndex == 0)
            {
                return;
            }

            if (dgYKienKhachHang.CurrentCell.ColumnIndex == 6)
            {
                DataRow row = (dgYKienKhachHang.SelectedRows[0].DataBoundItem as DataRowView).Row;
                if (row == null)
                {
                    return;
                }
                string yKienKhachHangGUID = row["TuVanKhachHangGUID"].ToString();
                string ketLuan            = string.Empty;
                if (row["KetLuan"] != null && row["KetLuan"] != DBNull.Value)
                {
                    ketLuan = row["KetLuan"].ToString();
                }

                dlgKetLuan dlg = new dlgKetLuan(ketLuan);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    ketLuan = dlg.KetLuan;

                    Result result = TuVanKhachHangBus.UpdateKetLuan(yKienKhachHangGUID, ketLuan);
                    if (result.IsOK)
                    {
                        row["NguoiKetLuan"]    = Global.UserGUID;
                        row["TenNguoiKetLuan"] = Global.Fullname;
                        row["KetLuan"]         = ketLuan;
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("TuVanKhachHangBus.UpdateKetLuan"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("TuVanKhachHangBus.UpdateKetLuan"));
                    }
                }
            }
            else
            {
                OnEdit();
            }
        }
Esempio n. 3
0
        private void OnDelete()
        {
            List <string>  deletedSpecList = new List <string>();
            List <DataRow> deletedRows     = new List <DataRow>();
            DataTable      dt = dgYKienKhachHang.DataSource as DataTable;

            foreach (DataRow row in dt.Rows)
            {
                if (Boolean.Parse(row["Checked"].ToString()))
                {
                    string userGUID = row["ContactBy"].ToString();
                    if (userGUID != Global.UserGUID)
                    {
                        MsgBox.Show(Application.ProductName, "Bạn không thể xóa tư vấn khách hàng của người khác. Vui lòng kiểm tra lại.", IconType.Information);
                        return;
                    }

                    deletedSpecList.Add(row["TuVanKhachHangGUID"].ToString());
                    deletedRows.Add(row);
                }
            }

            if (deletedSpecList.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những tư vấn khách hàng mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = TuVanKhachHangBus.DeleteTuVanKhachHang(deletedSpecList);
                    if (result.IsOK)
                    {
                        foreach (DataRow row in deletedRows)
                        {
                            dt.Rows.Remove(row);
                        }
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("TuVanKhachHangBus.DeleteTuVanKhachHang"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("TuVanKhachHangBus.DeleteTuVanKhachHang"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những tư vấn khách hàng cần xóa.", IconType.Information);
            }
        }
Esempio n. 4
0
        private void OnDisplayNguonList()
        {
            Result result = TuVanKhachHangBus.GetNguonList();

            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                foreach (DataRow row in dt.Rows)
                {
                    cboNguon.Items.Add(row["Nguon"].ToString());
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("TuVanKhachHangBus.GetNguonList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("TuVanKhachHangBus.GetNguonList"));
            }
        }
Esempio n. 5
0
        private void OnSaveInfo()
        {
            try
            {
                _tuVanKhachHang.Status = (byte)Status.Actived;

                if (_isNew)
                {
                    _tuVanKhachHang.ContactDate = DateTime.Now;
                    _tuVanKhachHang.ContactBy   = Guid.Parse(Global.UserGUID);
                }
                else
                {
                    _tuVanKhachHang.UpdatedDate = DateTime.Now;
                    _tuVanKhachHang.UpdatedBy   = Guid.Parse(Global.UserGUID);
                }

                MethodInvoker method = delegate
                {
                    if (txtTenKhachHang.Tag != null)
                    {
                        _tuVanKhachHang.PatientGUID = Guid.Parse(txtTenKhachHang.Tag.ToString());
                    }
                    else
                    {
                        _tuVanKhachHang.PatientGUID = null;
                    }

                    _tuVanKhachHang.TenCongTy    = txtTenCongTy.Text;
                    _tuVanKhachHang.MaKhachHang  = txtMaKhachHang.Text;
                    _tuVanKhachHang.MucDich      = txtMucDich.Text;
                    _tuVanKhachHang.TenKhachHang = txtTenKhachHang.Text;
                    _tuVanKhachHang.SoDienThoai  = txtSoDienThoai.Text;
                    _tuVanKhachHang.DiaChi       = txtDiaChi.Text;
                    _tuVanKhachHang.YeuCau       = txtYeuCau.Text;
                    _tuVanKhachHang.Nguon        = cboNguon.Text;
                    _tuVanKhachHang.Note         = string.Empty;
                    _tuVanKhachHang.IsIN         = raIN.Checked;
                    _tuVanKhachHang.SoTongDai    = txtSoTongDai.Text;

                    if (cboDocStaff.SelectedValue != null && cboDocStaff.Text.Trim() != string.Empty)
                    {
                        _tuVanKhachHang.BacSiPhuTrachGUID = Guid.Parse(cboDocStaff.SelectedValue.ToString());
                    }
                    else
                    {
                        _tuVanKhachHang.BacSiPhuTrachGUID = null;
                    }

                    _tuVanKhachHang.DaXong  = chkDaXong.Checked;
                    _tuVanKhachHang.BanThe  = chkBanThe.Checked;
                    _tuVanKhachHang.KetLuan = txtHuongGiaiQuyet.Text;

                    Result result = TuVanKhachHangBus.InsertTuVanKhachHang(_tuVanKhachHang);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("TuVanKhachHangBus.InsertTuVanKhachHang"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("TuVanKhachHangBus.InsertTuVanKhachHang"));
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                    }
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }