コード例 #1
0
        private bool DoAdd()
        {
            bool result = false;

            Model.user_oauth_app model = new Model.user_oauth_app();
            BLL.user_oauth_app   bll   = new BLL.user_oauth_app();

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.is_mobile = Utils.StrToInt(rblIsMobile.SelectedValue, 0);
            model.sort_id   = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.api_path  = txtApiPath.Text.Trim();
            model.app_id    = txtAppId.Text.Trim();
            model.app_key   = txtAppKey.Text.Trim();
            model.img_url   = txtImgUrl.Text.Trim();
            model.remark    = txtRemark.Text;
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加OAuth信息:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #2
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.user_oauth_app   bll   = new BLL.user_oauth_app();
            Model.user_oauth_app model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            model.api_path = txtApiPath.Text.Trim();
            model.app_id   = txtAppId.Text.Trim();
            model.app_key  = txtAppKey.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            model.remark   = txtRemark.Text;
            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改OAuth信息:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
コード例 #3
0
        private bool DoAdd()
        {
            bool result = false;
            Model.user_oauth_app model = new Model.user_oauth_app();
            BLL.user_oauth_app bll = new BLL.user_oauth_app();

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.is_mobile = Utils.StrToInt(rblIsMobile.SelectedValue, 0);
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.api_path = txtApiPath.Text.Trim();
            model.app_id = txtAppId.Text.Trim();
            model.app_key = txtAppKey.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.remark = txtRemark.Text;
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加OAuth信息:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.user_oauth_app GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 id,title,img_url,app_id,app_key,remark,sort_id,is_lock,api_path from " + databaseprefix + "user_oauth_app ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.user_oauth_app model = new Model.user_oauth_app();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "")
                {
                    model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["app_id"] != null && ds.Tables[0].Rows[0]["app_id"].ToString() != "")
                {
                    model.app_id = ds.Tables[0].Rows[0]["app_id"].ToString();
                }
                if (ds.Tables[0].Rows[0]["app_key"] != null && ds.Tables[0].Rows[0]["app_key"].ToString() != "")
                {
                    model.app_key = ds.Tables[0].Rows[0]["app_key"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["api_path"] != null && ds.Tables[0].Rows[0]["api_path"].ToString() != "")
                {
                    model.api_path = ds.Tables[0].Rows[0]["api_path"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        private bool DoAdd()
        {
            bool result = false;

            Model.user_oauth_app model = new Model.user_oauth_app();
            BLL.user_oauth_app   bll   = new BLL.user_oauth_app();

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            model.api_path = txtApiPath.Text.Trim();
            model.app_id   = txtAppId.Text.Trim();
            model.app_key  = txtAppKey.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            model.remark   = txtRemark.Text;
            if (bll.Add(model) > 0)
            {
                AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Add.ToString(), "添加OAuth信息:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.user_oauth_app model)
        {
            int newId;

            using (OleDbConnection conn = new OleDbConnection(DbHelperOleDb.connectionString))
            {
                conn.Open();
                using (OleDbTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into " + databaseprefix + "user_oauth_app(");
                        strSql.Append("title,img_url,app_id,app_key,[remark],sort_id,is_mobile,is_lock,api_path)");
                        strSql.Append(" values (");
                        strSql.Append("@title,@img_url,@app_id,@app_key,@remark,@sort_id,@is_mobile,@is_lock,@api_path)");
                        OleDbParameter[] parameters =
                        {
                            new OleDbParameter("@title",     OleDbType.VarChar, 100),
                            new OleDbParameter("@img_url",   OleDbType.VarChar, 255),
                            new OleDbParameter("@app_id",    OleDbType.VarChar, 100),
                            new OleDbParameter("@app_key",   OleDbType.VarChar, 500),
                            new OleDbParameter("@remark",    OleDbType.VarChar, 500),
                            new OleDbParameter("@sort_id",   OleDbType.Integer,   4),
                            new OleDbParameter("@is_mobile", OleDbType.Integer,   4),
                            new OleDbParameter("@is_lock",   OleDbType.Integer,   4),
                            new OleDbParameter("@api_path",  OleDbType.VarChar, 255)
                        };
                        parameters[0].Value = model.title;
                        parameters[1].Value = model.img_url;
                        parameters[2].Value = model.app_id;
                        parameters[3].Value = model.app_key;
                        parameters[4].Value = model.remark;
                        parameters[5].Value = model.sort_id;
                        parameters[6].Value = model.is_mobile;
                        parameters[7].Value = model.is_lock;
                        parameters[8].Value = model.api_path;
                        DbHelperOleDb.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                        //取得新插入的ID
                        newId = GetMaxId(conn, trans);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(-1);
                    }
                }
            }
            return(newId);
        }
コード例 #7
0
ファイル: user_oauth_app.cs プロジェクト: xuxiaolei/DTCMS
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.user_oauth_app model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "user_oauth_app set ");
            strSql.Append("title=@title,");
            strSql.Append("img_url=@img_url,");
            strSql.Append("app_id=@app_id,");
            strSql.Append("app_key=@app_key,");
            strSql.Append("remark=@remark,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("is_mobile=@is_mobile,");
            strSql.Append("is_lock=@is_lock,");
            strSql.Append("api_path=@api_path");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",     SqlDbType.NVarChar, 100),
                new SqlParameter("@img_url",   SqlDbType.NVarChar, 255),
                new SqlParameter("@app_id",    SqlDbType.NVarChar, 100),
                new SqlParameter("@app_key",   SqlDbType.NVarChar, 500),
                new SqlParameter("@remark",    SqlDbType.NVarChar, 500),
                new SqlParameter("@sort_id",   SqlDbType.Int,        4),
                new SqlParameter("@is_mobile", SqlDbType.TinyInt,    1),
                new SqlParameter("@is_lock",   SqlDbType.TinyInt,    1),
                new SqlParameter("@api_path",  SqlDbType.NVarChar, 255),
                new SqlParameter("@id",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.title;
            parameters[1].Value = model.img_url;
            parameters[2].Value = model.app_id;
            parameters[3].Value = model.app_key;
            parameters[4].Value = model.remark;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.is_mobile;
            parameters[7].Value = model.is_lock;
            parameters[8].Value = model.api_path;
            parameters[9].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
ファイル: user_oauth_app.cs プロジェクト: uwitec/MWMS
 /// <summary>
 /// ������ת��Ϊʵ��
 /// </summary>
 public Model.user_oauth_app DataRowToModel(DataRow row)
 {
     Model.user_oauth_app model = new Model.user_oauth_app();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["title"] != null)
         {
             model.title = row["title"].ToString();
         }
         if (row["img_url"] != null)
         {
             model.img_url = row["img_url"].ToString();
         }
         if (row["app_id"] != null)
         {
             model.app_id = row["app_id"].ToString();
         }
         if (row["app_key"] != null)
         {
             model.app_key = row["app_key"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["is_mobile"] != null && row["is_mobile"].ToString() != "")
         {
             model.is_mobile = int.Parse(row["is_mobile"].ToString());
         }
         if (row["is_lock"] != null && row["is_lock"].ToString() != "")
         {
             model.is_lock = int.Parse(row["is_lock"].ToString());
         }
         if (row["api_path"] != null)
         {
             model.api_path = row["api_path"].ToString();
         }
     }
     return model;
 }
コード例 #9
0
ファイル: user_oauth_app.cs プロジェクト: xuxiaolei/DTCMS
 /// <summary>
 /// 将对象转换为实体
 /// </summary>
 public Model.user_oauth_app DataRowToModel(DataRow row)
 {
     Model.user_oauth_app model = new Model.user_oauth_app();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["title"] != null)
         {
             model.title = row["title"].ToString();
         }
         if (row["img_url"] != null)
         {
             model.img_url = row["img_url"].ToString();
         }
         if (row["app_id"] != null)
         {
             model.app_id = row["app_id"].ToString();
         }
         if (row["app_key"] != null)
         {
             model.app_key = row["app_key"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["is_mobile"] != null && row["is_mobile"].ToString() != "")
         {
             model.is_mobile = int.Parse(row["is_mobile"].ToString());
         }
         if (row["is_lock"] != null && row["is_lock"].ToString() != "")
         {
             model.is_lock = int.Parse(row["is_lock"].ToString());
         }
         if (row["api_path"] != null)
         {
             model.api_path = row["api_path"].ToString();
         }
     }
     return(model);
 }
コード例 #10
0
ファイル: user_oauth_app.cs プロジェクト: xuxiaolei/DTCMS
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.user_oauth_app model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "user_oauth_app(");
            strSql.Append("title,img_url,app_id,app_key,remark,sort_id,is_mobile,is_lock,api_path)");
            strSql.Append(" values (");
            strSql.Append("@title,@img_url,@app_id,@app_key,@remark,@sort_id,@is_mobile,@is_lock,@api_path)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",     SqlDbType.NVarChar, 100),
                new SqlParameter("@img_url",   SqlDbType.NVarChar, 255),
                new SqlParameter("@app_id",    SqlDbType.NVarChar, 100),
                new SqlParameter("@app_key",   SqlDbType.NVarChar, 500),
                new SqlParameter("@remark",    SqlDbType.NVarChar, 500),
                new SqlParameter("@sort_id",   SqlDbType.Int,        4),
                new SqlParameter("@is_mobile", SqlDbType.TinyInt,    1),
                new SqlParameter("@is_lock",   SqlDbType.TinyInt,    1),
                new SqlParameter("@api_path",  SqlDbType.NVarChar, 255)
            };
            parameters[0].Value = model.title;
            parameters[1].Value = model.img_url;
            parameters[2].Value = model.app_id;
            parameters[3].Value = model.app_key;
            parameters[4].Value = model.remark;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.is_mobile;
            parameters[7].Value = model.is_lock;
            parameters[8].Value = model.api_path;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #11
0
 private void ShowInfo(int _id)
 {
     BLL.user_oauth_app   bll   = new BLL.user_oauth_app();
     Model.user_oauth_app model = bll.GetModel(_id);
     txtTitle.Text = model.title;
     if (model.is_lock == 0)
     {
         cbIsLock.Checked = true;
     }
     else
     {
         cbIsLock.Checked = false;
     }
     txtSortId.Text  = model.sort_id.ToString();
     txtApiPath.Text = model.api_path;
     txtAppId.Text   = model.app_id;
     txtAppKey.Text  = model.app_key;
     txtImgUrl.Text  = model.img_url;
     txtRemark.Text  = model.remark;
 }
コード例 #12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.user_oauth_app model)
 {
     return(dal.Update(model));
 }
コード例 #13
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.user_oauth_app model)
 {
     return(dal.Add(model));
 }
コード例 #14
0
ファイル: user_oauth_app.cs プロジェクト: yi724926089/MyWx
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.user_oauth_app GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1 id,title,img_url,app_id,app_key,remark,sort_id,is_lock,api_path from " + databaseprefix + "user_oauth_app ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.user_oauth_app model = new Model.user_oauth_app();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "")
                {
                    model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["app_id"] != null && ds.Tables[0].Rows[0]["app_id"].ToString() != "")
                {
                    model.app_id = ds.Tables[0].Rows[0]["app_id"].ToString();
                }
                if (ds.Tables[0].Rows[0]["app_key"] != null && ds.Tables[0].Rows[0]["app_key"].ToString() != "")
                {
                    model.app_key = ds.Tables[0].Rows[0]["app_key"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["api_path"] != null && ds.Tables[0].Rows[0]["api_path"].ToString() != "")
                {
                    model.api_path = ds.Tables[0].Rows[0]["api_path"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }