コード例 #1
0
        private void DisplayThuocTonKho(string thuocGUID)
        {
            Result result = HuyThuocBus.GetThuocTonKho(thuocGUID);

            if (result.IsOK)
            {
                if (result.QueryResult != null)
                {
                    int soLuongTon = Convert.ToInt32(result.QueryResult);
                    numSoLuongTon.Value = soLuongTon;
                }
                else
                {
                    numSoLuongTon.Value = 0;
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("HuyThuocBus.GetNgayHetHanCuaThuoc"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("HuyThuocBus.GetNgayHetHanCuaThuoc"));
            }
        }
コード例 #2
0
        private bool CheckInfo()
        {
            if (cboThuoc.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng chọn 1 thuốc.", IconType.Information);
                cboThuoc.Focus();
                return(false);
            }

            string thuocGUID = cboThuoc.SelectedValue.ToString();
            Result result    = HuyThuocBus.GetThuocTonKho(thuocGUID);

            if (result.IsOK)
            {
                int soLuongTon = 0;
                if (result.QueryResult != null)
                {
                    soLuongTon = Convert.ToInt32(result.QueryResult);
                }

                if ((int)numSoLuong.Value > soLuongTon)
                {
                    MsgBox.Show(this.Text, "Số lượng hủy lớn hơn số lượng thuốc còn trong kho. Vui lòng kiểm tra lại.", IconType.Information);
                    numSoLuong.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("HuyThuocBus.GetNgayHetHanCuaThuoc"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("HuyThuocBus.GetNgayHetHanCuaThuoc"));
                return(false);
            }

            return(true);
        }