コード例 #1
0
        public RequestBarcode CreatRetailRequest(List <string> barcods)
        {
            try
            {
                RequestPharmacySection pharmacySection = new RequestPharmacySection();
                #region pharmacySection
                pharmacySection.TransactionID = new Guid().ToString();
                pharmacySection.FarmakodeID   = Settings.Default.PharmacyID;
                pharmacySection.IPAddress     = Common.GetPublicIp(Settings.Default.IPAddressServer);
                pharmacySection.PCNO          = Settings.Default.PharmacyPCNO;
                pharmacySection.TokenKey      = Settings.Default.PharmacyID;
                #endregion

                RequestHeaderSection headerSection = new RequestHeaderSection();
                #region headerSection
                headerSection.ReceteNo = DateTime.Now.ToString("yyyyMMdd_HHmm_") + "Perakende";
                #endregion

                List <RequestDrugSection> drugSection = new List <RequestDrugSection>();
                #region drugSection

                for (int i = 0; i < barcods.Count; i++)
                {
                    RequestDrugSection item = new RequestDrugSection();
                    item.Id     = i + 1;
                    item.Barkod = barcods[i];
                    drugSection.Add(item);
                }
                #endregion

                RequestBarcode requestBarcode = new RequestBarcode();
                requestBarcode.DrugSection     = drugSection;
                requestBarcode.PharmacySection = pharmacySection;
                requestBarcode.HeaderSection   = headerSection;


                return(requestBarcode);
            }
            catch (Exception ex)
            {
                string message = "Requerst modeli oluşturulamadı";
                Logger.GetInstance().Error(message, ex);
                throw new Exception(message, ex);
            }
        }
