Beispiel #1
0
        public HttpResponseMessage GetCenterByClearMessage(string userid)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_delete_UserMessage");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.ExecuteNonQuery(cmd);
                flag = true;
                code = 200;
                Msg  = "操作成功";
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByClearMessage()", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #2
0
        public HttpResponseMessage GetCenterByHasRead(string userid)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetCenterByHasRead");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";

                str += "{\"_total\":\"" + dt.Rows[0]["total"].ToString().Trim() + "\"}";
                flag = true;
                code = 200;
                Msg  = "获取成功";

                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByMessage()", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #3
0
        public HttpResponseMessage DeleteSearchHistory(string userid, string personname)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_delete_ListSearch");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@personname", DbType.String, personname);
                DataTable dt = db.ExecuteDataTable(cmd);
                flag = true;
                code = 200;
                Msg  = "删除成功";
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("SaveSearchHistory(string userid, string personid)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #4
0
        public HttpResponseMessage InsertRealm(dynamic para)
        {
            var le   = EFClass.GetEF();
            int type = Convert.ToInt32(para.type);

            if (type == 1)
            {
                String RealmDes = Convert.ToString(para.RealmDes);
                long   Sequence = Convert.ToInt64(para.Sequence);
                String Uri      = Convert.ToString(para.Uri);
                //String ParentID = Convert.ToString(para.ParentID);
                String AppID    = Guid.NewGuid().ToString();
                String Security = Guid.NewGuid().ToString();
                Realms r        = new Realms();
                r.RealmID     = Guid.NewGuid().ToString();
                r.RealmDes    = RealmDes;
                r.Uri         = Uri;
                r.AppID       = AppID;
                r.Sequence    = Sequence;
                r.Security    = Security;
                r.CreatedDate = DateTime.Now;
                le.Realms.Add(r);
                return(ToJson.toJson(le.SaveChanges()));
            }
            else if (type == 2)
            {
                Thread.Sleep(2000);
                String RealmID = Convert.ToString(para.id);
                var    r       = le.Realms.Where(p => p.RealmID == RealmID).FirstOrDefault();
                r.Forzen = 1;
                return(ToJson.toJson(le.SaveChanges()));
            }
            return(ToJson.toJson(""));
        }
        public HttpResponseMessage DeleteFollows(string userid, string follows)
        {
            Boolean flag = false;
            string  Msg  = "取消关注失败";
            int     code = 213;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_delete_Follows");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@follows", DbType.String, follows);
                DataTable dt = db.ExecuteDataTable(cmd);
                flag = true;
                code = 200;
                Msg  = "取消关注成功";
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("DeleteFollows", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #6
0
        public HttpResponseMessage GetFindPlayByAddComment(string userid, string comment, string titleid)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindPlayByAddComment");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@comment", DbType.String, comment);
                db.AddInParameter(cmd, "@titleid", DbType.String, titleid);
                DataTable dt = db.ExecuteDataTable(cmd);
                flag = true;
                code = 200;
                Msg  = "操作成功";
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindPlayByAddComment", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #7
0
        public HttpResponseMessage GetFindPlayByCounts(string titleid)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindPlayByCounts");
                db.AddInParameter(cmd, "@titleid", DbType.String, titleid);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                str = "{\"_count\":\"" + dt.Rows[0][0].ToString()
                      + "\",\"_titleid\":\"" + titleid
                      + "\"}";
                flag = true;
                code = 200;
                Msg  = "获取成功";

                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindPlay", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #8
0
        public HttpResponseMessage GetFindStarByWork(string personid, string type, int pagesize, int pageindex)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindStarByWork");
                db.AddInParameter(cmd, "@personid", DbType.String, personid);
                db.AddInParameter(cmd, "@type", DbType.String, type);
                db.AddInParameter(cmd, "@pagesize", DbType.Int32, pagesize);
                db.AddInParameter(cmd, "@pageindex", DbType.Int32, pageindex);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_personid\":\"" + dt.Rows[i]["personid"].ToString().Trim()
                               + "\",\"_CName\":\"" + dt.Rows[i]["CName"].ToString().Trim()
                               + "\",\"_Gender\":\"" + dt.Rows[i]["Gender"].ToString().Trim()
                               + "\",\"_rolerank\":\"" + dt.Rows[i]["rolerank"].ToString().Trim()
                               + "\",\"_workname\":\"" + dt.Rows[i]["workname"].ToString().Trim()
                               + "\",\"_onair\":\"" + dt.Rows[i]["onair"].ToString().Trim()
                               + "\",\"_gross\":\"" + dt.Rows[i]["gross"].ToString().Trim()
                               + "\",\"_dy\":\"" + dt.Rows[i]["dy"].ToString().Trim()
                               + "\",\"_zy\":\"" + dt.Rows[i]["zy"].ToString().Trim()
                               + "\",\"_worktype\":\"" + dt.Rows[i]["worktype"].ToString().Trim()
                               + "\",\"_type\":\"" + dt.Rows[i]["type"].ToString().Trim()
                               + "\",\"_path\":\"" + System.Web.HttpUtility.UrlEncode(dt.Rows[i]["Img_Path"].ToString().Trim())
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindStarByWork(string personid, string type, int pagesize, int pageindex)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #9
0
        public HttpResponseMessage GetFindStarByPersonid(string personid, string userid)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindStarByPersonid");
                db.AddInParameter(cmd, "@personid", DbType.String, personid);
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_personid\":\"" + dt.Rows[i]["personid"].ToString().Trim()
                               + "\",\"_CName\":\"" + dt.Rows[i]["CName"].ToString().Trim()
                               + "\",\"_Gender\":\"" + dt.Rows[i]["Gender"].ToString().Trim()
                               + "\",\"_School\":\"" + dt.Rows[i]["School"].ToString().Trim()
                               + "\",\"_Company\":\"" + dt.Rows[i]["Company"].ToString().Trim()
                               + "\",\"_Height\":\"" + dt.Rows[i]["Height"].ToString().Trim()
                               + "\",\"_RMD\":\"" + dt.Rows[i]["媒体曝光"].ToString().Trim()
                               + "\",\"_rating\":\"" + dt.Rows[i]["人气"].ToString().Trim()
                               + "\",\"_RMOVIE\":\"" + dt.Rows[i]["电影"].ToString().Trim()
                               + "\",\"_RTV\":\"" + dt.Rows[i]["传统媒体"].ToString().Trim()
                               + "\",\"_RF\":\"" + dt.Rows[i]["网络视频指数"].ToString().Trim()
                               + "\",\"_path\":\"" + System.Web.HttpUtility.UrlEncode(dt.Rows[i]["Img_Path"].ToString().Trim())
                               + "\",\"_Birthday\":\"" + dt.Rows[i]["Birthday"].ToString().Trim().Trim()
                               + "\",\"_flag\":\"" + dt.Rows[i]["是否关注"].ToString().Trim()
                               + "\"}";
                    }
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindStarByPersonid(string personid, string userid)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #10
0
        public HttpResponseMessage GetDicRegionList(int page, int limit)
        {
            var    le   = EFClass.GetEF();
            var    list = le.Dic_Regions.OrderBy(p => p.UpdatedDate).Skip((page - 1) * limit).Take(limit).ToList();
            object o    = new { code = 0, msg = "", count = list.Count, data = list };

            return(ToJson.toJson(o));
        }
