Ejemplo n.º 1
0
        public static bool ShowHide(People p)
        {
            string Sql = "Userid=" + GLOBALVARS.MyUser.ID + " AND ALLOWID=" + p.ID;

            if (DBFunction.CheckExist(Sql, "LimitedAllow"))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        private void Add()
        {
            int level = 0;

            if (DBFunction.CheckExist(txtusername.Text, "USERS", "username"))
            {
                MessageBox.Show("המשתמש קיים כבר במערכת", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                level = txttype.SelectedIndex;
            }
            string sector = SetSector();

            SqlParameter[] prms = new SqlParameter[10];
            string         pass = User.SetPassword(txtpassword.Text);
            string         sql  = "insert into users(username,password,control,email,dateadded,name,tel,TempPersonal,TempGeneral,Sector) values(" +
                                  BuildSql.InsertSql(out prms[0], txtusername.Text) +
                                  BuildSql.InsertSql(out prms[1], pass) +
                                  BuildSql.InsertSql(out prms[2], level) +
                                  BuildSql.InsertSql(out prms[3], txtmail.Text) +
                                  BuildSql.InsertSql(out prms[4], DateTime.Now) +
                                  BuildSql.InsertSql(out prms[5], txtname.Text) +
                                  BuildSql.InsertSql(out prms[6], txttel.Text) +
                                  BuildSql.InsertSql(out prms[7], txtTempPersonal.SelectedIndex) +
                                  BuildSql.InsertSql(out prms[8], txtTempGeneral.SelectedIndex) +
                                  BuildSql.InsertSql(out prms[9], sector, true) +
                                  ");";

            if (DBFunction.Execute(sql, prms))
            {
                MessageBox.Show("נוסף בהצלחה", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("אירעה שגיאה", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }