Beispiel #1
0
        public int SetLicenseParameters(DateTime issuanceDate, DateTime expirationDate,
                                        string licenseName, string maxTotalPrice, string weight /* treated as company list */, string maxUnitPrice,
                                        string maxUnitWeight, string importType, string country, string SSN)
        {
            double _value         = String.IsNullOrEmpty(maxTotalPrice) ? -1 : Convert.ToDouble(maxTotalPrice);
            string _weight        = String.Join("#", companies.ToArray()); /* treated as company list */
            double _maxUnitPrice  = String.IsNullOrEmpty(maxUnitPrice) ? -1 : Convert.ToDouble(maxUnitPrice);
            double _maxUnitWeight = String.IsNullOrEmpty(maxUnitWeight) ? -1 : Convert.ToDouble(maxUnitWeight);

            merchantLicense.SetParameters(issuanceDate, expirationDate, licenseName,
                                          _value, _weight, _maxUnitPrice, _maxUnitWeight,
                                          importType, country, SSN);

            IssueLicenseDAO licenseDAO    = new IssueLicenseDAO();
            int             licenseNumber = licenseDAO.InsertNewLicense(issuanceDate, expirationDate, licenseName, _value, _weight,
                                                                        _maxUnitPrice, _maxUnitWeight, importType, country, SSN);

            List <MerchandiseInLicense> merchandiseList = new List <MerchandiseInLicense>();

            merchandiseList = merchantLicense.GetMerchandiseList();

            foreach (MerchandiseInLicense merchandise in merchandiseList)
            {
                licenseDAO.AddMerchandiseToLicense(merchandise.GetName(), merchandise.GetCompany(),
                                                   merchandise.Getweight(), merchandise.GetMaxUnitPrice(),
                                                   merchandise.GetUnitWeight(), merchandise.GetUnitPrice(),
                                                   merchandise.GetNumber());
            }

            MessageBox.Show("in handler: " + "کاربر گرامی، مجوز با موفقیت ثبت گردید");
            merchandiseList.Clear();
            return(licenseNumber);
        }
Beispiel #2
0
 public IssueLicenseHandler()
 {
     merchantLicense = new MerchantLicense();
     licenseDAO      = new IssueLicenseDAO(); // needed any more? it is created in function!!!
     companies       = new List <string>();
 }