Ejemplo n.º 1
0
        public static double UcitajCilj(int?korisnikId, int?magacinId)
        {
            if (korisnikId == null || magacinId == null)
            {
                return(-1);
            }

            double d = 0;

            using (FbConnection con = new FbConnection(M.Baza.connectionString))
            {
                con.Open();
                using (FbCommand cmd = new FbCommand("SELECT JSONSTRING FROM JSON WHERE TITLE = 'CiljMagacina' AND KORISNIKID = @KorisnikID AND MAGACINID = @MagacinID", con))
                {
                    cmd.Parameters.AddWithValue("@KorisnikID", korisnikId);
                    cmd.Parameters.AddWithValue("@MagacinID", magacinId);

                    FbDataReader dr = cmd.ExecuteReader();

                    if (dr.Read())
                    {
                        CiljMagacina cm = JsonConvert.DeserializeObject <CiljMagacina>(dr[0].ToString());
                        d = cm.godisnjiRast;
                    }
                }
                con.Close();
            }
            return(d);
        }
Ejemplo n.º 2
0
        private void DesifrujJson(string jsonString)
        {
            CiljMagacina cm = JsonConvert.DeserializeObject <CiljMagacina>(jsonString);

            this.id            = cm.id;
            this.isGlobal      = cm.isGlobal;
            this.godisnjiRabat = cm.godisnjiRabat;
            this.godisnjiRast  = cm.godisnjiRast;
            this.procentualno  = cm.procentualno;
        }
