コード例 #1
0
 private void StudentForm_Load(object sender, EventArgs e)
 {
     LoadDataIntoComboBoxes();
     if (this.IsUpdate)
     {
         DbSqlServer db       = new DbSqlServer(AppSettings.ConnectionString());
         DataTable   dtBranch = db.GetDataList("usp_StudentsGetAllStudentByStudentId", new DbParameter()
         {
             Parameter = "@StudentId", Value = this.StudentId
         });
         DataRow row = dtBranch.Rows[0];
         StudentIdTextBox.Text            = row["StudentId"].ToString();
         FullNameTextBox.Text             = row["FullName"].ToString();
         FatherNameTextBox.Text           = row["FatherName"].ToString();
         MotherNameTextBox.Text           = row["MotherName"].ToString();
         DOBDateTimePicker.Text           = row["DOB"].ToString();
         AddressTextBox.Text              = row["Address"].ToString();
         EmailTextBox.Text                = row["Email"].ToString();
         AdmissionDateDateTimePicker.Text = row["AdmissionDate"].ToString();
         MobileTextBox.Text               = row["Mobile"].ToString();
         BloodGroupTextBox.Text           = row["BloodGroup"].ToString();
         GenderComboBox.SelectedValue     = row["GenderId"];
         BranchComboBox.SelectedValue     = row["BranchId"];
         ImagepictureBox.Image            = (row["Photo"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["Photo"]);
     }
     else
     {
         GenerateStudentId();
     }
 }
コード例 #2
0
        private void ucitajPodatke()
        {
            DbSqlServer db        = new DbSqlServer(AppOpcije.konekcioniString());
            DataTable   dtRadnici = db.vratiPodatkeLista("vratiRadnikaNaOsnouvIdRadnika", new DbParametri
            {
                Parametar = "@IdRadnika", Vrijednost = this.radnikId
            });
            DataRow red = dtRadnici.Rows[0];

            txtRadnikID.Text = red["IdRadnika"].ToString();

            txtIme.Text            = red["Ime"].ToString();
            txtPrezime.Text        = red["Prezime"].ToString();
            dtpDatumRodjenja.Value = Convert.ToDateTime(red["Datum rođenja"]);

            txtKorIme.Text  = red["Korisničko ime"].ToString();
            txtSifra.Text   = red["Šifra"].ToString();
            txtTelefon.Text = red["Telefon"].ToString();

            txtAdresa.Text         = red["Adresa"].ToString();
            txtTrenutnaPlata.Text  = red["Trenutna plata"].ToString();
            txtPocetnaPlata.Text   = red["Početna plata"].ToString();
            cmbUloga.SelectedValue = red["IdUloge"];

            pcbSlika.Image = (red["Slika"] is DBNull) ? null : SlikaUpravljanje.staviSliku((byte[])red["Slika"]);

            if (pcbSlika.Image == null)
            {
                pcbSlika.BackgroundImage = POS.Properties.Resources.no_photo;
            }
        }
コード例 #3
0
        public static void LoadDataIntoComboBox(ComboBox cb, String storeProceName, DbParameter[] parameters)
        {
            DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());

            cb.DataSource    = db.GetDataList(storeProceName, parameters);
            cb.DisplayMember = "Description";
            cb.ValueMember   = "Id";
            cb.SelectedIndex = -1;
            cb.DropDownStyle = ComboBoxStyle.DropDownList;
        }
コード例 #4
0
        public static void LoadDataIntoGridView(DataGridView dgv, string storedProceName)
        {
            DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());

            dgv.DataSource = db.GetDataList(storedProceName);

            dgv.MultiSelect         = false;
            dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgv.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
        }
コード例 #5
0
        public static void LoadDataIntoComboBox(ComboBox cb, DbParameter parameter)
        {
            DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());

            cb.DataSource    = db.GetDataList("usp_ListTypeDataGetDataByListTypeId", parameter);
            cb.DisplayMember = "Description";
            cb.ValueMember   = "Id";
            cb.SelectedIndex = -1;
            cb.DropDownStyle = ComboBoxStyle.DropDownList;
        }
