Exemple #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Literatura l = new Literatura
                {
                    Id              = int.Parse(textBox10.Text),
                    Naslov          = textBox9.Text,
                    GodinaIzdavanja = int.Parse(textBox8.Text)
                };

                Rad r = new Rad
                {
                    MestoObjavljivanja = textBox11.Text,
                    URL             = textBox7.Text,
                    FormatDokumenta = textBox6.Text,
                    Literatura      = l
                };

                r.Id = int.Parse(textBox5.Text);

                Crud <Literatura> .Update(s, l);

                Crud <Rad> .Update(s, r);

                s.Close();
                neaktivno();
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        public static List <Campaign> ReturnCampaignFile()
        {
            var Campaigns = new List <Campaign>();

            if (System.IO.File.Exists(@"../../campaign.txt"))
            {
                using (System.IO.StreamReader Filen = System.IO.File.OpenText(@"../../campaign.txt"))
                {
                    string   Rad;
                    DateTime date1;
                    DateTime date2;


                    while ((Rad = Filen.ReadLine()) != null)
                    {
                        String[] ProductInfo = Rad.Split(',');
                        int      productID   = int.Parse(ProductInfo[0]);
                        DateTime.TryParse(ProductInfo[1], out date1);
                        DateTime.TryParse(ProductInfo[2], out date2);
                        double.TryParse(ProductInfo[3], out double CampaignPrice);

                        var Item = new Campaign(productID, date1, date2, CampaignPrice);
                        Campaigns.Add(Item);
                    }

                    return(Campaigns);
                }
            }
            else
            {
                Console.WriteLine("Could not find file."); return(Campaigns);
            }
        }
Exemple #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            ISession s   = DataLayer.GetSession();
            Rad      rad = new Rad();

            rad.Naziv        = txtNaziv.Text;
            rad.Konferencija = txtKonferencija.Text;
            rad.Adresa       = txtAdresa.Text;
            rad.Tip          = "RAD";
            rad.Pisao        = (Autor)comboBox1.SelectedItem;
            MessageBox.Show(rad.Pisao.Ime);
            if (radioButton1.Checked == true)
            {
                rad.Format = "PDF";
            }
            else if (radioButton2.Checked == true)
            {
                rad.Format = "WORD";
            }
            else if (radioButton3.Checked == true)
            {
                rad.Format = "POST-SCRIPT";
            }
            else
            {
                MessageBox.Show("Odaberite format rada.");
            }

            s.Save(rad);
            s.Flush();
            s.Close();
        }
        // GET api/clanak/5
        public Rad Get(int id)
        {
            Rad Rad = Crud <Rad> .Read(sesija, id);

            Rad.Literatura = null;
            return(Rad);
        }
        public async Task <IActionResult> Edit(int id, [Bind("id,Naziv,AutorId,ŽanrId,KategorijaId,Sadržaj,DatumObjave,tagovi,TakmičenjeId")] Rad rad)
        {
            if (id != rad.id)
            {
                return(NotFound());
            }

            rad.DatumObjave = DateTime.Now;

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rad);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RadExists(rad.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(HomeController)));
            }
            ViewData["AutorId"] = new SelectList(_context.Korisnik, "id", "ImePrezime", rad.AutorId);
            return(View(rad));
        }
Exemple #6
0
        public int UpdateRad(int id, Rad r)
        {
            try
            {
                ISession s   = DataLayer.GetSession();
                Rad      rad = s.Get <Rad>(id);
                Autor    a   = s.Get <Autor>(19);

                rad.Pisao        = a;
                rad.Naziv        = r.Naziv;
                rad.Tip          = "RAD";
                rad.Konferencija = r.Konferencija;
                rad.Format       = r.Format;
                rad.Adresa       = r.Adresa;

                s.Update(rad);
                s.Flush();
                s.Close();
                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Exemple #7
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Rad c = s.Load <Rad>(47);

                if (c != null)
                {
                    MessageBox.Show(c.Literatura.Naslov);
                }
                else
                {
                    MessageBox.Show("Ne postoji rad sa zadatim identifikatorom");
                }


                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
Exemple #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Literatura l = new Literatura
                {
                    Naslov          = "Higsov bozon",
                    GodinaIzdavanja = 2013
                };

                Rad k = new Rad
                {
                    FormatDokumenta    = "pdf",
                    URL                = "www.higsov.rs",
                    MestoObjavljivanja = "Niš",
                    Literatura         = l
                };

                s.Save(l);
                s.Save(k);
                s.Flush();
                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            ISession s = DataLayer.GetSession();

            Literatura l = new Literatura
            {
                Naslov          = textBox1.Text,
                GodinaIzdavanja = int.Parse(textBox2.Text),
                Autori          = listaAutora
            };

            Rad r = new Rad
            {
                MestoObjavljivanja = textBox4.Text,
                URL             = textBox3.Text,
                FormatDokumenta = textBox5.Text,
                Literatura      = l
            };

            Crud <Literatura> .Create(s, l);

            Crud <Rad> .Create(s, r);

            s.Close();

            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";

            dataGridView1.DataSource = null;
            dataGridView1.Update();
            dataGridView1.Refresh();
        }
Exemple #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            ISession s = DataLayer.GetSession();
            Rad      r = s.Load <Rad>(rad.LiteraturaId);

            r.Naziv = textBox2.Text;

            if (radioButton1.Checked)
            {
                r.Format = "PDF";
            }
            else if (radioButton2.Checked)
            {
                r.Format = "WORD";
            }
            else if (radioButton3.Checked)
            {
                r.Format = "POST-SCRIPT";
            }
            else
            {
                MessageBox.Show("Odaberite format.");
            }

            r.Konferencija = textBox4.Text;
            r.Adresa       = textBox5.Text;

            s.Update(r);
            s.Flush();
            s.Close();
        }
Exemple #11
0
        private static void GenerateBalanceAdjustmentLog()
        {
            var sb = new StringBuilder();

            sb.Append(Now);
            sb.Append('\t');
            sb.Append(AppName);
            sb.Append('\t');
            sb.Append(GetRandomInstance());
            sb.Append('\t');
            sb.Append("balance-adjustment-log");
            sb.Append('\t');
            sb.Append(GetRandomJavaClassName());
            sb.Append('\t');
            sb.Append(GetRandomLogLevel(NormalLogLevels));

            var    rad = Rad.Next(byte.MinValue, byte.MaxValue);
            string actName;
            bool   success;
            var    previousBalance = Rad.Next(10_000_000, 100_000_000);
            int    amt;
            long   currentBalance;

            if (rad % 2 == 0)
            {
                actName        = "DEPOSIT (+)";
                amt            = Rad.Next(1, 1_000_000_000);
                currentBalance = previousBalance + amt;
                success        = true;
            }
            else
            {
                actName = "WITHDRAW (-)";
                amt     = Rad.Next(0, 10) % 5 == 1
                    ? (previousBalance + Rad.Next(1_000, 10_000_000))
                    : Rad.Next(1_000, previousBalance);
                currentBalance = previousBalance - amt;
                if (currentBalance < 50_000)
                {
                    currentBalance = previousBalance;
                    success        = false;
                }
                else
                {
                    success = true;
                }
            }

            File.AppendAllLines(BalanceAdjustmentLogFilePath, ConvertToMultiline(sb.ToString(), new[]
            {
                $"{GetRandomString(UserName)} {actName} {amt}",
                $"TxId: {Guid.NewGuid()}",
                $"Secret: PrivateKey-{Guid.NewGuid()}",
                $"Amount: {amt}",
                $"Success: {success}",
                $"Previous balance: {previousBalance}",
                $"Current balance: {currentBalance}{(success ? string.Empty : " (no change)")}",
            }));
        }
Exemple #12
0
 public static void AddItemsToLvRad(ListViewItem item, Rad rad)
 {
     item.SubItems.Add(rad.Naziv);
     item.SubItems.Add(rad.Format);
     item.SubItems.Add(rad.Konferencija);
     item.SubItems.Add(rad.Adresa);
     Form1.lv.Items.Add(item);
 }
Exemple #13
0
 public RadView(Rad r)
 {
     this.Id           = r.Id;
     this.Naziv        = r.Naziv;
     this.Format       = r.Format;
     this.Konferencija = r.Konferencija;
     this.Adresa       = r.Adresa;
 }
        private void msd(Rad <T>[] arr)
        {
            Rad <T>[] aux = new Rad <T> [arr.Length];
            int       lo  = 0;
            int       hi  = arr.Length - 1;
            int       at  = 0;

            msdSort(arr, aux, lo, hi, at);
        }
 // PUT api/clanak/5
 public void Put(int id, [FromBody] Rad Rad)
 {
     //linija je dodata da bi mogli da testiramo sa objektima koje dobijemo kao rezultat
     //kontrolera ge. Potavlja se objekat iz baze, zbog toga sto je u odgovarajucoj tabeli spoljni kljuc obavezan
     Rad.Literatura = new Literatura()
     {
         Id = 81
     };
     Crud <Rad> .Update(sesija, Rad);
 }
Exemple #16
0
        private static void GenerateAppLog()
        {
            var sb = new StringBuilder();

            sb.Append(Now);
            sb.Append('\t');
            sb.Append(AppName);
            sb.Append('\t');
            sb.Append(GetRandomInstance());
            sb.Append('\t');
            sb.Append("application-log");
            sb.Append('\t');
            sb.Append(GetRandomJavaClassName());
            sb.Append('\t');

            string[] lines;

            var rad = Rad.Next(int.MinValue, int.MaxValue);
            var div = 5;

            if (rad % div == 0)
            {
                sb.Append(GetRandomLogLevel(LogLevelsOfError));
                try
                {
                    if (rad % 3 == 0)
                    {
                        throw new ArgumentException(
                                  $"Invalid argument {GetRandomString(new[] {nameof(sb), nameof(rad), nameof(div)})}");
                    }
                    if (rad % 3 == 1)
                    {
                        throw new IndexOutOfRangeException($"Array contains less than {Rad.Next(3, 10)} elements");
                    }
                    // ReSharper disable once StringLiteralTypo
                    throw new Exception($"Lorem ip sum {rad}");
                }
                catch (Exception e)
                {
                    lines = ConvertToMultiline(sb.ToString(), e.ToString().Split('\n')).ToArray();
                }
            }
            else
            {
                sb.Append(GetRandomLogLevel(NormalLogLevels));
                lines = new string[Rad.Next(1, 4)];
                for (var i = 0; i < lines.Length; i++)
                {
                    lines[i] = $"{i}-{Math.Abs(rad)}-{Rad.Next(byte.MinValue, byte.MaxValue)}";
                }
                lines = ConvertToMultiline(sb.ToString(), lines).ToArray();
            }

            File.AppendAllLines(AppLogFilePath, lines);
        }
Exemple #17
0
        public void Roll(Colors userColor)
        {
            pictureBox1.Image.RotateFlip(RotateFlipType.Rotate270FlipNone);
            pictureBox1.Refresh();

            Colors cl   = Colors.Green;
            Random rnd  = new Random();
            int    roll = rnd.Next(0, 36);

            label2.Text = roll.ToString();

            if (Black.Contains(roll))
            {
                panel2.BackColor = Color.Black;
                cl = Colors.Black;
            }
            else if (Rad.Contains(roll))
            {
                panel2.BackColor = Color.Red;
                cl = Colors.Red;
            }
            else if (roll == 0)
            {
                panel2.BackColor = Color.Green;
                cl = Colors.Green;
            }
            StopRoll++;

            if (StopRoll == 50)
            {
                StopRoll       = 0;
                timer1.Enabled = false;
                int coef = 0;
                if (string.IsNullOrWhiteSpace(textBox2.Text) && cl == userColor)
                {
                    coef = 2;
                }
                else if (cl == userColor && roll == Convert.ToInt32(textBox2.Text))
                {
                    coef = cl == Colors.Green ? 12 : 4;
                }
                else
                {
                    MessageBox.Show("Вы проиграли!");
                    SetBoolean(true);
                    return;
                }

                balance += Convert.ToInt32(textBox1.Text) * coef;
                MessageBox.Show("Поздравляем с победой!");
                SetBalance();
                SetBoolean(true);
            }
        }
        public async Task <IActionResult> Create([Bind("id,Naziv,AutorId,ŽanrId,KategorijaId,Sadržaj,DatumObjave,tagovi,TakmičenjeId")] Rad rad)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rad);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(HomeController)));
            }
            ViewData["AutorId"] = new SelectList(_context.Korisnik, "id", "ImePrezime", rad.AutorId);
            return(View(rad));
        }
Exemple #19
0
        public static double CampaignRead(int TempProductID, double originalPris)
        {
            double   FinalPrice = 0;
            DateTime date1;
            DateTime date2;
            var      Campaigns = new List <Campaign>();

            if (System.IO.File.Exists(@"../../campaign.txt"))
            {
                using (System.IO.StreamReader Filen = System.IO.File.OpenText(@"../../campaign.txt"))
                {
                    string Rad;


                    while ((Rad = Filen.ReadLine()) != null)
                    {
                        String[] ProductInfo = Rad.Split(',');
                        int      productID   = int.Parse(ProductInfo[0]);


                        DateTime.TryParse(ProductInfo[1], out date1);
                        DateTime.TryParse(ProductInfo[2], out date2);
                        double.TryParse(ProductInfo[3], out double CampaignPrice);

                        var Item = new Campaign(productID, date1, date2, CampaignPrice);
                        Campaigns.Add(Item);
                    }

                    foreach (Campaign C in Campaigns)
                    {
                        if (TempProductID == C.ProductID)
                        {
                            if (C.Date1 < DateTime.Now && DateTime.Now < C.Date2)
                            {
                                FinalPrice = C.CampaignPrice;
                                return(FinalPrice);
                            }
                        }
                    }
                }
            }
            if (FinalPrice == 0)
            {
                return(originalPris);
            }
            else
            {
                return(FinalPrice);
            }
        }
Exemple #20
0
        public int AddRad(Rad r)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                s.Save(r);
                s.Flush();
                s.Close();
                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Exemple #21
0
        /// <summary>
        /// Textual description of the Anlge
        /// </summary>
        /// <param name="format">
        /// Formatting string:
        /// 'd' (degrees),
        /// 'g' (gradians),
        /// 'r' (radians),
        /// '', or
        /// 'v' (verbose)
        /// followed by standard numeric format string characters valid for a double precision floating point</param>
        /// <param name="formatProvider">The culture specific fromatting provider</param>
        /// <returns>Text (String) representing the vector</returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            // If no format is passed
            if (string.IsNullOrEmpty(format))
            {
                return(v.ToString());
            }

            char   firstChar = Char.ToLower(format[0]);
            string remainder = null;

            if (format.Length > 1)
            {
                remainder = format.Substring(1);
            }

            switch (firstChar)
            {
            case 'd': return(Deg.ToString(remainder, formatProvider));

            case 'r': return(Rad.ToString(remainder, formatProvider));

            case 'g': return(Grad.ToString(remainder, formatProvider));

            case 'v':
                return
                    (string.Format
                     (
                         "{0} {1} angle of {2} radians ( {3} degrees, {4} gradians )",
                         IsClockwise() ? "Clockwise" : "Counter-clockwise",
                         IsAcute() ?
                         "acute" : IsRightAngle() ?
                         "right" : IsObtuse() ?
                         "obtuse" : IsStraitAngle() ?
                         "strait" : IsReflex() ?
                         "reflex" : IsFullOrZeroAngle() ?
                         "full (or zero)" : "Unknown",
                         Rad.ToString(remainder, formatProvider),
                         Deg.ToString(remainder, formatProvider),
                         Grad.ToString(remainder, formatProvider)
                     ));

            default:
                return(v.ToString(format, formatProvider));
            }
        }
