Beispiel #1
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            try {
                this.loading = true;
                if (this.empty)
                {
                    cmb_tag.DataSource    = tag.dl.all_tags(logged.id_utente());
                    cmb_tag.DisplayMember = "title";
                    cmb_tag.ValueMember   = "id";
                    cmb_tag.Text          = "";
                    if (this.new_tag)
                    {
                        web_path.html_owner_paths(this.web_path.path, out string styles, out string html, this.main.style, false);
                        (new light_view(this.main.style, this.wb_path)).set_html(html, styles);
                        pb_del.Visible = false;
                        btn_ok.Text    = "aggiungi";
                    }
                    else
                    {
                        web_path.html_owner_paths(this.web_tag.path, out string styles, out string html, this.main.style, false);
                        (new light_view(this.main.style, this.wb_path)).set_html(html, styles);

                        cmb_tag.Text   = this.web_tag.tag.title;
                        txt_notes.Text = this.web_tag.tag.note;

                        pb_del.Visible = true;
                        btn_ok.Text    = "aggiorna";
                    }
                }
            } finally { this.loading = false; }

            cmb_tag.Focus();

            return(new after_show(true));
        }
Beispiel #2
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            if (this.empty)
            {
                cmb_title.DataSource = value.dl.read_titles(logged.utente());

                if (this.new_value)
                {
                    web_path.html_owner_paths(this.web_path.path, out string styles, out string html, this.main.style, false);
                    (new light_view(this.main.style, this.wb_path)).set_html(html, styles);
                    cmb_title.SelectedIndex = -1;
                    pb_del.Visible          = false;
                    btn_ok.Text             = "aggiungi";
                }
                else
                {
                    web_path.html_owner_paths(this.web_value.path, out string styles, out string html, this.main.style, false);
                    (new light_view(this.main.style, this.wb_path)).set_html(html, styles);

                    cmb_title.Text = this.web_value.value.title;
                    txt_value.Text = this.web_value.value.val;
                    txt_notes.Text = this.web_value.value.notes;

                    (new light_view(this.main.style, this.wb_footer)).set_html($@"<div class='row'>
            <div class='col-sm-12 no-wrap op-6'>inserita {this.web_value.value.dt_ins.ToString("dddd dd MMMM yyyy")}</div></div>");

                    pb_del.Visible = true;
                    btn_ok.Text    = "aggiorna";
                }
            }

            cmb_title.Focus();

            return(new after_show(true));
        }
Beispiel #3
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            if (this.empty)
            {
                if (this.new_key)
                {
                    web_path.html_owner_paths(this.web_path.path, out string styles, out string html, this.main.style, false);
                    (new light_view(this.main.style, this.wb_path)).set_html(html, styles);
                    pb_del.Visible = false;
                    btn_ok.Text    = "aggiungi";
                }
                else
                {
                    web_path.html_owner_paths(this.web_key.path, out string styles, out string html, this.main.style, false);
                    (new light_view(this.main.style, this.wb_path)).set_html(html, styles);

                    txt_utente.Text   = this.web_key.key.name;
                    txt_password.Text = this.web_key.key.pwd_decrypt;

                    (new light_view(this.main.style, this.wb_footer)).set_html($@"<div class='row'>
            <div class='col-sm-6 no-wrap op-6'>inserita {this.web_key.key.dt_ins.ToString("dddd dd MMMM yyyy")}</div>
            <div class='col-sm-6 no-wrap op-6'>{(this.web_key.key.dt_upd.HasValue ? $"aggiornata {this.web_key.key.dt_upd.Value.ToString("dddd dd MMMM yyyy")}" : "")}</div></div>");

                    pb_del.Visible = true;
                    btn_ok.Text    = "aggiorna";
                }
            }

            txt_utente.Focus();

            return(new after_show(true));
        }
Beispiel #4
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            if (this.empty)
            {
                if (this.new_link)
                {
                    web_path.html_owner_paths(this.web_path.path, out string styles, out string html, this.main.style, false);
                    (new light_view(this.main.style, this.wb_path)).set_html(html, styles);
                    pb_del.Visible = false;
                    btn_ok.Text    = "aggiungi";
                }
                else
                {
                    web_path.html_owner_paths(this.web_link.path, out string styles, out string html, this.main.style, false);
                    (new light_view(this.main.style, this.wb_path)).set_html(html, styles);

                    txt_title.Text = this.web_link.link.title;
                    txt_url.Text   = this.web_link.link.url;

                    (new light_view(this.main.style, this.wb_footer)).set_html($@"<div class='row'>
            <div class='col-sm-12 no-wrap op-6'>inserita {this.web_link.link.dt_ins.ToString("dddd dd MMMM yyyy")}</div></div>");

                    pb_del.Visible = true;
                    btn_ok.Text    = "aggiorna";
                }
            }

            txt_title.Focus();

            return(new after_show(true));
        }
