Beispiel #1
0
        private void FxData()
        {
            ObjDt = null;

            GrdData.DataSource = null;

            GrdData.Enabled = false;

            CmdEdit.Enabled  = false;
            CmdReset.Enabled = false;

            ObjDt = ClsSqlAdministrator.Fx_sel_tblUser(false);

            if (ObjDt != null)
            {
                if (ObjDt.Rows.Count > 0)
                {
                    GrdData.DataSource = ObjDt.DefaultView;

                    GrdData.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                    GrdData.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True;

                    GrdData.Columns[4].Visible = false;

                    CmdEdit.Enabled  = true;
                    CmdReset.Enabled = true;

                    GrdData.Focus();
                }
            }
        }
Beispiel #2
0
        private void FxData()
        {
            ObjDt = null;

            GrdData.DataSource = null;

            GrdData.Enabled = false;

            CmdEdit.Enabled = false;


            ObjDt = ClsSqlAdministrator.Fx_sel_tblProfile(false);

            if (ObjDt != null)
            {
                if (ObjDt.Rows.Count > 0)
                {
                    GrdData.DataSource = ObjDt.DefaultView;

                    GrdData.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                    GrdData.Columns[2].Visible = false;

                    GrdData.Enabled = true;

                    GrdData.Enabled = true;

                    CmdEdit.Enabled = true;


                    GrdData.Focus();
                }
            }
        }
        private void FxCancel()
        {
            TxtName.Text = "";


            ChkEnabled.Checked = false;

            TxtName.Enabled = false;


            ChkEnabled.Enabled = false;

            CmdSave.Enabled = false;

            if (lProfileId == 0)
            {
                Text += " - Adicionar";

                TxtName.Enabled = true;


                ChkEnabled.Checked = true;

                CmdSave.Enabled = true;

                TxtName.Focus();
            }
            else
            {
                Text += " - Modificar";

                DataTable ObjDt = ClsSqlAdministrator.Fx_sel_tblProfile_detail(lProfileId);

                if (ObjDt != null)
                {
                    if (ObjDt.Rows.Count > 0)
                    {
                        TxtName.Text = ObjDt.Rows[0][0].ToString();


                        ChkEnabled.Checked = ClsFunctions.FxConvertStringToBool(ObjDt.Rows[0][1].ToString());

                        TxtName.Enabled = true;


                        ChkEnabled.Enabled = true;

                        CmdSave.Enabled = true;

                        TxtName.Focus();
                    }
                }
            }
        }
        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();
                }
            }
        }
Beispiel #5
0
        private void FxReset()
        {
            long lUserId;

            try
            {
                lUserId = long.Parse(GrdData.SelectedRows[0].Cells[4].Value.ToString());
            }
            catch
            {
                lUserId = 0;
            }

            if (lUserId == 0)
            {
                ClsFunctions.FxMessage(1, "Seleccione usuario");

                GrdData.Focus();

                return;
            }

            if (ClsFunctions.FxMessage(2, "¿Está seguro de restablecer la constraseña?") == true)
            {
                long lUserId_new = ClsSqlAdministrator.Fx_upt_tblUser_resetPassword(lUserId);

                if (lUserId_new == 0)
                {
                    ClsFunctions.FxMessage(1, "Contraseña no fue restablecida. Intente de nuevo");
                }
                else
                {
                    ClsFunctions.FxMessage("Contraseña fue restablecida satisfactoriamente");

                    FxCancel();
                }
            }
        }
        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();
                }
            }
        }
Beispiel #7
0
        private void FxCancel()
        {
            ImgLogo.Image = null;

            lFileLogo = "";

            TxtName.Text        = "";
            TxtDescription.Text = "";
            TxtExecutable.Text  = "";

            ChkEnabled.Checked = false;

            TxtName.Enabled        = false;
            TxtDescription.Enabled = false;
            TxtExecutable.Enabled  = false;

            ChkEnabled.Enabled = false;

            CmdLogo.Enabled = true;
            CmdSave.Enabled = false;

            if (lModuleId == 0)
            {
                Text += " - Adicionar";

                TxtName.Enabled        = true;
                TxtDescription.Enabled = true;
                TxtExecutable.Enabled  = true;

                ChkEnabled.Checked = true;

                CmdSave.Enabled = true;

                TxtName.Focus();
            }
            else
            {
                Text += " - Modificar";

                DataTable ObjDt = ClsSqlAdministrator.Fx_sel_tblModule_detail(lModuleId);

                if (ObjDt != null)
                {
                    if (ObjDt.Rows.Count > 0)
                    {
                        TxtName.Text        = ObjDt.Rows[0][0].ToString();
                        TxtDescription.Text = ObjDt.Rows[0][1].ToString();
                        TxtExecutable.Text  = ObjDt.Rows[0][2].ToString();

                        ChkEnabled.Checked = ClsFunctions.FxConvertStringToBool(ObjDt.Rows[0][3].ToString());

                        Bitmap ObjLogo;

                        try
                        {
                            ObjLogo = ClsSqlAdministrator.Fx_sel_tblModuleLogo(lModuleId);
                        }
                        catch
                        {
                            ObjLogo = null;
                        }

                        if (ObjLogo != null)
                        {
                            lFileLogo = ClsVariables.gPathTemp + "Img" + ClsFunctions.FxRandomNumber().ToString() + ".png";

                            if (File.Exists(lFileLogo))
                            {
                                ClsFunctions.FxDeleteFile(lFileLogo);
                            }

                            ObjLogo.Save(lFileLogo);

                            ObjLogo.Dispose();

                            ImgLogo.Image = Bitmap.FromFile(lFileLogo);
                        }

                        TxtName.Enabled        = true;
                        TxtDescription.Enabled = true;
                        TxtExecutable.Enabled  = true;

                        ChkEnabled.Enabled = true;

                        CmdSave.Enabled = true;

                        TxtName.Focus();
                    }
                }
            }
        }
Beispiel #8
0
        private void FxSave()
        {
            string lName        = TxtName.Text.Trim();
            string lDescription = TxtDescription.Text.Trim();
            string lExecutable  = TxtExecutable.Text.Trim();

            bool lEnabled = ChkEnabled.Checked;

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

                TxtName.Text = "";

                TxtName.Focus();

                return;
            }

            if (lDescription.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese descripción");

                TxtDescription.Text = "";

                TxtDescription.Focus();

                return;
            }

            if (lExecutable.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese ejecutable");

                TxtExecutable.Text = "";

                TxtExecutable.Focus();

                return;
            }

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

                if (lModuleId == 0)
                {
                    lModuleId_new = ClsSqlAdministrator.Fx_ins_tblModule(lName, lDescription, lExecutable);
                }
                else
                {
                    lModuleId_new = ClsSqlAdministrator.Fx_upt_tblModule(lModuleId, lName, lDescription, lExecutable, lEnabled);
                }

                if (lModuleId_new > 0)
                {
                    if (lFileLogo.Length > 0)
                    {
                        lModuleId_new = ClsSqlAdministrator.Fx_ins_tblModuleLogo(lModuleId_new, lFileLogo);
                    }

                    ClsFunctions.FxMessage("Proceso concluido");

                    FxExit();
                }
            }
        }