Beispiel #1
0
        public int AddApp(XXF.Db.DbConn PubConn, Models.DbModels.app model)
        {
            if (string.IsNullOrEmpty(model.appid))
            {
                model.appid = XXF.Db.LibString.MakeRandomNumber(16).ToLower();
            }
            if (ExitAppid(PubConn, model.appid))
            {
                return -2;
            }
            if (string.IsNullOrEmpty(model.appsecret))
            {
                model.appsecret = Guid.NewGuid().ToString().Replace("-", "");
            }

            string sql = "insert into app(appid,appname,apptype,appgradeno,appsecret,appdesc,freeze) values(@appid,@appname,@apptype,@appgradeno,@appsecret,@appdesc,@freeze)";
            XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
            para.Add("@appid", model.appid);
            para.Add("@appsecret", model.appsecret);
            para.Add("@appname", model.appname);
            para.Add("@apptype", model.apptype);
            para.Add("@appgradeno", model.appgradeno);
            para.Add("@freeze", model.freeze);
            para.Add("@appdesc", model.appdesc ?? "");

            int r = PubConn.ExecuteSql(sql, para.ToParameters());
            return r;
        }
Beispiel #2
0
 public int DeletApp(XXF.Db.DbConn PubConn, string appid)
 {
     string sql = "delete from app where appid=@appid";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@appid", appid);
     int r = PubConn.ExecuteSql(sql, para.ToParameters());
     return r;
 }
Beispiel #3
0
 public int DeleteCategory(XXF.Db.DbConn PubConn, int apptype, int categoryid)
 {
     string countsql = "  select COUNT(*) from gradepermission where apptype=" + apptype + " and categoryid=" + categoryid + "";
     int c = (int)PubConn.ExecuteScalar(countsql, null);
     if (c != 0)
         return -2;
     string sql = "delete from appcategory where  apptype=@apptype and categoryid=@categoryid";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@apptype", apptype);
     para.Add("@categoryid", categoryid);
     int r = PubConn.ExecuteSql(sql, para.ToParameters());
     return r;
 }
Beispiel #4
0
 public int DeleteGrade(XXF.Db.DbConn PubConn, int apptype, int appgradeno)
 {
     string countsql = "  select COUNT(*) from api where apptype=" + apptype + " and appgradeno=" + appgradeno + "";
     int c = (int)PubConn.ExecuteScalar(countsql, null);
     if (c != 0)
         return -2;
     string sql = "delete from appgrade where  apptype=@apptype and appgradeno=@appgradeno";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@apptype", apptype);
     para.Add("@appgradeno", appgradeno);
     int r = PubConn.ExecuteSql(sql, para.ToParameters());
     return r;
 }
Beispiel #5
0
 public int Addcategory(XXF.Db.DbConn PubConn, Models.DbModels.appcategory model)
 {
     model.categorydesc = model.categorydesc ?? "";
     string getcatid = "select isnull(max(categoryid),0)+1 from appcategory where apptype=" + model.apptype;
     model.categoryid = Convert.ToInt32(PubConn.ExecuteScalar(getcatid, null));
     string addsql = "insert into appcategory(apptype,categoryid,categorytitle,categorydesc) values(@apptype,@categoryid,@categorytitle,@categorydesc)";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@apptype", model.apptype);
     para.Add("@categoryid", model.categoryid);
     para.Add("@categorytitle", model.categorytitle);
     para.Add("@categorydesc", model.categorydesc);
     int r = PubConn.ExecuteSql(addsql, para.ToParameters());
     return r;
 }
Beispiel #6
0
 public int AddGrade(XXF.Db.DbConn PubConn, Models.DbModels.appgrade model)
 {
     model.appgradedesc = model.appgradedesc ?? "";
     string getcatid = "select isnull(max(appgradeno),0)+1 from appgrade where apptype=" + model.apptype;
     model.appgradeno = Convert.ToInt32(PubConn.ExecuteScalar(getcatid, null));
     string addsql = "insert into appgrade(apptype,appgradeno,appgradename,appgradedesc) values(@apptype,@appgradeno,@appgradename,@appgradedesc)";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@apptype", model.apptype);
     para.Add("@appgradeno", model.appgradeno);
     para.Add("@appgradename", model.appgradename);
     para.Add("@appgradedesc", model.appgradedesc);
     int r = PubConn.ExecuteSql(addsql, para.ToParameters());
     return r;
 }
Beispiel #7
0
        public static void AddLog(XXF.Db.DbConn PubConn,DbModels.apilog log)
        {
            XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
            para.Add("@reqsource", log.reqsource);
            para.Add("@url", log.url);
            para.Add("@reqpara", log.reqpara);
            para.Add("@token", log.token);
            para.Add("@appid", log.appid);
            //    para.Add("@appname", log.appname);
            para.Add("@userid", log.userid);
            para.Add("@username", log.username);
            para.Add("@reqdate", log.reqdate);
            para.Add("@opecontent", log.opecontent);

            string sql = "INSERT INTO operationlog (reqsource  ,url  ,reqpara ,token ,appid ,appname,userid ,username ,reqdate ,opecontent)"+
                             "VALUES (@reqsource,@url, @reqpara,@token,@appid,@appname,@userid, @username,@reqdate,@opecontent)";
            PubConn.ExecuteSql(sql, para.ToParameters());
        }
Beispiel #8
0
        public int UpdateApp(XXF.Db.DbConn PubConn, Models.DbModels.app model)
        {
            string sql = "update app   set appname=@appname,appsecret=@appsecret,appdesc=@appdesc ,freeze=@freeze ,apptype = @apptype,appgradeno =@appgradeno where appid=@appid";
            XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
            para.Add("@appid", model.appid);
            para.Add("@appsecret", model.appsecret);
            para.Add("@appname", model.appname);
            para.Add("@apptype", model.apptype);
            para.Add("@appgradeno", model.appgradeno);
            para.Add("@freeze", model.freeze);
            para.Add("@appdesc", model.appdesc ?? "");

            int r = PubConn.ExecuteSql(sql, para.ToParameters());
            return r;
        }
Beispiel #9
0
 public int UpdateCategory(XXF.Db.DbConn PubConn, Models.DbModels.appcategory model)
 {
     model.categorydesc = model.categorydesc ?? "";
     string sql = "update  appcategory set categorytitle=@categorytitle,categorydesc=@categorydesc where  apptype=@apptype and categoryid=@categoryid";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@apptype", model.apptype);
     para.Add("@categoryid", model.categoryid);
     para.Add("@categorytitle", model.categorytitle);
     para.Add("@categorydesc", model.categorydesc);
     int r = PubConn.ExecuteSql(sql, para.ToParameters());
     return r;
 }
Beispiel #10
0
 public int UpdateGrade(XXF.Db.DbConn PubConn, Models.DbModels.appgrade model)
 {
     model.appgradedesc = model.appgradedesc ?? "";
     string sql = "update  appgrade set appgradename=@appgradename,appgradedesc=@appgradedesc where  apptype=@apptype and appgradeno=@appgradeno";
     XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
     para.Add("@apptype", model.apptype);
     para.Add("@appgradeno", model.appgradeno);
     para.Add("@appgradename", model.appgradename);
     para.Add("@appgradedesc", model.appgradedesc);
     int r = PubConn.ExecuteSql(sql, para.ToParameters());
     return r;
 }