Beispiel #5
0
 protected override after_show show_view(mwa.cmds.cmd c = null)
 {
     this.main.set_title("Login");
     this.state = state_login.none;
     txt_utente.Focus();
     return(new after_show());
 }
Beispiel #6
0
 protected override after_show show_view(mwa.cmds.cmd c = null)
 {
     if (this.empty)
     {
         load_page();
     }
     return(new after_show());
 }
Beispiel #7
0
 public after_show load_view(mwa.cmds.cmd c = null)
 {
     try {
         this.loading = true;
         after_show a = this.show_view(c);
         this.empty = false;
         return(a);
     } catch (Exception ex) { main.set_status_err(ex); return(new after_show()); } finally { this.loading = false; }
 }
Beispiel #8
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            try {
                this.loading = true;

                if (this.empty)
                {
                    cmb_tipo.DataSource     = logged.data().tipi_spesa;
                    cmb_tipo.ValueMember    = "id";
                    cmb_tipo.DisplayMember  = "title";
                    cmb_tipo.DropDownHeight = 150;

                    if (this.new_scontrino)
                    {
                        pb_cancel.Visible = false;
                        this.title_view   = "Nuovo Scontrino";

                        cmb_tipo.SelectedIndex = -1;
                        cmb_tipo.Focus();

                        scontrino s = scontrino.dl.last_ins(logged.utente());
                        dt_il.Value            = s.data.Value;
                        cmb_tipo.SelectedValue = s.id_tipo.Value;
                        txt_qta.Text           = "";

                        btn_ok.Text = "aggiungi ed esci";

                        btn_ok_2.Visible = true;
                        btn_ok_2.Text    = "aggiungi e fanne un'altro\n(CTRL + A)";
                    }
                    else
                    {
                        scontrino s = this.scontrino;

                        cmb_tipo.SelectedValue = s.id_tipo;
                        txt_cosa.Text          = s.cosa;
                        txt_prezzo.Text        = fld.dec_to_money(s.prezzo);
                        txt_qta.Text           = s.qta.HasValue ? s.qta.ToString() : "";
                        txt_importo.Text       = fld.dec_to_money(s.importo);
                        if (s.data.HasValue)
                        {
                            dt_il.Value = s.data.Value;
                        }

                        cmb_tipo.Focus();

                        btn_ok.Text      = "aggiorna";
                        btn_ok_2.Visible = false;
                    }
                }
            } finally { this.loading = false; }

            return(new after_show(true));
        }
Beispiel #9
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            // data
            if (this.empty)
            {
                reload_ccorrenti();
                load_movs();
                dgv_movs.Focus();
            }

            return(new after_show());
        }
Beispiel #10
0
        public void show_view(Type tp_view, mwa.cmds.cmd c = null)
        {
            try {
                if (def_view.find_def_view(tp_view) == null)
                {
                    throw new Exception($"vista '{tp_view.Name}' non definita!");
                }

                bool is_login = tp_view.Name == typeof(vw_login).Name;

                base_view vw = null;
                if (this.active_view == null || (this.active_view != null && this.active_view.GetType().Name != tp_view.Name))
                {
                    // show
                    int i = _stack_views.FindIndex(x => x.GetType().Name == tp_view.Name);
                    if (i >= 0)
                    {
                        vw = _stack_views[i];
                        _stack_views.RemoveAt(i);
                    }
                    else
                    {
                        vw                 = (base_view)Activator.CreateInstance(tp_view, new object[] { this });
                        vw.TopLevel        = false;
                        vw.FormBorderStyle = FormBorderStyle.None;
                    }

                    // stack
                    if (active_view != null)
                    {
                        if (!is_login && active_view.tp_view.tipo != def_view.type_view.login)
                        {
                            _stack_views.Insert(0, active_view); active_view.Hide();
                        }
                        else
                        {
                            active_view.Close();
                        }
                        pnl_main.Controls.Remove(active_view);
                    }

                    pnl_main.Controls.Add(vw);
                    vw.Dock = DockStyle.Fill;
                    vw.Show();
                }
                else
                {
                    vw = this.active_view;
                }

                show_view2(vw, c);
            } catch (Exception ex) { set_status_err(ex); }
        }
Beispiel #11
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            if (this.empty)
            {
                load_page();
            }

            // add?
            if (c != null && c.action == "add" && c.obj == "scontrino")
            {
                add_scontrino(); return(new after_show(true));
            }

            return(new after_show());
        }
Beispiel #12
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            // data
            if (this.empty)
            {
                DataGridViewComboBoxColumn cb = (DataGridViewComboBoxColumn)dgv_spese.Columns["id_cat_spesa"];
                cb.DataSource = logged.data().cats_spesa_for_combo;

                // categorie
                reload_categorie();

                load_tipi_spesa();
                dgv_spese.Focus();
                return(new after_show(true));
            }

            return(new after_show());
        }
Beispiel #13
0
        public bool elab_cmd(mwa.cmds.cmd c)
        {
            if (c.group.type == cmds.cmd.type_cmd.system)
            {
                if (c.action == "exit")
                {
                    this.exit(); return(true);
                }
                else if (c.action == "logout")
                {
                    this.logout(); return(true);
                }
                else if (c.action == "close")
                {
                    this.chiudi(); return(true);
                }
                else if (c.action == "view")
                {
                    this.show_view(c.view, c); return(true);
                }
            }
            else if (c.has_view)
            {
                if (c.only_active_view)
                {
                    if (active_view != null && active_view.GetType().Name == Type.GetType("mwa.views." + c.view, true).Name)
                    {
                        this.show_view(c.view, c); return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    this.show_view(c.view, c); return(true);
                }
            }

            return(false);
        }
Beispiel #14
0
        protected void show_view2(base_view vw, mwa.cmds.cmd c = null, bool from_back = false)
        {
            try {
                bool is_login = vw.GetType().Name == typeof(vw_login).Name;

                // pulisco
                //if(pnl_main.Controls.Count > 0) {
                //  base_view v = pnl_main.Controls[0] as base_view;
                //  if(v == null) throw new Exception("situazione anomala, vista errata!");
                //  v.Close();
                //  v.Dispose();
                //}

                this.foot.clear();
                this.set_title();

                this.active_path = null;

                vw.from_back = from_back;
                after_show a = vw.load_view(c);
                if (!is_login)
                {
                    set_title(!string.IsNullOrEmpty(vw.title_view) ? vw.title_view : vw.tp_view.title_view);
                }

                cmb_cmds.showed_view(vw);
                if (!a.focus_on_view)
                {
                    focus_cmd_line();
                }

                if (vw.tp_view.image_32 != null)
                {
                    set_image(vw.tp_view.image_32);
                }
                else
                {
                    set_default_image();
                }
            } catch (Exception ex) { set_status_err(ex); }
        }
Beispiel #15
0
 protected virtual after_show show_view(mwa.cmds.cmd c = null)
 {
     return(new after_show());
 }
Beispiel #16
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            try {
                this.loading = true;
                if (this.empty)
                {
                    if (this.new_user)
                    {
                        this.title_view = "Nuovo Utente";
                        txt_utente.Focus();

                        lbl_pass.Visible             = lbl_pass2.Visible
                                                     = txt_new_password.Visible = txt_conf_password.Visible = pb_disattiva.Visible = false;

                        btn_ok.Text = "aggiungi";
                    }
                    else
                    {
                        utente u = this.utente;

                        lbl_pass.Text = "Reimposta Password";
                        txt_mail.Focus();
                        if (u.is_to_activate)
                        {
                            lbl_pass.Visible = lbl_pass2.Visible = txt_new_password.Visible
                                                                       = txt_conf_password.Visible = pb_disattiva.Visible = false;
                        }
                        else
                        {
                            if (u.disactive)
                            {
                                pb_disattiva.Image = Properties.Resources.guarantee_32;
                                pb_disattiva.Tag   = "attiva";
                                base_tooltip1.SetToolTip(pb_disattiva, "riabilita l'utente assegnandogli una chiave di attivazione");
                            }
                            else
                            {
                                pb_disattiva.Image = Properties.Resources.dont_touch_32;
                                pb_disattiva.Tag   = "disattiva";
                                base_tooltip1.SetToolTip(pb_disattiva, "disabilita l'utente");
                            }
                        }

                        txt_utente.Text     = u.login;
                        txt_utente.ReadOnly = true;
                        txt_mail.Text       = u.mail;

                        btn_ok.Text = "aggiorna";

                        (new light_view(this.main.style, this.wb_footer)).set_html($@"<div class='op-6'><span class='mr-3 text-muted no-wrap'>id: {u.id}</span>
              <span class='mr-3 no-wrap'>Inserito: {u.dt_ins.Value.ToString("dddd dd MMMM yyyy")}</span>
              {(u.is_to_activate ? $"<span class='mr-3 no-wrap light'>Si deve attivare, key: {u.active_key}</span>" : "")}
              {(u.is_scaduto ? "<span class='mr-3 no-wrap warning'>Utente scaduto</span>" : "")}
              {(u.activated ? $@"<span class='mr-3 no-wrap'>Attivato: {u.dt_activate.Value.ToString("dddd dd MMMM yyyy")}</span>" : "")}
              {(u.disactive ? $@"<span class='mr-3 warning'>Disattivato</span>" : "")}
              {(u.last_login.HasValue ? $"<span class='mr-3 no-wrap op-6'>Ultimo login: {u.last_login.Value.ToString("dddd dd MMMM yyyy")}</span>" : "")}</div>");
                    }
                }
            } finally { this.loading = false; }

            return(new after_show(true));
        }
Beispiel #17
0
 public void show_view(string name, mwa.cmds.cmd c = null)
 {
     try {
         show_view(Type.GetType("mwa.views." + name, true), c);
     } catch (Exception ex) { set_status_err(ex); }
 }
Beispiel #18
0
        protected override after_show show_view(mwa.cmds.cmd c = null)
        {
            if (this.from_back)
            {
                return(new after_show());
            }

            if (c != null)
            {
                // add path
                if (c.action == "add" && c.obj == "path")
                {
                    add_path(c.subobj);
                }
                // add subpath
                else if (c.action == "add" && c.obj == "subpath")
                {
                    add_subpath(c.subobj);
                }
                // \\
                else if (c.action == "\\\\")
                {
                    view_root();
                }
                // \\.....
                else if (c.prefix == "\\\\")
                {
                    path p = path.dl.get_path(logged.utente(), c.line_cmd);
                    if (p != null)
                    {
                        view_path(p);
                    }
                    else
                    {
                        view_no_path(c.line_cmd);
                    }
                }
                // \.....
                else if (c.prefix == "\\")
                {
                    if (this.active_path != null)
                    {
                        string full = this.active_path.full_path + c.line_cmd;
                        path   p    = path.dl.get_path(logged.utente(), full);
                        if (p != null)
                        {
                            view_path(p);
                        }
                        else
                        {
                            this.main.set_status_err($"il percorso '{full}' non esiste, vuoi aggiungerlo!", onclick: new EventHandler(this.add_sub_path), data: full);
                        }
                    }
                }
                // ..
                else if (c.action == "..")
                {
                    if (this.active_path != null)
                    {
                        if (this.active_path.id_parent.HasValue)
                        {
                            view_path(new path(logged.utente(), this.active_path.id_parent.Value));
                        }
                        else
                        {
                            view_root();
                        }
                    }
                }
                // add tag
                else if (c.action == "add" && c.obj == "tag")
                {
                    this.wb_path.add_tag(c.subobj);
                    set_active(this.active_path);
                }
                // add key
                else if (c.action == "add" && c.obj == "key")
                {
                    this.wb_path.add_key(c.subobj, c.subobj2);
                    set_active(this.active_path);
                }
                // add value
                else if (c.action == "add" && c.obj == "value")
                {
                    this.wb_path.add_value(c.subobj, c.subobj2);
                    set_active(this.active_path);
                }
                // add user/pwd
                else if (c.action == "add" && c.obj == "user/pwd")
                {
                    string u, p;
                    if (!c.subobj.Contains("/"))
                    {
                        u = c.subobj; p = "";
                    }
                    else
                    {
                        u = c.subobj.Split(new char[] { '/' })[0]; p = c.subobj.Split(new char[] { '/' })[1];
                    }
                    this.wb_path.add_key(u, p);
                    set_active(this.active_path);
                }
                // add link
                else if (c.action == "add" && c.obj == "link")
                {
                    string url = c.subobj, title = c.subobj2;
                    this.wb_path.add_link(title, url);
                    set_active(this.active_path);
                }
            }
            else
            {
                view_root();
            }

            return(new after_show());
        }