Exemple #1
0
        public bool update(Model.UserToRoleModel.usertorole usertorolemodel)
        {
            string sql       = string.Format("role_id='{0}'", usertorolemodel.role);
            string contion   = string.Format("user_id='{0}'", usertorolemodel.user);
            string tablename = typeof(QDDL.Model.UserToRoleModel.usertorole).Name;

            return(ServerHelp.updateByWhere(tablename, _webip, contion, sql));
        }
 public bool update(Model.UserToRoleModel.usertorole usertorolemodel)
 {
     try
     {
         string strsql    = string.Format(" role_id='{0}'", usertorolemodel.role);
         string contation = string.Format("where user_id='{0}'", usertorolemodel.user);
         string sql       = "update usertorole set " + strsql + contation;
         var    ds        = SqliteHelper.ExecuteNonQuery(con, sql, CommandType.Text);
         if (Convert.ToInt32(ds) > 0)
         {
             return(true);
         }
         return(false);
     }
     catch { return(false); }
 }
        public bool add(Model.UserToRoleModel.usertorole usertorolemodel)
        {
            try
            {
                string  sqldep = string.Format("select * from users where id='{0}'", usertorolemodel.user);
                DataSet dps    = SqliteHelper.ExecuteDataSet(con, sqldep, CommandType.Text);
                if (dps != null && dps.Tables.Count > 0)
                {
                    users dep = DataTableToList.GetList <users>(dps.Tables[0]).FirstOrDefault();
                    if (dep != null)
                    {
                        usertorolemodel.user = dep.guid;
                    }
                }
                string sqlduty = string.Format("select * from role where id='{0}'", usertorolemodel.role);
                dps = SqliteHelper.ExecuteDataSet(con, sqlduty, CommandType.Text);
                if (dps != null && dps.Tables.Count > 0)
                {
                    role dep = DataTableToList.GetList <role>(dps.Tables[0]).FirstOrDefault();
                    if (dep != null)
                    {
                        usertorolemodel.role = dep.guid;
                    }
                }
                string sql =
                    string.Format
                    (
                        "INSERT INTO usertorole(user_id,role_id) VALUES('{0}','{1}') ;select last_insert_rowid()",
                        usertorolemodel.user, usertorolemodel.role
                    );

                var ds = SqliteHelper.ExecuteScalar(con, sql, CommandType.Text);
                if (Convert.ToInt32(ds) > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                // MessageAlert.Alert(ex.ToString());
                return(false);
            }
        }
Exemple #4
0
        public bool delete(Model.UserToRoleModel.usertorole usertorolemodel)
        {
            string contion = string.Format("id='{0}'", usertorolemodel.id);

            return(ServerHelp.deleteDataByWhere <Model.UserToRoleModel.usertorole>(_webip, contion));
        }
Exemple #5
0
 public bool add(Model.UserToRoleModel.usertorole usertorolemodel)
 {
     return(ServerHelp.addSingleInfoNotReturnID <QDDL.Model.UserToRoleModel.usertorole>(usertorolemodel, _webip));
 }