Exemple #22
0
        //DTO Manager Methods for 'Rad'
        public static DTRad GetRad(int IdRada)
        {
            DTRad DtRad = new DTRad();

            try
            {
                ISession session = DataLayer.GetSession();
                Rad      r       = session.Load <Rad>(IdRada);
                DTRad    dr      = new DTRad(r.Id, r.Naziv, r.Format, r.Konferencija, r.Adresa);
                session.Close();
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(DtRad);
        }
 public void PopulateFrom(Rad.Core.Domain.Address a)
 {
     //this.party_id
     //this.address_id
     this.address_format_type_cd_id.Value = GSC(SystemCodeType.ADDRESS_TYPE, a.AddressType);
     this.address_type_cd_id.Value = GSC(SystemCodeType.ADDRESS_TYPE, a.AddressType);
     this.attention.Value = a.Attention;
     this.city.Value = a.City;
     this.country.Value = a.Country;
     this.county.Value = a.County;
     this.postal_code.Value = a.Zip;
     this.state.Value = a.State;
     this.street_3.Value = a.Line3;
     this.street_aux.Value = a.Line2;
     this.street_main.Value = a.Line1;
     this.usage_cd_id.Value = GSC(SystemCodeType.ADDRESS_USAGE, a.Usage);
 }
        public override bool sort(bool ascending)
        {
            if (!(list[0].val.GetType() == typeof(sbyte) ||
                  list[0].val.GetType() == typeof(byte) ||
                  list[0].val.GetType() == typeof(char) ||
                  list[0].val.GetType() == typeof(short) ||
                  list[0].val.GetType() == typeof(ushort) ||
                  list[0].val.GetType() == typeof(int) ||
                  list[0].val.GetType() == typeof(uint) ||
                  list[0].val.GetType() == typeof(long) ||
                  list[0].val.GetType() == typeof(ulong) ||
                  list[0].val.GetType() == typeof(float) ||
                  list[0].val.GetType() == typeof(double)))
            {
                return(false);
            }

            Rad <T>[] arr  = new Rad <T> [list.Count];
            int       n    = 0;
            int       _POW = (int)Math.Pow(10, 8);
            double    d;
            long      min = 0;

            foreach (Record <T> r in list)
            {
                double.TryParse(r.val.ToString(), out d);
                arr[n].s = d.ToString();
                arr[n].r = r;
                n++;
            }

            msd(arr);

            for (int i = 0; i < arr.Length; i++)
            {
                list[i] = arr[i].r;
            }
            if (!ascending)
            {
                list.Reverse();
            }

            sortCount++;
            return(true);
        }
Exemple #25
0
        public int RemoveRad(int id)
        {
            try
            {
                ISession s   = DataLayer.GetSession();
                Rad      rad = s.Get <Rad>(id);

                s.Delete(rad);
                s.Flush();
                s.Close();

                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Exemple #26
0
        public RadView GetRadView(int id)
        {
            try
            {
                ISession s   = DataLayer.GetSession();
                Rad      rad = s.Get <Rad>(id);

                if (rad == null)
                {
                    return(new RadView());
                }

                return(new RadView(rad));
            }
            catch (Exception)
            {
                return(new RadView());
            }
        }
Exemple #27
0
        public static DTRad UpdateRad(DTRad dr)
        {
            try
            {
                ISession session = DataLayer.GetSession();
                Rad      r       = session.Load <Rad>(dr.LiteraturaId);
                r.Naziv        = dr.RadNaziv;
                r.Format       = dr.RadFormat;
                r.Konferencija = dr.RadKonferencija;
                r.Adresa       = dr.RadAdresa;

                session.Update(r);
                session.Flush();
                session.Close();
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(dr);
        }
Exemple #28
0
        public static List <Produkt> GetProducts()
        {
            var ProductList = new List <Produkt>();

            using (System.IO.StreamReader Filen = System.IO.File.OpenText(@"../../produkter.txt"))
            {
                string Rad;
                while ((Rad = Filen.ReadLine()) != null)
                {
                    String[] ProductInfo = Rad.Split(',');
                    int      productID   = int.Parse(ProductInfo[0]);
                    double   Pris        = double.Parse(ProductInfo[1]);
                    int      MaxItems    = int.Parse(ProductInfo[4]);


                    var Produkt = new Produkt(productID, Pris, ProductInfo[2], ProductInfo[3], MaxItems);
                    ProductList.Add(Produkt);
                }
            }

            return(ProductList);
        }
        private void ProcessProduct(Rad.Core.Domain.Product prod, Party party)
        {
            Business_unit_product bup = new Business_unit_product();
            bup.PopulateFrom(prod);
            bup.Variable = new SqlVariable(_sqlVariableCleaner.Replace(prod.InternalName, new MatchEvaluator(a => "_")) + "_BUPID");
            bup.party_id.Value = party.Variable;
            bup.product_id.Value = GetBaseProduct(prod.BaseProduct);
            _sqlEntities.Add(bup);

            AttachFeeCollection(prod.DocumentFees, bup, "document");

            foreach (var pc in prod.PcpidConfigs)
            {
                Procheck_config config = new Procheck_config();
                config.PopulateFrom(pc);
                config.business_unit_party_id.Value = party.Variable;
                config.business_unit_product_id.Value = bup.Variable;
                _sqlEntities.Add(config);
            }

            foreach (var id in prod.AuthMethods)
            {
                Business_unit_product_id_auth_method bupiam = new Business_unit_product_id_auth_method();
                bupiam.PopulateFrom(id);
                bupiam.business_unit_party_id.Value = party.Variable;
                bupiam.business_unit_product_id.Value = bup.Variable;
                _sqlEntities.Add(bupiam);
            }

            Business_unit_purchasable_product bupp = new Business_unit_purchasable_product();
            bupp.PopulateFrom(prod);
            bupp.business_unit_product_id.Value = bup.Variable;
            _sqlEntities.Add(bupp);

            foreach (var reason in prod.Reasons)
            {
                Business_unit_product_reason bupr = new Business_unit_product_reason();
                bupr.PopulateFrom(reason);
                bupr.business_unit_product_id.Value = bup.Variable;
                _sqlEntities.Add(bupr);
            }

            foreach (var relationship in prod.Relationships)
            {
                Business_unit_product_relationship bupr = new Business_unit_product_relationship();
                bupr.PopulateFrom(relationship);
                bupr.business_unit_product_id.Value = bup.Variable;
                _sqlEntities.Add(bupr);
            }

            foreach (var om in prod.OrderMethods)
            {
                Business_unit_product_order_method bupom = new Business_unit_product_order_method();
                bupom.PopulateFrom(om);
                bupom.business_unit_product_id.Value = bup.Variable;
                _sqlEntities.Add(bupom);
            }

            foreach (var shippy in prod.ShippingMethods)
            {
                Business_unit_product_delivery_method bupdm = new Business_unit_product_delivery_method();
                bupdm.PopulateFrom(shippy);
                bupdm.business_unit_delivery_product_id.Value = _services[shippy.Service];
                bupdm.business_unit_product_id.Value = bup.Variable;
                _sqlEntities.Add(bupdm);
            }

            foreach (var c in prod.Contents)
            {
                Template t = new Template();
                t.PopulateFrom(c);
                t.template_text.Value = _contentTexts[c.Text];
                SqlVariable templateVariable = AddUniqueSqlEntity(t);

                Content_assignment ca = new Content_assignment();
                ca.PopulateFrom(c);
                ca.attached_to_type_cd_id.Value = GSC(SystemCodeType.SYSTEM_OBJECT_TYPE, "business unit product");
                ca.template_id.Value = templateVariable;
                ca.attached_to_id.Value = bup.Variable;
                ca.GenVariable();
                _sqlEntities.Add(ca);
            }

            foreach (var ca in prod.CoverageAreas)
            {
                Business_unit_product_coverage_area bupca = new Business_unit_product_coverage_area();
                bupca.PopulateFrom(ca);
                bupca.business_unit_product_id.Value = bup.Variable;
                bupca.coverage_area_id.Value = _coverageAreas[ca];
                _sqlEntities.Add(bupca);
            }
        }
Exemple #30
0
        public int Post([FromBody] Rad k)
        {
            DataProvider provider = new DataProvider();

            return(provider.AddRad(k));
        }
Exemple #31
0
        public int Put(int id, [FromBody] Rad k)
        {
            DataProvider provider = new DataProvider();

            return(provider.UpdateRad(id, k));
        }
 public void PopulateFrom(Rad.Core.Domain.Product p)
 {
     //this.accepted_avs_codes
     //this.avs_declined_action_cd_id
     //this.business_unit_product_id
     this.charge_point_cd_id.Value = GSC(SystemCodeType.CHARGE_POINT_CODE, p.ChargePoint);
     this.charge_type_cd_id.Value = GSC(SystemCodeType.CHARGE_METHOD_CODE, p.ChargeType);
     //this.cust_ref_field_id
     //this.data_collection_method_cd_id
     this.dupe_auth_policy_cd_id.Value = GSC(SystemCodeType.DUPE_AUTH_POLICY, p.DupeAuthPolicy);
     //this.is_cust_ref_field_unique_id
     this.is_default.Value = Flag(p.IsDefault);
     this.is_has_misc_fee.Value = Flag(p.IsHasMiscFee);
     //this.is_order_from_agency_only
     this.is_tax_product.Value = p.IsTaxProduct;
     //this.legacy_product_id
     //this.lookup_url
     this.max_charge_amount.Value = p.MaxChargeAmount;
     this.max_copies_per_line_item.Value = p.MaxCopiesPerLineItem;
     //this.order_viewed_event_cd_id.Value = GSC(SystemCodeType.vi
     //this.order_visibility_status_cd_id.Value = GSC(SystemCodeType.VISIBILITY_LEVEL
     //this.payment_charge_rule_cd_id.Value = GSC(SystemCodeType.pa
     //this.pos_cust_ref_source_cd_id
     //this.postback_url
 }
Exemple #33
0
        // To delete item which is selected in listView
        private void obrisiBtn_Click(object sender, EventArgs e)
        {
            ISession _session;

            switch (this.LastLoadedData)
            {
            case 0:     // Projekat
                try
                {
                    _session = DataLayer.GetSession();
                    Projekat projekat = _session.Load <Projekat>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                    MessageBox.Show(projekat.Naziv);
                    _session.Delete(projekat);
                    _session.Flush();
                    _session.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case 1:     // Predmet
                try
                {
                    _session = DataLayer.GetSession();
                    Predmet predmet = _session.Load <Predmet>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                    MessageBox.Show(predmet.Naziv);
                    _session.Delete(predmet);
                    _session.Flush();
                    _session.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case 2:     // Nastavnik
                try
                {
                    _session = DataLayer.GetSession();
                    Nastavnik n = _session.Load <Nastavnik>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                    MessageBox.Show(n.Ime);
                    _session.Delete(n);
                    _session.Flush();
                    _session.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case 3:     //Clanak
                try
                {
                    _session = DataLayer.GetSession();
                    Clanak c = _session.Load <Clanak>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                    MessageBox.Show(c.Naziv);
                    _session.Delete(c);
                    _session.Flush();
                    _session.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case 4:     // Rad
                try
                {
                    _session = DataLayer.GetSession();
                    Rad r = _session.Load <Rad>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                    MessageBox.Show(r.Id.ToString());
                    _session.Delete(r);
                    _session.Flush();
                    _session.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case 5:     // Knjiga
                _session = DataLayer.GetSession();
                Knjiga k = _session.Load <Knjiga>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                MessageBox.Show(k.Naslov);
                _session.Delete(k);
                _session.Flush();
                _session.Close();
                break;

            case 6:     // Autor
                _session = DataLayer.GetSession();
                Autor a = _session.Load <Autor>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                MessageBox.Show(a.Ime + " " + a.Prezime);
                _session.Delete(a);
                _session.Flush();
                _session.Close();
                break;

            case 7:     // Student
                _session = DataLayer.GetSession();
                Student s = _session.Load <Student>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                MessageBox.Show(s.Ime + " " + s.Prezime);
                _session.Delete(s);
                _session.Flush();
                _session.Close();
                break;

            case 8:     // Grupe
                _session = DataLayer.GetSession();
                Grupa g = _session.Load <Grupa>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                MessageBox.Show(g.Naziv);
                _session.Delete(g);
                _session.Flush();
                _session.Close();
                break;

            case 9:     // Izvestaji
                _session = DataLayer.GetSession();
                //ITransaction t = _session.BeginTransaction();
                Izvestaj i = _session.Load <Izvestaj>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                MessageBox.Show(i.Opis);
                _session.Delete(i);
                _session.Flush();
                _session.Close();
                UpdateListViewIzvestaji();
                break;

            case 10:     // Web Stranice
                _session = DataLayer.GetSession();
                WebStranice w = _session.Load <WebStranice>(Int32.Parse(listProjekti.SelectedItems[0].SubItems[0].Text));
                MessageBox.Show(w.Link);
                _session.Delete(w);
                _session.Flush();
                _session.Close();
                break;
            }
        }
 public void PopulateFrom(Rad.Core.Domain.Product p)
 {
     //this.product_rule_cd_id.Value = GSC(SystemCodeType.rul
     this.settlement_action_cd_id.Value = GSC(SystemCodeType.SETTLEMENT_ACTION, p.SettlementAction);
     this.is_expedited.Value = p.IsExpedited;
     this.product_display_name.Value = p.DisplayName;
     this.end_date.Value = p.DisableDate;
     this.product_internal_name.Value = p.InternalName;
     this.start_date.Value = p.EnableDate;
 }