Example #1
0
        private void FxSave()
        {
            string lName     = TxtName.Text.Trim();
            string lUserName = TxtUserName.Text.Trim();

            bool lEnabled = ChkEnabled.Checked;

            if (lName.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese nombre");

                TxtName.Text = "";

                TxtName.Focus();

                return;
            }

            if (lUserName.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese usuario");

                TxtUserName.Text = "";

                TxtUserName.Focus();

                return;
            }

            if (ClsFunctions.FxMessage(2, "¿Está seguro de guardar los cambios?") == true)
            {
                long lUserId_new;

                if (lUserId == 0)
                {
                    lUserId_new = ClsSqlAdministrator.Fx_ins_tblUser(lName, lUserName);
                }
                else
                {
                    lUserId_new = ClsSqlAdministrator.Fx_upt_tblUser(lUserId, lName, lUserName, lEnabled);
                }

                if (lUserId_new > 0)
                {
                    FxExit();
                }
            }
        }