コード例 #6
0
        //ucitavanje podataka u combo box pri ucitavanju forme
        public static void ucitajPodatkeUcmb(ComboBox cmb, DbParametri parametar)
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            cmb.DataSource    = db.vratiPodatkeLista("vratiListeNaOsnovuId", parametar);
            cmb.DisplayMember = "Naziv";
            cmb.ValueMember   = "SifJM";

            cmb.SelectedIndex = -1;
            cmb.DropDownStyle = ComboBoxStyle.DropDownList;
        }
コード例 #7
0
        private void frmKontrolnaTabla_Load(object sender, EventArgs e)
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            DataTable dtArikli = db.vratiPodatkeLista("infoKorisnik", new DbParametri
            {
                Parametar  = "@KorIme",
                Vrijednost = frmPrijava.postaviIme
            });
            DataRow red = dtArikli.Rows[0];

            lblImeRadnika.Text = red["Ime"].ToString() + " " + red["Prezime"].ToString();
            imeRadnika         = red["Ime"].ToString();
            prezimeRadnika     = red["Prezime"].ToString();
        }
コード例 #8
0
        /// <summary>
        ///     构造数据库访问类
        /// </summary>
        public QfDbConnector(string binPath)
        {
            switch (DbType)
            {
            case "postgresql":
                _db = new DbPostgreSql(binPath);
                break;

            case "sqlserver":
                _db = new DbSqlServer(binPath);
                break;

            default:
                _db = new DbMySql(binPath);
                break;
            }
        }
