Beispiel #1
0
        private void OnDisplayServicesList()
        {
            lock (ThisLock)
            {
                Result result = ServicesBus.GetServicesList(_name);
                if (result.IsOK)
                {
                    dgService.Invoke(new MethodInvoker(delegate()
                    {
                        ClearData();

                        DataTable dt = result.QueryResult as DataTable;
                        if (_dtTemp == null)
                        {
                            _dtTemp = dt.Clone();
                        }
                        UpdateChecked(dt);
                        dgService.DataSource = dt;
                    }));
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// All other services will be resolved from ServiceProvider.
        /// </summary>
        public MvcMiddleware(
            MvcOptions mvcOptions,
            IUseMvcBuilder useMvcBuilder
            )
        {
            useMvcBuilder.Routers      = useMvcBuilder.Routers ?? new List <IRouter>();
            useMvcBuilder.ModelBinders = useMvcBuilder.ModelBinders ?? new List <IModelBinder>();

            _mvcOptions = (MvcOptions)mvcOptions.Clone();

            var serv = useMvcBuilder.ServiceProvider;

            _mainRouter      = new MainRouter(useMvcBuilder.Routers);
            _contextPreparer = serv.GetRequiredService <IContextPreparer>();

            //Controllers.
            var controllers   = useMvcBuilder.Controllers ?? new List <Type>();
            var startupRoutes = useMvcBuilder.GetRoutes();

            _globalSearchBag = CreateGlobalSearchBag(serv, startupRoutes, controllers);
            var mainModelBinder = new MainModelBinder(useMvcBuilder.ModelBinders);

            //Init services bus.
            _servicesBus = serv.GetRequiredService <ServicesBus>();
            var outerMiddlewaresInformer = new OuterMiddlewaresInformer(_mainRouter);
            var mvcFeatures = new MvcFeatures();

            _servicesBus.Init(
                _mainRouter,
                outerMiddlewaresInformer,
                mvcFeatures,
                mainModelBinder
                );
        }
        private void InitData()
        {
            Cursor.Current = Cursors.WaitCursor;
            dgBenhNhanNgoaiGoiKham.DataSource = _dtSource;
            ngayKhamDataGridViewTextBoxColumn.DefaultCellStyle.NullValue = DateTime.Now.ToString("dd/MM/yyyy");

            Result result = ServicesBus.GetServicesList();

            if (result.IsOK)
            {
                DataTable dtService = result.QueryResult as DataTable;
                DataRow   row       = dtService.NewRow();
                row["ServiceGUID"] = Guid.Empty.ToString();
                row["Name"]        = " ";
                dtService.Rows.InsertAt(row, 0);

                serviceGUIDDataGridViewTextBoxColumn.DataSource    = dtService;
                serviceGUIDDataGridViewTextBoxColumn.DisplayMember = "Name";
                serviceGUIDDataGridViewTextBoxColumn.ValueMember   = "ServiceGUID";
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                this.Close();
            }
        }
Beispiel #4
0
        private void InitData()
        {
            //Service
            Result result = ServicesBus.GetServicesList();

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                return;
            }
            else
            {
                cboService.DataSource = result.QueryResult;
            }

            //Dich Vụ Con
            result = CompanyContractBus.GetDichVuCon(Guid.Empty.ToString());
            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("CompanyContractBus.GetDichVuCon"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("CompanyContractBus.GetDichVuCon"));
                return;
            }
            else
            {
                dgDichVuCon.DataSource = result.QueryResult;
            }
        }
        private void InitData()
        {
            Cursor.Current = Cursors.WaitCursor;
            dtpkActiveDate.Value = DateTime.Now;

            //Service
            Result result = ServicesBus.GetServicesList();
            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                return;
            }
            else
            {
                cboService.DataSource = result.QueryResult;
            }

            DisplayBacSiChiDinhList();

            if (_hopDongGUID != string.Empty)
            {
                raKhamTheoHopDong.Enabled = false;
                chkChuyenNhuong.Enabled = false;
                txtChuyenNhuong.Enabled = false;
                btnChonBenhNhan.Enabled = false;
            }
        }
