Ejemplo n.º 1
0
        private void FxSave()
        {
            string lName      = TxtName.Text.Trim();
            string lTradeName = TxtTradeName.Text.Trim();
            string lShortName = TxtShortName.Text.Trim();
            string lDBName    = TxtDBName.Text.Trim();

            bool lEnabled = ChkEnabled.Checked;

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

                TxtName.Text = "";

                TxtName.Focus();

                return;
            }

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

                TxtTradeName.Text = "";

                TxtTradeName.Focus();

                return;
            }

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

                TxtShortName.Text = "";

                TxtShortName.Focus();

                return;
            }

            if (lDBName.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese Base de datos");

                TxtDBName.Text = "";

                TxtDBName.Focus();

                return;
            }

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

                if (lCompanyId == 0)
                {
                    lCompanyId_new = ClsSqlAdministrator.Fx_ins_tblCompany(lName, lTradeName, lShortName, lDBName);
                }
                else
                {
                    lCompanyId_new = ClsSqlAdministrator.Fx_upt_tblCompany(lCompanyId, lName, lTradeName, lShortName, lDBName, lEnabled);
                }

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