コード例 #9
0
        private void EmployeeInfoForm_Load(object sender, EventArgs e)
        {
            LoadDataIntoComboBoxes();
            if (this.IsUpdate)
            {
                DbSqlServer db       = new DbSqlServer(AppSettings.ConnectionString());
                DataTable   dtBranch = db.GetDataList("usp_EmployeesGetAllEmployeesByEmployeeId", new DbParameter()
                {
                    Parameter = "@EmployeeId", Value = this.EmployeeId
                });
                DataRow row = dtBranch.Rows[0];

                EmployeeIdTextBox.Text            = row["EmployeeId"].ToString();
                FullNameTextBox.Text              = row["FullName"].ToString();
                DOBdateTimePicker.Text            = row["DateOfBirth"].ToString();
                NICTextBox.Text                   = row["NICNumber"].ToString();
                EmailAddressTextBox.Text          = row["EmailAddress"].ToString();
                MobileTextBox.Text                = row["Mobile"].ToString();
                TelephoneTextBox.Text             = row["Telephone"].ToString();
                GenderComboBox.SelectedValue      = row["GenderId"];
                EmploymentDatedateTimePicker.Text = row["EmploymentDate"].ToString();



                BranchComboBox.SelectedValue     = row["BranchId"];
                EmployeePictureBox.Image         = (row["Photo"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["Photo"]);
                AddressLineTextBox.Text          = row["AddressLine"].ToString();
                CityComboBox.SelectedValue       = row["CityId"];
                DistrictComboBox.SelectedValue   = row["DistrictId"];
                PostCodeTextBox.Text             = row["PostCode"].ToString();
                JobTitleComboBox.SelectedValue   = row["JObTitleId"];
                CurrentSalaryTextBox1.Text       = row["CurrentSalary"].ToString();
                StartingSalaryTextBox.Text       = row["StartingSalary"].ToString();
                HasLeftComboBox.SelectedValue    = row["HasLeft"];
                DateLeftDateTimePicker.Text      = row["DateLeft"].ToString();
                ReasonLeftComboBox.SelectedValue = row["ReasonLeftId"];



                CommentsTextBox.Text = row["Comments"].ToString();
            }
            else
            {
                GenerateEmployeeId();
            }
        }
コード例 #10
0
 private void SignInButton_Click(object sender, EventArgs e)
 {
     if (IsFormValidate())
     {
         DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());
         bool        isLoginDetailsCorrect = Convert.ToBoolean(db.GetScalerValue("usp_UsersCheckLoginDetails", GetParameters()));
         if (isLoginDetailsCorrect)
         {
             GetLoggedInUserSetting();
             this.Hide();
             DashboardForm dashboardForm = new DashboardForm();
             dashboardForm.Show();
         }
         else
         {
             MessageBox.Show("User Name/Password is not correct", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
コード例 #11
0
        private void LoadDataAndBindToControlIfUpdate()
        {
            if (this.IsUpdate)
            {
                DbSqlServer db       = new DbSqlServer(AppSettings.ConnectionString());
                DataTable   dtBranch = db.GetDataList("usp_BranchesGetBranchDetailsByBranchId", new DbParameter()
                {
                    Parameter = "@BranchId", Value = this.BranchId
                });
                DataRow row = dtBranch.Rows[0];

                BranchNametextBox.Text             = row["BranchName"].ToString();
                EmailAddressTextBox.Text           = row["Email"].ToString();
                TelephoneTextBox.Text              = row["Telephone"].ToString();
                WebsiteTextBox.Text                = row["Website"].ToString();
                AddressLineTextBox.Text            = row["AddressLine"].ToString();
                LogoPictureBox.Image               = (row["BranchImage"] is DBNull)? null:ImageManipulation.PutPhoto((byte[])row["BranchImage"]);
                CityNameComboBox.SelectedValue     = row["CityId"];
                DistrictNameComboBox.SelectedValue = row["DistrictId"];
                PostCodeTextBox.Text               = row["PostCode"].ToString();
            }
        }
コード例 #12
0
ファイル: frmArtikliInfo.cs プロジェクト: peross/POS
        //ucitavanje podataka iz dgv-a u formu nakon dvostrukog klika
        private void ucitajPodatake()
        {
            if (this.JeAzuriran)
            {
                DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

                DataTable dtArikli = db.vratiPodatkeLista("vratiDetaljeArtiklaNaOsnovuIdProizvoda", new DbParametri
                {
                    Parametar  = "@IdProizvoda",
                    Vrijednost = this.artiklID
                });
                DataRow red = dtArikli.Rows[0];
                txtIdProizvoda.Text         = red["IdProizvoda"].ToString();
                txtNazivArtikla.Text        = red["Naziv"].ToString();
                txtCijena.Text              = red["Cijena"].ToString();
                txtOpis.Text                = red["Opis"].ToString();
                cmbJedMjere.SelectedValue   = red["SifJM"];
                cmbKategorije.SelectedValue = red["IdKategorije"];

                pcbLogo.Image = (red["Slika"] is DBNull) ? null : SlikaUpravljanje.staviSliku((byte[])red["Slika"]);
            }
        }
コード例 #13
0
        private void btnPrijava_Click(object sender, EventArgs e)
        {
            postaviIme   = txtKorIme.Text;
            postaviSifru = txtSifra.Text;
            if (formaValidna())
            {
                DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

                bool detaljiPrijaveTacni = Convert.ToBoolean(db.vratiSkalarnuVrijednost("provjeraPrijave",
                                                                                        vratiParametre()));
                if (detaljiPrijaveTacni)
                {
                    this.Hide();
                    frmKontrolnaTabla forma = new frmKontrolnaTabla();
                    forma.Show();
                }
                else
                {
                    MessageBox.Show("Netačno korisničko ime ili šifra.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #14
0
        private void generisiNoviId()
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            txtRadnikID.Text = db.vratiSkalarnuVrijednost("radniciGenerisiNoviId").ToString();
        }
コード例 #15
0
        //ucitavanje podataka u dgv pri ucitavanju forme
        public static void ucitajPodatkeUdgv(DataGridView dgv, string storedProceIme)
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            dgv.DataSource = db.vratiPodatkeLista(storedProceIme);
        }
コード例 #16
0
ファイル: frmArtikliInfo.cs プロジェクト: peross/POS
        private void generisiNoviId()
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            txtIdProizvoda.Text = db.vratiSkalarnuVrijednost("proizvodiGenerisiNoviId").ToString();
        }
コード例 #17
0
        private void SaveOrUpdateRecord(string storeProceName)
        {
            DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());

            db.SaveOrUpdatRecord(storeProceName, GetObject());
        }
コード例 #18
0
        private void GenerateEmployeeId()
        {
            DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());

            EmployeeIdTextBox.Text = db.GetScalerValue("usp_EmployeesGenerateNewEmployeeId").ToString();
        }
コード例 #19
0
ファイル: DbFactory.cs プロジェクト: Wolfgang-HBIC/HLUTool
        public static DbBase CreateConnection()
        {
            if (Enum.IsDefined(typeof(ConnectionTypes), Settings.Default.DbConnectionType))
            {
                _connType = (ConnectionTypes)Settings.Default.DbConnectionType;
            }
            else
            {
                _connType = ConnectionTypes.Unknown;
            }

            string connString    = Settings.Default.DbConnectionString;
            string defaultSchema = Settings.Default.DbDefaultSchema;
            bool   promptPwd     = Settings.Default.DbPromptPwd;

            if ((_connType == ConnectionTypes.Unknown) || String.IsNullOrEmpty(connString) ||
                ((DbBase.GetBackend(connString, _connType) != Backends.Access) && String.IsNullOrEmpty(defaultSchema)))
            {
                promptPwd = false;
                SelectConnectionType();
            }

            if (_connType == ConnectionTypes.Unknown)
            {
                return(null);
            }

            DbBase db = null;

            switch (_connType)
            {
            case ConnectionTypes.ODBC:
                db = new DbOdbc(ref connString, ref defaultSchema, ref promptPwd,
                                Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                                true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone,
                                Settings.Default.DbTextLength, Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                                Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                break;

            case ConnectionTypes.OleDb:
                db = new DbOleDb(ref connString, ref defaultSchema, ref promptPwd,
                                 Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                                 true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                                 Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                                 Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                break;

            case ConnectionTypes.Oracle:
                db = new DbOracle(ref connString, ref defaultSchema, ref promptPwd,
                                  Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                                  true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                                  Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                                  Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                break;

            case ConnectionTypes.PostgreSQL:
                db = new DbPgSql(ref connString, ref defaultSchema, ref promptPwd,
                                 Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                                 true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                                 Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                                 Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                break;

            case ConnectionTypes.SQLServer:
                db = new DbSqlServer(ref connString, ref defaultSchema, ref promptPwd,
                                     Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                                     true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                                     Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                                     Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                break;
            }

            if (db != null)
            {
                Settings.Default.DbConnectionType   = (int)_connType;
                Settings.Default.DbConnectionString = connString;
                Settings.Default.DbDefaultSchema    = defaultSchema;
                Settings.Default.DbPromptPwd        = promptPwd;
                Settings.Default.Save();
            }

            return(db);
        }
コード例 #20
0
ファイル: frmKasa.cs プロジェクト: peross/POS
        private void dodavanjeUkorpu(string storedProceIme)
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            db.snimiIliAzurirajZapis(storedProceIme, vratiObjekt());
        }
コード例 #21
0
ファイル: frmKasa.cs プロジェクト: peross/POS
        private void generisiNoviId()
        {
            DbSqlServer db = new DbSqlServer(AppOpcije.konekcioniString());

            txtIdNarudzbe.Text = db.vratiSkalarnuVrijednost("korpaGenerisiNoviId").ToString();
        }
コード例 #22
0
ファイル: DbFactory.cs プロジェクト: Wolfgang-HBIC/HLUTool
        public static DbBase CreateConnection()
        {
            if (Enum.IsDefined(typeof(ConnectionTypes), Settings.Default.DbConnectionType))
                _connType = (ConnectionTypes)Settings.Default.DbConnectionType;
            else
                _connType = ConnectionTypes.Unknown;

            string connString = Settings.Default.DbConnectionString;
            string defaultSchema = Settings.Default.DbDefaultSchema;
            bool promptPwd = Settings.Default.DbPromptPwd;

            if ((_connType == ConnectionTypes.Unknown) || String.IsNullOrEmpty(connString) ||
                ((DbBase.GetBackend(connString, _connType) != Backends.Access) && String.IsNullOrEmpty(defaultSchema)))
            {
                promptPwd = false;
                SelectConnectionType();
            }

            if (_connType == ConnectionTypes.Unknown) return null;

            DbBase db = null;

            switch (_connType)
            {
                case ConnectionTypes.ODBC:
                    db = new DbOdbc(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone,
                        Settings.Default.DbTextLength, Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.OleDb:
                    db = new DbOleDb(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.Oracle:
                    db = new DbOracle(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.PostgreSQL:
                    db = new DbPgSql(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.SQLServer:
                    db = new DbSqlServer(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
            }

            if (db != null)
            {
                Settings.Default.DbConnectionType = (int)_connType;
                Settings.Default.DbConnectionString = connString;
                Settings.Default.DbDefaultSchema = defaultSchema;
                Settings.Default.DbPromptPwd = promptPwd;
                Settings.Default.Save();
            }

            return db;
        }
コード例 #23
0
        private void GenerateStudentId()
        {
            DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString());

            StudentIdTextBox.Text = db.GetScalerValue("usp_StudentsGenerateNewStudentId").ToString();
        }