Beispiel #6
0
        private void InitData()
        {
            Cursor.Current       = Cursors.WaitCursor;
            dtpkActiveDate.Value = DateTime.Now;

            //Service
            Result result = ServicesBus.GetServicesList(ServiceType.CanLamSang);

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                return;
            }
            else
            {
                DataTable dtService = result.QueryResult as DataTable;
                DataRow   row       = dtService.NewRow();
                row["ServiceGUID"] = Guid.Empty.ToString();
                row["Name"]        = " ";
                dtService.Rows.InsertAt(row, 0);

                serviceGUIDDataGridViewTextBoxColumn.DataSource    = dtService;
                serviceGUIDDataGridViewTextBoxColumn.DisplayMember = "Name";
                serviceGUIDDataGridViewTextBoxColumn.ValueMember   = "ServiceGUID";
            }

            DisplayDocStaffList();

            btnAdd.Enabled = Global.AllowAddLoiKhuyen;
        }
        private void OnDisplayServiceList()
        {
            Cursor.Current = Cursors.WaitCursor;
            Result result = ServicesBus.GetServicesList();

            if (result.IsOK)
            {
                cboService.DataSource = result.QueryResult;
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
            }
        }
Beispiel #8
0
        private void GenerateCode()
        {
            Cursor.Current = Cursors.WaitCursor;
            Result result = ServicesBus.GetServiceCount();

            if (result.IsOK)
            {
                int count = Convert.ToInt32(result.QueryResult);
                txtCode.Text = Utility.GetCode("DV", count + 1, 3);
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServiceCount"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServiceCount"));
            }
        }
        public ActionResult Details(string nome)
        {
            var teste = string.Empty;

            try
            {
                _ = ServicesBus.PostMessage(nome);
            }
            catch (System.Exception)
            {
                return(BadRequest());

                throw;
            }

            return(Ok());
        }
        private void InitData()
        {
            dtpkActiveDate.Value = DateTime.Now;

            //Service
            Result result = ServicesBus.GetServicesList();

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                return;
            }
            else
            {
                cboService.DataSource = result.QueryResult;
            }
        }
        static void AddServises_NotRequiredBuilder(ServiceCollectionWrapper serviceCollectionWrapper)
        {
            var serv = serviceCollectionWrapper.Services;

            var globalSearchBagProvider = new GlobalSearchBagProvider();

            serv.AddSingleton <IGlobalSearchBagProvider>(globalSearchBagProvider);
            serv.AddSingleton <GlobalSearchBagProvider>(globalSearchBagProvider);

            serv.AddSingleton <IContextPreparer, ContextPreparer>();

            //Register services bus for services, created in MvcMiddleware.
            var servicesBus = new ServicesBus();

            serv.AddSingleton <ServicesBus>(servicesBus);
            serv.AddSingleton <IMainRouterProvider>(servicesBus);
            serv.AddSingleton <IOuterMiddlewaresInformerProvider>(servicesBus);
            serv.AddSingleton <IMvcFeaturesProvider>(servicesBus);
            //Controllers service.
            serv.AddSingleton <IMainModelBinderProvider>(servicesBus);
        }
Beispiel #12
0
        private void InitData()
        {
            Cursor.Current = Cursors.WaitCursor;
            cboLanDauTaiKham.SelectedIndex = 0;

            Result result = PatientBus.GetPatientList();

            if (result.IsOK)
            {
                DataTable dtPatient = result.QueryResult as DataTable;
                DataRow   row       = dtPatient.NewRow();
                row["PatientGUID"] = Guid.Empty.ToString();
                row["FullName"]    = string.Empty;
                dtPatient.Rows.InsertAt(row, 0);

                cboBenhNhan.DataSource = dtPatient;
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetPatientList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientList"));
            }

            result = ServicesBus.GetServicesList();
            if (result.IsOK)
            {
                DataTable dtService = result.QueryResult as DataTable;
                DataRow   row       = dtService.NewRow();
                row["ServiceGUID"] = Guid.Empty.ToString();
                row["Name"]        = " ";
                dtService.Rows.InsertAt(row, 0);

                cboService.DataSource = dtService;
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
            }
        }
