void Page_Load(object sender, EventArgs e)
        {
            if (!this.CheckIsLoaded())
            {
                try
                {
                    this.mCurrentUser      = this.mMaster.pCurrentUser;
                    this.mSystem_ModulesID = (Int64)this.ViewState[CnsSystem_ModulesID];
                    this.mIsReadOnly       = this.pIsReadOnly;
                    this.mObjID            = (string)this.ViewState[CnsObjID];
                    this.mObj_Base         = (ClsBase)this.Session[this.mObjID];

                    if (!this.IsPostBack)
                    {
                        this.SetupPage();
                        this.Save_Redirected();
                    }

                    this.SetupPage_ControlAttributes();
                }
                catch (Exception ex)
                {
                    Layer01_Methods_Web.ErrorHandler(ex, this.Server);
                    throw ex;
                }
            }
        }
Esempio n. 2
0
        protected void btninsertar_Click(object sender, EventArgs e)
        {
            String idempresa         = txtidempresa.Text;
            String Nombredelaempresa = txtnombredelaempresa.Text;
            String Nombredeldirector = txtdirector.Text;
            String NombreComercial   = txtDirectorCom.Text;
            String Recepcioncaja     = txtrecepciona.Text;
            String Calle             = txtcalle.Text;
            String numext            = txtnumext.Text;
            String numint            = txtnumint.Text;
            String Colonia           = txtcolonia.Text;
            String Ciudad            = txtCiudad.Text;
            String Estado            = DDLestados.Text;
            String cp       = txtCP.Text;
            String Telefono = txtTelefono.Text;
            String mail     = txtmail.Text;
            String RFC      = txtRFC.Text;
            String siglas   = txtSiglas.Text;
            bool   activa   = ChkActiva.Checked;
            String Regimen  = txtRegimen.Text;

            String cadena = "INSERT INTO EMPRESA (id_empresa,Empresa,Director,Director_comercial,Recepcion_caja,Calle,NoExt,NoInt,Colonia,Municipio,Estado,Cp,Telefono,mail,RFC,Siglas,Activa,Regimen ) Values ";

            cadena += "('" + idempresa + "',";
            cadena += "'" + Nombredelaempresa + "',";
            cadena += "'" + Nombredeldirector + "',";
            cadena += "'" + NombreComercial + "',";
            cadena += "'" + Recepcioncaja + "',";
            cadena += "'" + Calle + "',";
            cadena += "'" + numext + "',";
            cadena += "'" + numint + "',";
            cadena += "'" + Colonia + "',";
            cadena += "'" + Ciudad + "',";
            cadena += "'" + Estado + "',";
            cadena += "'" + cp + "',";
            cadena += "'" + Telefono + "',";
            cadena += "'" + mail + "',";
            cadena += "'" + RFC + "',";
            cadena += "'" + siglas + "',";
            if (activa)
            {
                cadena += "1,";
            }
            else
            {
                cadena += "0,";
            }

            cadena += "'" + Regimen + "')";
            try
            { ClsBase.Ejecutar(cadena);
              Response.Redirect("~/paginas/Empresa/wbfRegistrarempresa.aspx"); }
            catch (Exception errorm)
            {
                lblMensajedeerror.Text = "El DBMS devolvio: " + errorm.Message;
            }
        }
        public eLoginResult Login(string UserName, string Password)
        {
            Interface_DataAccess Da = new ClsBase().pDa;

            try
            {
                Da.Connect();

                //Administrator Login
                if (UserName.ToUpper() == "Administrator".ToUpper())
                {
                    string System_Password = Da.GetSystemParameter("Administrator_Password", "Administrator");
                    if (System_Password != "")
                    {
                        string Decrypted_Password = System_Password;
                        if (Decrypted_Password == Password)
                        {
                            this.AdministratorLogin();
                            return(eLoginResult.Administrator);
                        }
                        else
                        {
                            return(eLoginResult.WrongPassword);
                        }
                    }
                    else
                    {
                        throw new CustomException("Administrator Password is not set. Contact your System Administrator.");
                    }
                }

                //User Login
                QueryCondition Qc = new QueryCondition();
                Qc.Add("UserName", UserName, typeof(string).ToString());
                DataTable Dt = Da.GetQuery("uvw_User", "", Qc, "UserID");
                if (Dt.Rows.Count > 0)
                {
                    string Decrypted_Password = (string)Do_Methods.IsNull(Dt.Rows[0]["Password"], "");

                    if (Decrypted_Password == Password)
                    {
                        this.mDrUser = Dt.Rows[0];
                        return(eLoginResult.LoggedIn);
                    }
                    else
                    {
                        return(eLoginResult.WrongPassword);
                    }
                }

                return(eLoginResult.WrongUser);
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { Da.Close(); }
        }
Esempio n. 4
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //e es un objeto de tipo grid el cual obtiene las propuedades de el
            //e.comand name obtiene el nombre del evento del botoón
            //

            if (e.CommandName == "borrar")
            {
                GridViewRow FilaSeccionado;
                int         index = Convert.ToInt32(e.CommandArgument);


                FilaSeccionado = GridView1.Rows[index];
                string numero = FilaSeccionado.Cells[1].Text;
                string cadena = " DELETE FROM Departamentos  WHERE Departamentos.Id_departamento ='" + numero + "'";
                try
                {
                    ClsBase.Ejecutar(cadena);
                }
                catch (Exception errorm)
                {
                    LabelMensaje.Text = "El DBMS devolvio: " + errorm.Message;
                }
                finally
                {
                    Response.Redirect("/Paginas/Catalogos/Cis/ListadoCis.aspx", true);//
                }
            }

            if (e.CommandName == "modificar")
            {
                GridViewRow FilaSeccionado;
                int         index = Convert.ToInt32(e.CommandArgument);
                FilaSeccionado = GridView1.Rows[index];


                string Id_departamento = FilaSeccionado.Cells[0].Text;
                string Descripcion     = FilaSeccionado.Cells[1].Text;
                string Responsable     = FilaSeccionado.Cells[2].Text;
                string id_direccion    = FilaSeccionado.Cells[3].Text;
                string Id_empresa      = FilaSeccionado.Cells[4].Text;


                Response.Redirect("~/Paginas/Catalogos/Cis/ModificacionCis.aspx?Id_departamento="
                                  + Id_departamento + "&Descripcion=" + Descripcion + "&Responsable=" + Responsable + "&id_direccion=" + id_direccion + "&Id_empresa=" + Id_empresa);
            }
        }
        public void Setup(
            Keys Keys
            , Layer01_Common.Common.Layer01_Constants.eSystem_Modules pSystem_ModulesID
            , ClsBase pObjBase
            , string pModuleName = "")
        {
            this.mSystem_ModulesID = (Int64)pSystem_ModulesID;
            this.ViewState[CnsSystem_ModulesID] = pSystem_ModulesID;
            this.ViewState[CnsModuleName]       = pModuleName;
            this.mObj_Base = pObjBase;
            this.mObj_Base.Load(Keys);

            this.mCurrentUser         = this.mMaster.pCurrentUser;
            this.mObjID               = this.mCurrentUser.GetNewPageObjectID();
            this.ViewState[CnsObjID]  = this.mObjID;
            this.Session[this.mObjID] = this.mObj_Base;
        }
        protected void ButtonInsertar_Click(object sender, EventArgs e)
        {
            string cadena = " UPDATE Departamentos SET Descripcion ='" + TextBoxDescripcion.Text + "',Responsable = '" + TextBoxResponsable.Text + "',id_direccion = '" + DropDownListIdDireccion.SelectedValue + "',Id_empresa = '" + this.Id_empresa + "' WHERE Id_departamento='" + this.Id_departamento + "'";


            try
            {
                ClsBase.Ejecutar(cadena);
            }
            catch (Exception errorm)
            {
                LabelMensaje.Text = "El DBMS devolvio: " + errorm.Message;
            }
            finally
            {
                Response.Redirect("/Paginas/Catalogos/Cis/ListadoCis.aspx", true);//
            }
        }
        protected virtual void Setup(
            Layer01_Constants.eSystem_Modules pSystem_ModulesID
            , ClsBase pObj_Base
            , string pModuleName = "")
        {
            Keys Keys = null;

            try
            {
                Keys = (Keys)this.Session[Layer01_Constants_Web.CnsSession_Keys];
                this.Session[Layer01_Constants_Web.CnsSession_Keys] = null;
            }
            catch { }

            this.mMaster.Setup(Keys, pSystem_ModulesID, pObj_Base, pModuleName);
            this.mSystem_ModulesID = (Int64)pSystem_ModulesID;
            this.Session[this.mMaster.pObjID + CnsSessionPageObj] = new Collection();
        }
        public void AdministratorLogin()
        {
            Interface_DataAccess Da = new ClsBase().pDa;

            try
            {
                Da.Connect();
                DataTable Dt = Da.GetQuery("uvw_User", "*", "1 = 0");
                this.mDrUser                 = Dt.NewRow();
                this.mDrUser["UserID"]       = 0;
                this.mDrUser["EmployeeID"]   = 0;
                this.mDrUser["UserName"]     = "******";
                this.mDrUser["EmployeeName"] = "Administrator";
                this.mIsAdmin                = true;
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { Da.Close(); }
        }
        public ClsBaseRowDetail(ClsBase pObj_Base, string pHeaderName, string pTableName, string pViewName = "", string pOtherLoadCondition = "")
        {
            if (pViewName == "")
            {
                pViewName = pTableName;
            }

            this.mHeaderName         = pHeaderName;
            this.mTableName          = pTableName;
            this.mViewName           = pViewName;
            this.mOtherLoadCondition = pOtherLoadCondition;
            this.mObj_Base           = pObj_Base;

            DataTable Dt_Def = Methods_Query.GetTableDef(this.mTableName);

            DataRow[] ArrDr = Dt_Def.Select("IsPk = 1");
            foreach (DataRow Dr in ArrDr)
            {
                this.mList_Key.Add((string)Dr["ColumnName"]);
            }
        }
Esempio n. 10
0
        public void Setup(
            Layer01_Common.Common.Layer01_Constants.eSystem_Modules pSystem_ModulesID
            , ClsBase pObjBase
            , string pSystem_BindDefinition_Name
            , string pOverride_PageUrl_Details_New = ""
            , string pSource     = ""
            , string pSourceKey  = ""
            , bool pIsNoSelect   = false
            , string pModuleName = "")
        {
            this.mSystem_ModulesID          = (Int64)pSystem_ModulesID;
            this.mObj_Base                  = pObjBase;
            this.mSystem_BinDefinition_Name = pSystem_BindDefinition_Name;

            this.ViewState[CnsSystem_ModulesID]             = pSystem_ModulesID;
            this.ViewState[CnsOverride_PageUrl_Details_New] = pOverride_PageUrl_Details_New;
            this.ViewState[CnsSystem_BindDefinition_Name]   = pSystem_BindDefinition_Name;
            this.ViewState[CnsSource]     = pSource;
            this.ViewState[CnsSourceKey]  = pSourceKey;
            this.ViewState[CnsIsNoSelect] = pIsNoSelect;
            this.ViewState[CnsModuleName] = pModuleName;
        }
Esempio n. 11
0
        protected void ButtonInsertar_Click(object sender, EventArgs e)
        {
            string idDepartamento = TextBoxIdDepartamento.Text;
            string Descripcion    = TextBoxDescripcion.Text;
            string responsable    = TextBoxResponsable.Text;
            string idDireccion    = DropDownListIdDireccion.SelectedValue;
            string IdEmpresa      = (string)(Session["Empresa"]);

            string cadena = "INSERT INTO Departamentos (Id_departamento,Descripcion,Responsable ,id_direccion ,Id_empresa)VALUES('" + idDepartamento + "','" + Descripcion + "','" + responsable + "','" + idDireccion + "','" + IdEmpresa + "')";

            try
            {
                ClsBase.Ejecutar(cadena);
            }
            catch (Exception errorm)
            {
                LabelMensaje.Text = "El DBMS devolvio: " + errorm.Message;
            }
            finally {
                TextBoxIdDepartamento.Text = "";
                TextBoxIdDepartamento.Text = "";
                TextBoxResponsable.Text    = "";
            }
        }
Esempio n. 12
0
 public void Add(string Name, ClsBase Obj)
 {
     this.mList_Obj.Add(new Str_Obj(Name, Obj));
 }
Esempio n. 13
0
 public Str_Obj(string pName, ClsBase pObj)
 {
     this.Name = pName;
     this.Obj  = pObj;
 }