Beispiel #11
0
        public HttpResponseMessage GetListByRenqi(string type, string gender, string orderby, int pagesize, int pageindex)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetListByRenqi");
                db.AddInParameter(cmd, "@type", DbType.String, type);
                db.AddInParameter(cmd, "@gender", DbType.String, gender);
                db.AddInParameter(cmd, "@orderby", DbType.String, orderby);
                db.AddInParameter(cmd, "@pagesize", DbType.Int32, pagesize);
                db.AddInParameter(cmd, "@pageindex", DbType.Int32, pageindex);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_personid\":\"" + dt.Rows[i]["personid"].ToString().Trim()
                               + "\",\"_CName\":\"" + dt.Rows[i]["姓名"].ToString().Trim()
                               + "\",\"_Gender\":\"" + dt.Rows[i]["性别"].ToString().Trim()
                               + "\",\"_duration\":\"" + dt.Rows[i]["时间粒度"].ToString().Trim()
                               + "\",\"_idx\":\"" + dt.Rows[i]["人气值"].ToString().Trim()
                               + "\",\"_rating\":\"" + dt.Rows[i]["人气指数"].ToString().Trim()
                               + "\",\"_SR\":\"" + dt.Rows[i]["指数变化"].ToString().Trim()
                               + "\",\"_path\":\"" + System.Web.HttpUtility.UrlEncode(dt.Rows[i]["头像路径"].ToString().Trim())
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetListByRenqi", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #12
0
        public HttpResponseMessage GetFindStarByPic(string personid, int pagesize, int pageindex)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;
            Common  com  = new Common();

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindStarByPic");
                db.AddInParameter(cmd, "@personid", DbType.String, personid);
                db.AddInParameter(cmd, "@pagesize", DbType.Int32, pagesize);
                db.AddInParameter(cmd, "@pageindex", DbType.Int32, pageindex);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        string _url           = dt.Rows[i]["url"].ToString().Trim();
                        string widthandheight = com.GetWidthAndHeight(_url);
                        string width          = widthandheight.Split('-')[0];
                        string height         = widthandheight.Split('-')[1];
                        str += "{\"_personid\":\"" + dt.Rows[i]["personid"].ToString().Trim()
                               + "\",\"_url\":\"" + System.Web.HttpUtility.UrlEncode(_url)
                               + "\",\"_width\":\"" + width
                               + "\",\"_height\":\"" + height
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindStarByPic(string personid, int pagesize, int pageindex)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #13
0
        public HttpResponseMessage GetFindPlay(string type)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindPlay");
                db.AddInParameter(cmd, "@type", DbType.String, type);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        string _FMpath = dt.Rows[i]["CoverImg_Path"].ToString().Trim();
                        if (!string.IsNullOrEmpty(_FMpath))
                        {
                            if (_FMpath.Substring(0, 1) == "~")
                            {
                                _FMpath = _FMpath.Replace("~", "");
                            }
                            _FMpath = ManagerPath + System.Web.HttpUtility.UrlEncode(_FMpath);
                        }
                        str += "{\"_titleid\":\"" + dt.Rows[i]["Title_ID"].ToString().Trim()
                               + "\",\"_FMpath\":\"" + _FMpath
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindPlay", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #14
0
        public HttpResponseMessage GetChooseByTitle(string userid, string title)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetChooseByTitle");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@title", DbType.String, title);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_ID\":\"" + dt.Rows[i]["ID"].ToString().Trim()
                               + "\",\"_Title\":\"" + dt.Rows[i]["Title"].ToString().Trim()
                               + "\",\"_StartYear\":\"" + dt.Rows[i]["StartYear"].ToString().Trim()
                               + "\",\"_EndYear\":\"" + dt.Rows[i]["EndYear"].ToString().Trim()
                               + "\",\"_Field\":\"" + dt.Rows[i]["Field"].ToString().Trim()
                               + "\",\"_Lv\":\"" + dt.Rows[i]["Lv"].ToString().Trim()
                               + "\",\"_Gender\":\"" + dt.Rows[i]["Gender"].ToString().Trim()
                               + "\",\"_Country\":\"" + dt.Rows[i]["Country"].ToString().Trim()
                               + "\",\"_Theme\":\"" + dt.Rows[i]["Theme"].ToString().Trim()
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetChooseByTitle(string type, string gender, string orderby, int pagesize, int pageindex)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
        public HttpResponseMessage Register(string username, string password, string email, string rancode)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                string    newpassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
                DbCommand cmd         = db.GetStoredProcCommond("user_register_User");
                db.AddInParameter(cmd, "@username", DbType.String, username);
                db.AddInParameter(cmd, "@password", DbType.String, newpassword);
                db.AddInParameter(cmd, "@email", DbType.String, email);
                db.AddInParameter(cmd, "@rancode", DbType.String, rancode);
                DataTable dt = db.ExecuteDataTable(cmd);
                flag = true;
                Msg  = dt.Rows[0][0].ToString();
                string str = "";
                if (dt.Rows[0][0].ToString() == "用户邮箱已存在")
                {
                    code = 204;
                }
                else if (dt.Rows[0][0].ToString() == "用户名已存在")
                {
                    code = 210;
                }
                else if (dt.Rows[0][0].ToString() == "用户名、邮箱已存在")
                {
                    code = 215;
                }
                else if (dt.Rows[0][0].ToString() == "验证码错误")
                {
                    code = 216;
                }
                else if (dt.Rows[0][0].ToString() == "注册成功")
                {
                    code = 200;
                    str += "{\"_userid\":\"" + dt.Rows[0]["newid"].ToString()
                           + "\"}";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("Register(string username, string password, string email)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #16
0
        public HttpResponseMessage SaveChooseBySearch(string userid, string title, int startyear, int endyear, string field, string lv, string gender, string country, string theme, string orderby)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                startyear = startyear >= 0 ? startyear : 0;
                endyear   = endyear >= 0 ? endyear : 100;
                field     = field == null ? "" : field;
                lv        = lv == null ? "" : lv;
                gender    = gender == null ? "" : gender;
                country   = country == null ? "" : country;
                theme     = theme == null ? "" : theme;
                orderby   = orderby == null ? "zh" : orderby;
                DbCommand cmd = db.GetStoredProcCommond("user_save_ChooseBySearch");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@title", DbType.String, title);
                db.AddInParameter(cmd, "@startyear", DbType.Int32, startyear);
                db.AddInParameter(cmd, "@endyear", DbType.Int32, endyear);
                db.AddInParameter(cmd, "@field", DbType.String, field);
                db.AddInParameter(cmd, "@lv", DbType.String, lv);
                db.AddInParameter(cmd, "@gender", DbType.String, gender);
                db.AddInParameter(cmd, "@country", DbType.String, country);
                db.AddInParameter(cmd, "@theme", DbType.String, theme);
                db.AddInParameter(cmd, "@orderby", DbType.String, orderby);
                DataTable dt = db.ExecuteDataTable(cmd);
                Msg = dt.Rows[0][0].ToString();
                if (Msg == "标题已存在")
                {
                    flag = true;
                    code = 221;
                }
                else
                {
                    flag = true;
                    code = 200;
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("SaveChooseBySearch", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #17
0
        public HttpResponseMessage UpdateRoles(dynamic ro)
        {
            var    le    = EFClass.GetEF();
            String rn    = Convert.ToString(ro.rolename);
            String rd    = Convert.ToString(ro.roledes);
            String rid   = Convert.ToString(ro.roleid);
            var    roled = le.Roles.Where(p => p.RoleID == rid).FirstOrDefault();

            roled.RoleName = rn;
            roled.RoleDes  = rd;
            return(ToJson.toJson(le.SaveChanges()));
        }
Beispiel #18
0
        public HttpResponseMessage GetFindStarByNews(string personid, int pagesize, int pageindex)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetFindStarByNews");
                db.AddInParameter(cmd, "@personid", DbType.String, personid);
                db.AddInParameter(cmd, "@pagesize", DbType.Int32, pagesize);
                db.AddInParameter(cmd, "@pageindex", DbType.Int32, pageindex);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_personid\":\"" + dt.Rows[i]["personid"].ToString().Trim()
                               + "\",\"_title\":\"" + dt.Rows[i]["title"].ToString().Trim()
                               + "\",\"_publish_at\":\"" + dt.Rows[i]["publish_at"].ToString().Trim()
                               + "\",\"_website\":\"" + dt.Rows[i]["website"].ToString().Trim()
                               + "\",\"_comment_count\":\"" + dt.Rows[i]["comment_count"].ToString().Trim()
                               + "\",\"_url\":\"" + dt.Rows[i]["url"].ToString().Trim()
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetFindStarByNews(string personid, int pagesize, int pageindex)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #19
0
        public HttpResponseMessage GetCenterByMessage(string userid, int pagesize, int pageindex)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetCenterByMessage");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@pagesize", DbType.Int32, pagesize);
                db.AddInParameter(cmd, "@pageindex", DbType.Int32, pageindex);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_ID\":\"" + dt.Rows[i]["ID"].ToString().Trim()
                               + "\",\"_Title\":\"" + dt.Rows[i]["Title"].ToString().Trim()
                               + "\",\"_Context\":\"" + dt.Rows[i]["Context"].ToString().Trim()
                               + "\",\"_Readed\":\"" + dt.Rows[i]["Readed"].ToString().Trim()
                               + "\",\"_DeleteFlag\":\"" + dt.Rows[i]["DeleteFlag"].ToString().Trim()
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByMessage()", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #20
0
        public HttpResponseMessage DeleteUserToRole(String guid)
        {
            //从用户角色表中删除改用户与改角色的联系
            var       le = EFClass.GetEF();
            UserRoles ur = le.UserRoles.Where(p => p.GUID == guid).FirstOrDefault();

            if (ur != null)
            {
                le.UserRoles.Remove(ur);
                return(ToJson.toJson(le.SaveChanges()));
            }
            return(ToJson.toJson("-1"));
        }
Beispiel #21
0
        public HttpResponseMessage InsertRole(dynamic ro)
        {
            var    le    = EFClass.GetEF();
            String rn    = Convert.ToString(ro.rolename);
            String rd    = Convert.ToString(ro.roledes);
            Roles  roled = new Roles();

            roled.RoleName    = rn;
            roled.RoleDes     = rd;
            roled.RoleID      = Guid.NewGuid().ToString().ToUpper();
            roled.CreatedDate = DateTime.Now;
            le.Roles.Add(roled);
            return(ToJson.toJson(le.SaveChanges()));
        }
Beispiel #22
0
        public HttpResponseMessage UpdateRealm(dynamic para)
        {
            var    le       = EFClass.GetEF();
            String RealmID  = Convert.ToString(para.RealmID);
            String RealmDes = Convert.ToString(para.RealmDes);
            long   Sequence = Convert.ToInt64(para.Sequence);
            String Uri      = Convert.ToString(para.Uri);
            //String ParentID = Convert.ToString(para.ParentID);
            var r = le.Realms.Where(p => p.RealmID == RealmID).FirstOrDefault();

            r.Sequence = Sequence;
            r.RealmDes = RealmDes;
            r.Uri      = Uri;
            return(ToJson.toJson(le.SaveChanges()));
        }
Beispiel #23
0
        public HttpResponseMessage UpdateRegion(dynamic ro)
        {
            var    le         = EFClass.GetEF();
            String RegionName = Convert.ToString(ro.RegionName);
            String RegionDes  = Convert.ToString(ro.RegionDes);
            String GUID       = Convert.ToString(ro.GUID);
            String Alias      = Convert.ToString(ro.Alias);

            var roled = le.Dic_Regions.Where(p => p.GUID == GUID).FirstOrDefault();

            roled.RegionDes   = RegionDes;
            roled.RegionName  = RegionName;
            roled.Alias       = Alias;
            roled.UpdatedDate = DateTime.Now;
            return(ToJson.toJson(le.SaveChanges()));
        }
Beispiel #24
0
        public HttpResponseMessage GetCenterByPosition()
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetGeneral");
                db.AddInParameter(cmd, "@KeyType", DbType.String, "Position");
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_Key_Code\":\"" + dt.Rows[i]["Key_Code"].ToString().Trim()
                               + "\",\"_Key_Name\":\"" + dt.Rows[i]["Key_Name"].ToString().Trim()
                               + "\",\"_sort\":\"" + dt.Rows[i]["sort"].ToString().Trim()
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByPosition(string userid)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #25
0
        public HttpResponseMessage Get(string username, string password)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                string    newpassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
                DbCommand cmd         = db.GetStoredProcCommond("user_login_User");
                db.AddInParameter(cmd, "@username", DbType.String, username);
                db.AddInParameter(cmd, "@password", DbType.String, newpassword);
                DataTable dt  = db.ExecuteDataTable(cmd);
                string    str = "";
                Msg = dt.Rows[0]["msg"].ToString();
                if (Msg == "登录成功")
                {
                    str = "{\"_User_Name\":\"" + username.ToString()
                          + "\",\"_User_ID\":\"" + dt.Rows[0]["userid"].ToString()
                          + "\"}";
                    flag = true;
                    code = 200;
                }
                else if (Msg == "用户未注册")
                {
                    flag = true;
                    code = 209;
                }
                else if (Msg == "用户名或密码错误")
                {
                    flag = true;
                    code = 217;
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("Get(string username, string password)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #26
0
        public HttpResponseMessage GetListByHot(int pagesize)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetListByHot");
                db.AddInParameter(cmd, "@pagesize", DbType.Int32, pagesize);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    for (int i = 0; i < len; i++)
                    {
                        str += "{\"_personid\":\"" + dt.Rows[i]["personid"].ToString()
                               + "\",\"_CName\":\"" + dt.Rows[i]["CName"].ToString()
                               + "\",\"_idx\":\"" + dt.Rows[i]["idx"].ToString()
                               + "\"},";
                    }
                    str  = str.Substring(0, str.Length - 1);
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetListByHot", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #27
0
        public HttpResponseMessage GetUserList(dynamic para)
        {
            var le = EFClass.GetEF();

            if (para.type == 1)
            {
                //获得工厂列表
                return(ToJson.toJson(le.Dic_Regions.ToList()));
            }
            else if (para.type == 2)
            {
                //通过初始化数据
                String guid = Convert.ToString(para.guid); //当前角色的roleid
                String cqid = Convert.ToString(para.cqid); //下拉列表框中的选择项
                String txt  = Convert.ToString(para.txt);  //用户编号 或者 姓名

                int page     = Convert.ToInt32(para.page);
                int pagesize = Convert.ToInt32(para.pagesize);
                //在用户角色表中 获得有guid 角色的用户id ,存在UserIDList中
                List <String> UserIDList = (from ur in le.UserRoles where ur.RoleID == guid select ur.UserID).ToList();
                //通过用户表,厂区表 联合查询,查出 用户id不在UserIDList 中,且厂区编号为cqid 的用户
                var EndList = (from ui in le.UserInfo where ui.Region.Contains(cqid) && !UserIDList.Contains(ui.UserID) && (ui.UserName.Contains(txt) || ui.UserID.Contains(txt)) select ui).ToList();

                return(ToJson.toJson(EndList));
            }
            else if (para.type == 3)
            {
                //查询不分页
                String guid = Convert.ToString(para.guid); //当前角色的roleid
                String cqid = Convert.ToString(para.cqid); //下拉列表框中的选择项
                String txt  = Convert.ToString(para.txt);  //用户编号 或者 姓名

                int page     = Convert.ToInt32(para.page);
                int pagesize = Convert.ToInt32(para.pagesize);

                //在用户角色表中 获得有guid 角色的用户id ,存在UserIDList中
                List <String> UserIDList = (from ur in le.UserRoles where ur.RoleID == guid select ur.UserID).ToList();
                //通过用户表,厂区表 联合查询,查出 用户id不在UserIDList 中,且厂区编号为cqid 的用户
                var EndList = (from ui in le.UserInfo where ui.Region.Contains(cqid) && !UserIDList.Contains(ui.UserID) && (ui.UserName.Contains(txt) || ui.UserID.Contains(txt)) select ui).ToList();

                return(ToJson.toJson(EndList));
            }
            return(ToJson.toJson("-1"));
        }
Beispiel #28
0
        public HttpResponseMessage GetCenterByMessageID(int id)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetCenterByMessageID");
                db.AddInParameter(cmd, "@id", DbType.Int64, id);
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    str += "{\"_ID\":\"" + dt.Rows[0]["ID"].ToString().Trim()
                           + "\",\"_Title\":\"" + dt.Rows[0]["Title"].ToString().Trim()
                           + "\",\"_Context\":\"" + dt.Rows[0]["Context"].ToString().Trim()
                           + "\"}";
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByMessageID", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #29
0
        public HttpResponseMessage GetCenterByAboutUS()
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                DbCommand cmd = db.GetStoredProcCommond("user_get_GetCenterByAboutUS");
                DataTable dt  = db.ExecuteDataTable(cmd);
                int       len = dt.Rows.Count;
                string    str = "";
                if (len > 0)
                {
                    str += "{\"_introduction\":\"" + dt.Rows[0]["introduction"].ToString().Trim()
                           + "\",\"_phone\":\"" + dt.Rows[0]["phone"].ToString().Trim()
                           + "\",\"_address\":\"" + dt.Rows[0]["address"].ToString().Trim()
                           + "\"}";
                    flag = true;
                    code = 200;
                    Msg  = "获取成功";
                }
                else
                {
                    flag = true;
                    code = 202;
                    Msg  = "没有查询到数据";
                }
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + str.ToString() + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByAboutUS()", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }
Beispiel #30
0
        public HttpResponseMessage GetCenterByChangePWD(string userid, string oldpassword, string newpassword)
        {
            Boolean flag = false;
            string  Msg  = "方法异常";
            int     code = 205;

            try
            {
                userid = userid == null ? "" : userid;
                string    MDoldpassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(oldpassword, "MD5");
                string    MDnewpassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(newpassword, "MD5");
                DbCommand cmd           = db.GetStoredProcCommond("user_get_GetCenterByChangePWD");
                db.AddInParameter(cmd, "@userid", DbType.String, userid);
                db.AddInParameter(cmd, "@oldpassword", DbType.String, MDoldpassword);
                db.AddInParameter(cmd, "@newpassword", DbType.String, MDnewpassword);
                DataTable dt = db.ExecuteDataTable(cmd);
                Msg = dt.Rows[0][0].ToString();
                if (Msg == "密码错误")
                {
                    code = 218;
                }
                else if (Msg == "修改成功")
                {
                    code = 200;
                }
                flag = true;
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
            catch (Exception ex)
            {
                logger.WriteLogFile("GetCenterByChangePWD(string userid, string password)", ex.Message.ToString());
                String returnString = "{\"Success\":\"" + flag.ToString() + "\",\"Msg\":\"" + Msg.ToString() + "\", \"Data\":[" + "" + "],\"Code\":" + code + "}";
                String decryptStr   = aes.Encrypt(returnString);
                String ret          = "{\"data\":\"" + decryptStr + "\"}";
                return(ToJson.toJson(ret.ToString()));
            }
        }