Beispiel #13
0
        private void dgService_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 2)
            {
                return;
            }

            DataRow row         = (dgService.SelectedRows[0].DataBoundItem as DataRowView).Row;
            string  serviceGUID = row["ServiceGUID"].ToString();

            DataGridViewCheckBoxCell cell1 = (DataGridViewCheckBoxCell)dgService.Rows[e.RowIndex].Cells[2];
            bool isChecked1 = Convert.ToBoolean(cell1.EditingCellFormattedValue);

            DataGridViewCheckBoxCell cell2 = (DataGridViewCheckBoxCell)dgService.Rows[e.RowIndex].Cells[3];
            bool isChecked2 = Convert.ToBoolean(cell2.EditingCellFormattedValue);

            if (e.ColumnIndex == 2 && isChecked1)
            {
                cell2.EditingCellFormattedValue = false;
                cell2.Value = false;
            }

            if (e.ColumnIndex == 3 && isChecked2)
            {
                cell1.EditingCellFormattedValue = false;
                cell1.Value = false;
            }

            isChecked1 = Convert.ToBoolean(cell1.EditingCellFormattedValue);
            isChecked2 = Convert.ToBoolean(cell2.EditingCellFormattedValue);

            Result result = ServicesBus.UpdateCauHinhDichVuXetNghiem(serviceGUID, isChecked1, isChecked2);

            if (!result.IsOK)
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.UpdateCauHinhDichVuXetNghiem"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.UpdateCauHinhDichVuXetNghiem"));
            }
        }
Beispiel #14
0
        private void OnDisplayServicesList()
        {
            lock (ThisLock)
            {
                Result result = ServicesBus.GetCauHinhDichVuXetNghiem(_name);
                if (result.IsOK)
                {
                    dgService.Invoke(new MethodInvoker(delegate()
                    {
                        ClearData();

                        DataTable dt         = result.QueryResult as DataTable;
                        dgService.DataSource = dt;
                    }));
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.GetCauHinhDichVuXetNghiem"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetCauHinhDichVuXetNghiem"));
                }
            }
        }
        private void InitData()
        {
            Cursor.Current       = Cursors.WaitCursor;
            dtpkActiveDate.Value = DateTime.Now;

            //Service
            Result result = ServicesBus.GetServicesList(ServiceType.CanLamSang);

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList"));
                return;
            }
            else
            {
                cboService.DataSource = result.QueryResult;
            }

            DisplayDocStaffList();

            btnAdd.Enabled = Global.AllowAddLoiKhuyen;
        }
Beispiel #16
0
        private bool CheckInfo()
        {
            if (txtCode.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập mã dịch vụ.", IconType.Information);
                txtCode.Focus();
                return(false);
            }

            if (txtName.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập tên dịch vụ.", IconType.Information);
                txtName.Focus();
                return(false);
            }

            string serviceGUID = _isNew ? string.Empty : _service.ServiceGUID.ToString();
            Result result      = ServicesBus.CheckServicesExistCode(serviceGUID, txtCode.Text);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.EXIST)
                {
                    MsgBox.Show(this.Text, "Mã dịch vụ này đã tồn tại rồi. Vui lòng nhập mã khác.", IconType.Information);
                    txtCode.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.CheckServicesExistCode"), IconType.Error);
                return(false);
            }

            return(true);
        }
Beispiel #17
0
        private void OnDisplayServicesList()
        {
            lock (ThisLock)
            {
                if (!_isViewAllDichVuHopDong)
                {
                    Result result = null;

                    if (!_isDichVuCon)
                    {
                        if (!_isServiceGroup)
                        {
                            result = ServicesBus.GetServicesListNotInCheckList(_contractGUID, _companyMemberGUID, _name);
                        }
                        else
                        {
                            result = ServiceGroupBus.GetServiceListNotInGroup(_name);
                        }
                    }
                    else if (_isDichVuHopDong)
                    {
                        result = ServicesBus.GetDichVuHopDongList(_name, _contractGUID);
                    }
                    else
                    {
                        result = ServicesBus.GetServicesList(_name);
                    }

                    if (result.IsOK)
                    {
                        dgService.Invoke(new MethodInvoker(delegate()
                        {
                            ClearData();

                            DataTable dt = result.QueryResult as DataTable;
                            dt           = GetDataSource(dt);
                            if (_dtTemp == null)
                            {
                                _dtTemp = dt.Clone();
                            }
                            UpdateChecked(dt);
                            dgService.DataSource = dt;
                        }));
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.GetServicesListNotInCheckList"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesListNotInCheckList"));
                    }
                }
                else
                {
                    dgService.Invoke(new MethodInvoker(delegate()
                    {
                        ClearData();

                        DataTable dt = _giaDichVuDataSource.Copy();
                        if (_dtTemp == null)
                        {
                            _dtTemp = dt.Clone();
                        }
                        UpdateChecked(dt);
                        dgService.DataSource = dt;
                    }));
                }
            }
        }