Ejemplo n.º 3
0
        private void sacuvaj_btn_Click(object sender, EventArgs e)
        {
            if (!isGlobal)
            {
                switch (magacinId)
                {
                case 12:
                    cm.godisnjiRast = Convert.ToDouble(m12_txt.Text);
                    cm.procentualno = (m12_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 13:
                    cm.godisnjiRast = Convert.ToDouble(m13_txt.Text);
                    cm.procentualno = (m13_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 14:
                    cm.godisnjiRast = Convert.ToDouble(m14_txt.Text);
                    cm.procentualno = (m14_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 15:
                    cm.godisnjiRast = Convert.ToDouble(m15_txt.Text);
                    cm.procentualno = (m15_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 16:
                    cm.godisnjiRast = Convert.ToDouble(m16_txt.Text);
                    cm.procentualno = (m16_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 17:
                    cm.godisnjiRast = Convert.ToDouble(m17_txt.Text);
                    cm.procentualno = (m17_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 18:
                    cm.godisnjiRast = Convert.ToDouble(m18_txt.Text);
                    cm.procentualno = (m18_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 19:
                    cm.godisnjiRast = Convert.ToDouble(m19_txt.Text);
                    cm.procentualno = (m19_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 20:
                    cm.godisnjiRast = Convert.ToDouble(m20_txt.Text);
                    cm.procentualno = (m20_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 21:
                    cm.godisnjiRast = Convert.ToDouble(m21_txt.Text);
                    cm.procentualno = (m21_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 22:
                    cm.godisnjiRast = Convert.ToDouble(m22_txt.Text);
                    cm.procentualno = (m22_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 23:
                    cm.godisnjiRast = Convert.ToDouble(m23_txt.Text);
                    cm.procentualno = (m23_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 24:
                    cm.godisnjiRast = Convert.ToDouble(m24_txt.Text);
                    cm.procentualno = (m24_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 25:
                    cm.godisnjiRast = Convert.ToDouble(m25_txt.Text);
                    cm.procentualno = (m25_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 26:
                    cm.godisnjiRast = Convert.ToDouble(m26_txt.Text);
                    cm.procentualno = (m26_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 27:
                    cm.godisnjiRast = Convert.ToDouble(m27_txt.Text);
                    cm.procentualno = (m27_cmb.SelectedIndex == 1) ? true : false;
                    break;

                case 28:
                    cm.godisnjiRast = Convert.ToDouble(m28_txt.Text);
                    cm.procentualno = (m28_cmb.SelectedIndex == 1) ? true : false;
                    break;
                }
                cm.Zapisi(isGlobal, korisnikId, magacinId);
            }
            else
            {
                for (int i = 12; i < 28; i++)
                {
                    CiljMagacina c = cm_g[i - 12];

                    switch (i)
                    {
                    case 12:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m12_txt.Text)) ? 0 : Convert.ToDouble(m12_txt.Text);
                        c.procentualno = (m12_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 13:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m13_txt.Text)) ? 0 : Convert.ToDouble(m13_txt.Text);
                        c.procentualno = (m13_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 14:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m14_txt.Text)) ? 0 : Convert.ToDouble(m14_txt.Text);
                        c.procentualno = (m14_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 15:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m15_txt.Text)) ? 0 : Convert.ToDouble(m15_txt.Text);
                        c.procentualno = (m15_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 16:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m16_txt.Text)) ? 0 : Convert.ToDouble(m16_txt.Text);
                        c.procentualno = (m16_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 17:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m17_txt.Text)) ? 0 : Convert.ToDouble(m17_txt.Text);
                        c.procentualno = (m17_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 18:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m18_txt.Text)) ? 0 : Convert.ToDouble(m18_txt.Text);
                        c.procentualno = (m18_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 19:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m19_txt.Text)) ? 0 : Convert.ToDouble(m19_txt.Text);
                        c.procentualno = (m19_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 20:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m20_txt.Text)) ? 0 : Convert.ToDouble(m20_txt.Text);
                        c.procentualno = (m20_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 21:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m21_txt.Text)) ? 0 : Convert.ToDouble(m21_txt.Text);
                        c.procentualno = (m21_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 22:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m22_txt.Text)) ? 0 : Convert.ToDouble(m22_txt.Text);
                        c.procentualno = (m22_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 23:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m23_txt.Text)) ? 0 : Convert.ToDouble(m23_txt.Text);
                        c.procentualno = (m23_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 24:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m24_txt.Text)) ? 0 : Convert.ToDouble(m24_txt.Text);
                        c.procentualno = (m24_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 25:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m25_txt.Text)) ? 0 : Convert.ToDouble(m25_txt.Text);
                        c.procentualno = (m25_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 26:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m26_txt.Text)) ? 0 : Convert.ToDouble(m26_txt.Text);
                        c.procentualno = (m26_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 27:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m27_txt.Text)) ? 0 : Convert.ToDouble(m27_txt.Text);
                        c.procentualno = (m27_cmb.SelectedIndex == 1) ? true : false;
                        break;

                    case 28:
                        c.godisnjiRast = (string.IsNullOrWhiteSpace(m28_txt.Text)) ? 0 : Convert.ToDouble(m28_txt.Text);
                        c.procentualno = (m28_cmb.SelectedIndex == 1) ? true : false;
                        break;
                    }
                    c.Zapisi(isGlobal, -1, i);
                }
            }
        }
Ejemplo n.º 4
0
        private void UcitajGlobalniCilj()
        {
            for (int i = 12; i < 29; i++)
            {
                CiljMagacina c = new CiljMagacina();
                c.Initialize(-1, i);

                cm_g.Add(c);

                switch (i)
                {
                case 12:
                    m12_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m12_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 13:
                    m13_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m13_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 14:
                    m14_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m14_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 15:
                    m15_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m15_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 16:
                    m16_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m16_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 17:
                    m17_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m17_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 18:
                    m18_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m18_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 19:
                    m19_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m19_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 20:
                    m20_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m20_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 21:
                    m21_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m21_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 22:
                    m22_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m22_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 23:
                    m23_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m23_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 24:
                    m24_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m24_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 25:
                    m25_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m25_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 26:
                    m26_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m26_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 27:
                    m27_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m27_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;

                case 28:
                    m28_txt.Text          = String.Format("{0:##}", c.godisnjiRast);
                    m28_cmb.SelectedIndex = (c.procentualno) ? 1 : 0;
                    break;
                }
            }
        }