Exemple #1
0
        protected void btnlogin_Click(object sender, EventArgs e)
        {
            string username = usuario.Value;
            string password = contrasenia.Value;

            if (username.Length.Equals(0) || password.Length.Equals(0))
            {
                MessageBox.Show(lbresponse, divResponse, "Complete la información"); return;
            }
            XResponse resp = CrsData.TableSelect(new List <string> {
                "iduser", "username", "tienda"
            }, "usuarios", "username = '******' and password = '******'", BuildType.LstDctStrDyn);

            if (resp.error)
            {
                MessageBox.Error(lbresponse, divResponse, resp.coderr); return;
            }
            if (resp.empty)
            {
                MessageBox.Show(lbresponse, divResponse, "Datos de sesion incorrectos"); return;
            }
            List <Dictionary <string, dynamic> > tabla = (List <Dictionary <string, dynamic> >)resp.objecto;
            XUserLoged _UserLoged = new XUserLoged
            {
                uid    = (int)tabla[0]["iduser"],
                tienda = (string)tabla[0]["tienda"],
                name   = (string)tabla[0]["username"]
            };

            Session["_UserLoged"] = _UserLoged;
            Response.Redirect("Principal.aspx");
        }
Exemple #2
0
        public void FillTable()
        {
            List <string> campos = new List <string> {
                "uid", "id", "name"
            };
            XResponse resp = CrsData.TableSelect(campos, "almacenes", "", BuildType.LstDctStrStr);

            if (resp.error)
            {
                MessageBox.Alert("Ocurrio un error al cargar los datos: " + resp.msgerr, this.Page, this); return;
            }
            List <Dictionary <string, string> > data = (List <Dictionary <string, string> >)resp.objecto;
            HtmlTableRow row = new HtmlTableRow();

            foreach (Dictionary <string, string> item in data)
            {
                row = new HtmlTableRow();
                row.Cells.Add(new HtmlTableCell {
                    InnerHtml = "<button id=\"btn" + item["uid"] + "\" class=\"btn btn - primary btn - sm\">Edit</button>"
                });
                //<asp:Button runat = "server" ID = "btnsave" OnClick = "btnsave_Click" CssClass = "btn btn-primary btn-lg" Text = "Crear" />
                row.Cells.Add(new HtmlTableCell {
                    InnerText = item["id"]
                });
                row.Cells.Add(new HtmlTableCell {
                    InnerText = item["name"]
                });
                tableSeek.Rows.Add(row);
            }
        }
        public void FillTable()
        {
            XResponse resp = CrsData.TableSelect(new List <string> {
                "uid", "nombre"
            }, "familias", "type = '1'", BuildType.LstDctStrStr);

            if (resp.error)
            {
                MessageBox.Alert("Ocurrio un error al cargar los datos: " + resp.msgerr, this.Page, this); return;
            }
            List <Dictionary <string, string> > data = (List <Dictionary <string, string> >)resp.objecto;
            HtmlTableRow row = new HtmlTableRow();
            Button       btn;

            foreach (Dictionary <string, string> item in data)
            {
                btn          = new Button();
                btn.CssClass = "btn btn-primary btn-sm";
                btn.ID       = "btn" + item["uid"];
                btn.Text     = "Edit";
                btn.Click   += EditFam;
                row          = new HtmlTableRow();
                HtmlTableCell cel = new HtmlTableCell();
                cel.Controls.Add(btn);
                row.Cells.Add(cel);
                row.Cells.Add(new HtmlTableCell {
                    InnerText = item["uid"]
                });
                row.Cells.Add(new HtmlTableCell {
                    InnerText = item["nombre"]
                });
                tableSeek.Rows.Add(row);
            }
        }
        protected void btnsave_Click(object sender, EventArgs e)
        {
            string name = txtnombre.Text.Trim();

            if (string.IsNullOrEmpty(name))
            {
                MessageBox.Show(lbresponse, divResponse, "Escriba un nombre!!");
                return;
            }
            //update in familias
            Dictionary <string, dynamic> campos = new Dictionary <string, dynamic>();

            campos.Add("nombre", name);
            XResponse resp = CrsData.TableInsert("familias", campos);

            if (resp.error)
            {
                MessageBox.Error(lbresponse, divResponse, resp.coderr); return;
            }

            MessageBox.Success(lbresponse, divResponse, "Se creo la Familia!!");
        }
Exemple #5
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            string name = txtCodalm.Text.Trim();

            if (string.IsNullOrEmpty(name))
            {
                MessageBox.Show(lbresponse, divResponse, "Escriba un nombre!!");
                return;
            }
            XResponse resp = CrsData.TableSelect(new List <string> {
                "nvalor", "uid"
            }, "control", "", BuildType.LstDctStrDyn);

            if (resp.error || resp.empty)
            {
                MessageBox.Error(lbresponse, divResponse, resp.coderr); return;
            }
            List <Dictionary <string, dynamic> > data = (List <Dictionary <string, dynamic> >)resp.objecto;
            int prefix    = data[0]["nvalor"];
            int recontrol = data[0]["uid"];
            //insert in almacenes
            Dictionary <string, dynamic> campos = new Dictionary <string, dynamic>();

            campos.Add("id", "A" + prefix);
            campos.Add("name", name);
            campos.Add("status", "1");
            resp = CrsData.TableInsert("almacenes", campos);
            if (resp.error)
            {
                MessageBox.Error(lbresponse, divResponse, resp.coderr); return;
            }
            //create tabla de stocks
            string alias = "Stk_A" + prefix;
            bool?  b     = CrsData.ChkTable(alias);

            if (b == null)
            {
                MessageBox.Show(lbresponse, divResponse, "Se creo el almacen pero no Stk_Ax.\r\n favor de llamar a sistemas"); return;
            }
            if (b.Equals(false))
            {
                resp = CrsData.CreateTable(CodexDBF.TableCode.Stk_Ax, alias);
                if (resp.error)
                {
                    MessageBox.Error(lbresponse, divResponse, resp.coderr, "No se creo la tabla stock Error:"); return;
                }
            }

            /*create tabla de catalogo
             * alias = "Cat_A" + prefix;
             * b = CrsData.ChkTable(alias);
             * if (b == null) { MessageBox.Show(lbresponse, divResponse, "Se creo el almacen pero no Cat_Ax.\r\n favor de llamar a sistemas"); return; }
             * if (b.Equals(false))
             * {
             *  resp = CrsData.CreateTable(CodexDBF.TableCode.Stk_Ax, alias);
             *  if (resp.error) { MessageBox.MsgError(lbresponse, divResponse, resp.coderr, "No se creo la tabla stock Error:"); return; }
             * }*/
            //update control
            prefix++;
            CrsData.TableUpdate("control", new Dictionary <string, dynamic> {
                { "nvalor", prefix }
            }, "uid = '" + recontrol + "'");
            MessageBox.Success(lbresponse, divResponse, "Se creo el almacen!!");
        }