Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Int32 records = 0;

            if (validateData())
            {
                Entities.ClassRoom     oClassRoom     = new Entities.ClassRoom();
                Entities.Program       oProgram       = new Entities.Program();
                Entities.ActivesStatus oActivesStatus = new Entities.ActivesStatus();
                Entities.Actives       oActivesState  = new Entities.Actives();
                oActivesState.code             = Convert.ToInt32(txtCode.Text.ToString());
                oActivesState.codeAlphaNumeric = txtcodeAlphaNumeric.Text;
                oActivesState.description      = txtDescription.Text;
                oClassRoom.code = Convert.ToInt32(cboClassroom.SelectedValue.ToString());
                oProgram.code   = Convert.ToInt32(cboprogram.SelectedValue.ToString());
                oActivesStatus.activesSatus_ID = Convert.ToInt32(cboStatus.SelectedValue.ToString());
                oActivesState.status           = oActivesStatus;
                oActivesState.oClassRoom       = oClassRoom;
                oActivesState.oProgram         = oProgram;

                if (ActivesBLL.getInstance().exists(oActivesState.code))
                {
                    records = ActivesBLL.getInstance().modify(oActivesState);
                }
                else
                {
                    if (ActivesBLL.getInstance().existsCodeAlphanumeric(txtcodeAlphaNumeric.Text))
                    {
                        lblMessagecodeAlphaNumeric.Text = "Este codigo ya se ha utilizado";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "removeHasErrorcodeAlphaNumeric", "$('#ContentPlaceHolder1_txtcodeAlphaNumeric').removeClass('has-error');", true);
                        return;
                    }
                    else
                    {
                        records = ActivesBLL.getInstance().insert(oActivesState);
                    }
                }
                blockControls();
                loadData();

                if (records > 0)
                {
                    lblMessage.Text = "Datos almacenados correctamente";
                }
            }
        }
Ejemplo n.º 2
0
        protected void gvActives_RowEditing(object sender, GridViewEditEventArgs e)
        {
            loadCombos();
            unlockControls();
            Int32 code = Convert.ToInt32(gvActives.Rows[e.NewEditIndex].Cells[0].Text);

            Entities.Actives oActivesStatus = ActivesBLL.getInstance().getActive(code);
            getClassRoom(oActivesStatus.oProgram.code);
            txtCode.Text                = oActivesStatus.code.ToString();
            txtcodeAlphaNumeric.Text    = oActivesStatus.codeAlphaNumeric;
            txtcodeAlphaNumeric.Enabled = false;
            txtDescription.Text         = oActivesStatus.description;
            cboprogram.SelectedValue    = oActivesStatus.oProgram.code.ToString();
            cboClassroom.SelectedValue  = oActivesStatus.oClassRoom.code.ToString();
            cboStatus.SelectedValue     = oActivesStatus.status.activesSatus_ID.ToString();
            ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true);
        }