コード例 #2
0
        public RequestBarcode CreateRequestModel(List <ParsedData> data)
        {
            try
            {
                RequestPharmacySection pharmacySection = new RequestPharmacySection();
                #region pharmacySection
                pharmacySection.TransactionID = new Guid().ToString();
                pharmacySection.FarmakodeID   = Settings.Default.PharmacyID;
                pharmacySection.IPAddress     = Common.GetPublicIp(Settings.Default.IPAddressServer);
                pharmacySection.PCNO          = Settings.Default.PharmacyPCNO;
                pharmacySection.TokenKey      = Settings.Default.PharmacyID;
                #endregion

                RequestHeaderSection headerSection = new RequestHeaderSection();
                #region headerSection
                headerSection.ReceteSahibiTC      = GetLongValue(data, nameof(headerSection.ReceteSahibiTC));
                headerSection.TeslimAlanTC        = GetLongValue(data, nameof(headerSection.TeslimAlanTC));
                headerSection.IlaciTeslimAlan     = GetStringValue(data, nameof(headerSection.IlaciTeslimAlan));
                headerSection.ReceteSahibiAd      = GetStringValue(data, nameof(headerSection.ReceteSahibiAd));
                headerSection.ReceteSahibiSoyad   = GetStringValue(data, nameof(headerSection.ReceteSahibiSoyad));
                headerSection.ReceteSahibiAdSoyad = headerSection.ReceteSahibiAd + " " + headerSection.ReceteSahibiSoyad;
                headerSection.TeslimAlanAd        = GetStringValue(data, nameof(headerSection.TeslimAlanAd));
                headerSection.TeslimAlanSoyad     = GetStringValue(data, nameof(headerSection.TeslimAlanSoyad));
                headerSection.ProvizyonTipi       = GetStringValue(data, nameof(headerSection.ProvizyonTipi));
                headerSection.ProtokolNo          = GetStringValue(data, nameof(headerSection.ProtokolNo));
                headerSection.TesisKodu           = GetStringValue(data, nameof(headerSection.TesisKodu));
                headerSection.ReceteTarihi        = GetStringValue(data, nameof(headerSection.ReceteTarihi));
                headerSection.ReceteNo            = GetStringValue(data, nameof(headerSection.ReceteNo));
                headerSection.KarekodDurumu       = GetStringValue(data, nameof(headerSection.KarekodDurumu));
                headerSection.Kapsam                = GetStringValue(data, nameof(headerSection.Kapsam));
                headerSection.IlacAlimTarihi        = GetStringValue(data, nameof(headerSection.IlacAlimTarihi));
                headerSection.EReceteNo             = GetStringValue(data, nameof(headerSection.EReceteNo));
                headerSection.ReceteTuru            = GetStringValue(data, nameof(headerSection.ReceteTuru));
                headerSection.ReceteAltTuru         = GetStringValue(data, nameof(headerSection.ReceteAltTuru));
                headerSection.HastaTuru             = GetStringValue(data, nameof(headerSection.HastaTuru));
                headerSection.DiplomaTescilNo       = GetStringValue(data, nameof(headerSection.DiplomaTescilNo));
                headerSection.DrDiplomaNo           = GetStringValue(data, nameof(headerSection.DrDiplomaNo));
                headerSection.DrAd                  = GetStringValue(data, nameof(headerSection.DrAd));
                headerSection.DrSoyad               = GetStringValue(data, nameof(headerSection.DrSoyad));
                headerSection.Brans                 = GetStringValue(data, nameof(headerSection.Brans));
                headerSection.Sertifika             = GetStringValue(data, nameof(headerSection.Sertifika));
                headerSection.Karekodlu             = GetBooleanValue(data, nameof(headerSection.Karekodlu));
                headerSection.SiraliDagitimRecetesi = GetBooleanValue(data, nameof(headerSection.SiraliDagitimRecetesi));
                #endregion

                List <RequestDrugSection> drugSection = new List <RequestDrugSection>();
                #region drugSection
                for (int i = 1; i < 11; i++)
                {
                    RequestDrugSection item = new RequestDrugSection();
                    item.Id     = i;
                    item.Barkod = GetStringValue(data, nameof(item.Barkod), i);
                    if (!string.IsNullOrEmpty(item.Barkod))
                    {
                        item.Adet         = GetIntValue(data, nameof(item.Adet), i);
                        item.PeriyodDeger = GetIntValue(data, nameof(item.PeriyodDeger), i);
                        item.PeriyodTipi  = GetStringValue(data, nameof(item.PeriyodTipi), i);
                        item.Doz          = GetIntValue(data, nameof(item.Doz), i);
                        item.DozMiktari   = GetDoubleValue(data, nameof(item.DozMiktari), i);
                        item.Adi          = GetStringValue(data, nameof(item.Adi), i);
                        item.Tutar        = GetDoubleValue(data, nameof(item.Tutar), i);
                        item.Fark         = GetDoubleValue(data, nameof(item.Fark), i);
                        item.Rapor        = GetStringValue(data, nameof(item.Rapor), i);
                        string _VerilecebilecegiTarih = GetStringValue(data, nameof(item.VerilecebilecegiTarih), i);
                        if (string.IsNullOrEmpty(_VerilecebilecegiTarih))
                        {
                            item.VerilecebilecegiTarih = DateTime.MinValue;
                        }
                        else
                        {
                            item.VerilecebilecegiTarih = DateTime.Parse(_VerilecebilecegiTarih);
                        }



                        item.Mesaj = GetStringValue(data, nameof(item.Mesaj), i);
                        drugSection.Add(item);
                    }
                }
                #endregion


                List <RequestICDSection> icdSection = new List <RequestICDSection>();
                #region icdSection
                for (int i = 1; i < 6; i++)
                {
                    RequestICDSection item = new RequestICDSection();
                    item.Kod  = GetStringValue(data, nameof(item.Kod), i);
                    item.Tani = GetStringValue(data, nameof(item.Tani), i);

                    if (!string.IsNullOrEmpty(item.Kod) && !string.IsNullOrEmpty(item.Tani))
                    {
                        icdSection.Add(item);
                    }
                }
                #endregion

                RequestPriceSection priceSection = new RequestPriceSection();
                #region priceSection
                priceSection.KatkiPayiElden        = GetDoubleValue(data, nameof(priceSection.KatkiPayiElden));
                priceSection.KatkiPayiMaastan      = GetDoubleValue(data, nameof(priceSection.KatkiPayiMaastan));
                priceSection.MuayeneKatkiPayi      = GetDoubleValue(data, nameof(priceSection.MuayeneKatkiPayi));
                priceSection.MuayeneKatkiMaastan   = GetDoubleValue(data, nameof(priceSection.MuayeneKatkiMaastan));
                priceSection.EczaneIndirimTutari   = 0;// GetDoubleValue(data, nameof(priceSection.EczaneIndirimTutari));
                priceSection.IlacKatkiPayiTutari   = GetDoubleValue(data, nameof(priceSection.IlacKatkiPayiTutari));
                priceSection.FiyatFarki            = GetDoubleValue(data, nameof(priceSection.FiyatFarki));
                priceSection.ToplamTutar           = GetDoubleValue(data, nameof(priceSection.ToplamTutar));
                priceSection.OdenecekTutar         = GetDoubleValue(data, nameof(priceSection.OdenecekTutar));
                priceSection.EczaneyeOdenecekTutar = GetDoubleValue(data, nameof(priceSection.EczaneyeOdenecekTutar));
                #endregion


                RequestBarcode requestBarcode = new RequestBarcode();
                requestBarcode.DrugSection     = drugSection;
                requestBarcode.HeaderSection   = headerSection;
                requestBarcode.ICDSection      = icdSection;
                requestBarcode.PharmacySection = pharmacySection;
                requestBarcode.PriceSection    = priceSection;


                return(requestBarcode);
            }
            catch (Exception ex)
            {
                string message = "Requerst modeli oluşturulamadı";
                Logger.GetInstance().Error(message, ex);
                throw new Exception(message, ex);
            }
        }