Beispiel #18
0
        private void OnSaveInfo()
        {
            try
            {
                _service.Code        = txtCode.Text;
                _service.Name        = txtName.Text;
                _service.EnglishName = txtEnglishName.Text;
                _service.Price       = (double)numPrice.Value;
                _service.Discount    = (double)numDiscount.Value;
                _service.Description = txtDescription.Text;
                _service.Status      = (byte)Status.Actived;

                if (_isNew)
                {
                    _service.CreatedDate = DateTime.Now;
                    _service.CreatedBy   = Guid.Parse(Global.UserGUID);
                }
                else
                {
                    _service.UpdatedDate = DateTime.Now;
                    _service.UpdatedBy   = Guid.Parse(Global.UserGUID);
                }

                MethodInvoker method = delegate
                {
                    _service.Type = (byte)cboType.SelectedIndex;

                    switch (cboStaffType.SelectedIndex)
                    {
                    case 0:
                        _service.StaffType = (byte)StaffType.None;
                        break;

                    case 1:
                        _service.StaffType = (byte)StaffType.BacSi;
                        break;

                    case 2:
                        _service.StaffType = (byte)StaffType.BacSiSieuAm;
                        break;

                    case 3:
                        _service.StaffType = (byte)StaffType.BacSiNgoaiTongQuat;
                        break;

                    case 4:
                        _service.StaffType = (byte)StaffType.BacSiNoiTongQuat;
                        break;

                    case 5:
                        _service.StaffType = (byte)StaffType.BacSiPhuKhoa;
                        break;

                    case 6:
                        _service.StaffType = (byte)StaffType.DieuDuong;
                        break;

                    case 7:
                        _service.StaffType = (byte)StaffType.XetNghiem;
                        break;
                    }

                    Result result = ServicesBus.InsertService(_service);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("ServicesBus.InsertService"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.InsertService"));
                        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);
            }
        }
        public async Task <IEnumerable <string> > GetNamesAsync()
        {
            var nomes = await ServicesBus.ReceaveMessageAsync();

            return(Nome.ToList());
        }
Beispiel #20
0
        private void OnDeleteService()
        {
            if (_dictServices == null)
            {
                return;
            }

            List <DataRow> checkedRows = _dictServices.Values.ToList <DataRow>();

            if (checkedRows.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những dịch vụ mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    List <string> noteList           = new List <string>();
                    List <string> deletedServiceList = new List <string>();

                    foreach (DataRow row in checkedRows)
                    {
                        string serviceCode = row["Code"].ToString();
                        string serviceGUID = row["ServiceGUID"].ToString();

                        dlgLyDoXoa dlg = new dlgLyDoXoa(serviceCode, 2);
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            noteList.Add(dlg.Notes);
                            deletedServiceList.Add(serviceGUID);
                        }
                    }

                    if (deletedServiceList.Count > 0)
                    {
                        Result result = ServicesBus.DeleteServices(deletedServiceList, noteList);
                        if (result.IsOK)
                        {
                            DataTable dt = dgService.DataSource as DataTable;
                            if (dt == null || dt.Rows.Count <= 0)
                            {
                                return;
                            }
                            foreach (string key in deletedServiceList)
                            {
                                DataRow[] rows = dt.Select(string.Format("ServiceGUID='{0}'", key));
                                if (rows == null || rows.Length <= 0)
                                {
                                    continue;
                                }
                                dt.Rows.Remove(rows[0]);
                            }

                            _dictServices.Clear();
                            _dtTemp.Rows.Clear();
                        }
                        else
                        {
                            MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.DeleteServices"), IconType.Error);
                            Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.DeleteServices"));
                        }
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những dịch vụ cần xóa.", IconType.Information);
            }
        }