コード例 #1
0
        /// <summary>
        /// 保存发布信息到Json
        /// </summary>
        /// <param name="data">数据集</param>
        /// <param name="accessor"></param>
        /// <returns></returns>
        protected String SaveRelease(DataSet data, GeneralAccessor accessor)
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();
            try
            {
                accessor.SaveSingleT(data);
                jsonhlp.GetTopicsJson(data.Tables[0]);
                jsonhlp.AddObjectToJson("success", "true");
                if (data.Tables[0].Rows.Count > 0)
                {
                    jsonhlp.AddObjectToJson("exit", "false");
                }
                else
                {
                    jsonhlp.AddObjectToJson("exit", "true");
                }
            }
            catch (Exception e)
            {
                jsonhlp.AddObjectToJson("success", "false");
                jsonhlp.AddObjectToJson("msg", e.Message);
            }
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #2
0
        internal string GetJsonRegisterCode(
            string key, string userInfor)
        {
            JsonHelper jsonhlp = new JsonHelper();

            jsonhlp.AddObjectToJson("success", "true");
            jsonhlp.AddObjectToJson("GenKey", "good");
            return(jsonhlp.ToString());
        }
コード例 #3
0
        /*
         * public static bool SessionCheckValid(string sessionUser, ref string json)
         * {
         #region
         *  if (string.IsNullOrEmpty(sessionUser))
         *  {
         *      JsonHelper jsonhlp = new JsonHelper();
         *      jsonhlp.AddObjectToJson("msg", "sessioninvalid");
         *      jsonhlp.AddObjectToJson("success", "false");
         *      json = jsonhlp.ToString();
         *      return false;
         *  }
         *  else
         *      return true;
         #endregion
         * }
         */
        protected string GetMessageJson(bool isSuccess, string message)
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();
            jsonhlp.AddObjectToJson("success", isSuccess.ToString().ToLower());
            jsonhlp.AddObjectToJson("msg", message);
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #4
0
        protected string GetJson(DataSet businessData, int totalCount)
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();
            jsonhlp.GetTopicsJson(businessData.Tables[0]);
            jsonhlp.AddObjectToJson("total", totalCount.ToString());
            jsonhlp.AddObjectToJson("success", "true");
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #5
0
        internal string GetJsonClawlerDisableTime()
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();
            jsonhlp.AddObjectToJson("success", "true");
            jsonhlp.AddObjectToJson(AliCache._KeyNameCrawlerDisableRuntimeMode1,
                                    AliCache._CrawlerDisableRuntimeMode1 == null ? "" : AliCache._CrawlerDisableRuntimeMode1.ToString());
            jsonhlp.AddObjectToJson(AliCache._KeyNameCrawlerDisableRuntimeMode2,
                                    AliCache._CrawlerDisableRuntimeMode2 == null ? "" : AliCache._CrawlerDisableRuntimeMode2.ToString());
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        protected string UtiSave(DLSaveFunction fun)
        {
            JsonHelper jsonhlp = new JsonHelper();

            try
            {
                fun();
                jsonhlp.AddObjectToJson("success", "true");
            }
            catch (Exception e)
            {
                jsonhlp.AddObjectToJson("success", "false");
                jsonhlp.AddObjectToJson("msg", e.Message);
            }
            return(jsonhlp.ToString());
        }
コード例 #7
0
        public string GetMissionsIdBySummaryId(EntityWLOGMission mission)
        {
            #region
            DBConditions querybusinessparams = new DBConditions();
            querybusinessparams.Add(WLOGMissionData.writeUser, EnumSqlType.sqlint, EnumCondition.Equal, mission.writeUser);
            querybusinessparams.Add(WLOGMissionData.summaryId, EnumSqlType.sqlint, EnumCondition.Equal, mission.summaryId);
            WLOGMissionData missiondata = new WLOGMissionData();
            this._wlogmissionclass.GetSingleT(missiondata, querybusinessparams);

            JsonHelper        jsonhlp    = new JsonHelper();
            string            missionsid = "";
            DataRowCollection drcollect  = missiondata.Tables[0].Rows;
            for (int i = 0; i < drcollect.Count; i++)
            {
                string temp = drcollect[i][WLOGMissionData.missionId].ToString();
                if (i != drcollect.Count - 1)
                {
                    temp += ',';
                }
                missionsid += temp;
            }
            jsonhlp.AddObjectToJson("missionId", missionsid);
            jsonhlp.SetResult(true);
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #8
0
        public string updateRoleControlMenu(string setId, string menuId,
                                            string roleId, string userid, string writeIp,
                                            string writeTime)
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();
            if (roleId.ToString() != "")
            {
                RoleControlMenuData rolecontrolmenudata = new RoleControlMenuData();
                if (menuId != null)
                {
                    string[] strArray = menuId.Split(',');
                    for (int i = 0; i < strArray.Length; i++)
                    {
                        if (strArray[i] == "root")
                        {
                            continue;
                        }
                        EntityRoleControlMenu rolecontrolmenu = new EntityRoleControlMenu();
                        rolecontrolmenu.setId     = i.ToString();
                        rolecontrolmenu.menuId    = strArray[i];
                        rolecontrolmenu.roleId    = roleId;
                        rolecontrolmenu.userid    = userid;
                        rolecontrolmenu.writeIp   = writeIp;
                        rolecontrolmenu.writeTime = DateTime.Now.ToString();
                        this.AddRow(ref rolecontrolmenudata, rolecontrolmenu);
                    }
                    this._rolecontrolmenuclass.UpdateRoleControl(roleId, rolecontrolmenudata);
                    jsonhlp.AddObjectToJson("success", true);
                }
            }
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #9
0
 /// <summary>
 /// 查找是否存在所选周日志。
 /// </summary>
 /// <param name="wlogweeksummary"></param>
 /// <param name="json"></param>
 /// <returns></returns>
 public bool FindUserWeekSummary(EntityWLOGWeekSummary wlogweeksummary, ref string json)
 {
     #region
     int                 totalCount          = 0;
     PageParams          pageparams          = new PageParams();
     WLOGWeekSummaryData wlogweeksummarydata = new WLOGWeekSummaryData();
     DBConditions        querybusinessparams = new DBConditions(pageparams);
     querybusinessparams.Add(WLOGWeekSummaryData.writeUser, EnumSqlType.sqlint, EnumCondition.Equal, wlogweeksummary.writeUser);
     querybusinessparams.Add(WLOGWeekSummaryData.startDate, EnumSqlType.datetime, EnumCondition.Equal, wlogweeksummary.startDate);
     WLOGWeekSummaryData weeksummarydata = new WLOGWeekSummaryData();
     totalCount = this._wlogweeksummaryclass.GetSingleT(weeksummarydata, querybusinessparams);
     JsonHelper jsonhlp = new JsonHelper();
     if (weeksummarydata.Tables[0].Rows.Count > 0)
     {
         jsonhlp.AddObjectToJson("msg", "请注意:每人每周只限一篇总结!");
         jsonhlp.SetResult(false);
         json = jsonhlp.ToString();
         return(true);
     }
     else
     {
         return(false);
     }
     #endregion
 }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="personlog"></param>
        /// <returns></returns>
        public string GetPersonLogsIdByMissionId(EntityWLOGPersonLog personlog)
        {
            #region
            PageParams   pageparams          = new PageParams();
            DBConditions querybusinessparams = new DBConditions(pageparams);
            querybusinessparams.Add(WLOGPersonLogData.writeUser, EnumSqlType.sqlint, EnumCondition.Equal, personlog.writeUser);
            querybusinessparams.Add(WLOGPersonLogData.missionId, EnumSqlType.sqlint, EnumCondition.Equal, personlog.missionId);
            WLOGPersonLogData wlogpersonlogdata = new WLOGPersonLogData();
            this._wlogpersonlogclass.GetSingleT(wlogpersonlogdata, querybusinessparams);
            JsonHelper        jsonhlp   = new JsonHelper();
            string            logsid    = "";
            DataRowCollection drcollect = wlogpersonlogdata.Tables[0].Rows;
            for (int i = 0; i < drcollect.Count; i++)
            {
                string temp = drcollect[i][WLOGPersonLogData.logId].ToString();
                if (i != drcollect.Count - 1)
                {
                    temp += ',';
                }
                logsid += temp;
            }
            jsonhlp.AddObjectToJson("logsid", logsid);
            jsonhlp.SetResult(true);
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #11
0
 public static bool SessionCheckValid(string sessionUser, ref string json)
 {
     #region
     if (string.IsNullOrEmpty(sessionUser))
     {
         JsonHelper jsonhlp = new JsonHelper();
         jsonhlp.AddObjectToJson("msg", "sessioninvalid");
         jsonhlp.AddObjectToJson("success", "false");
         json = jsonhlp.ToString();
         return(false);
     }
     else
     {
         return(true);
     }
     #endregion
 }
コード例 #12
0
        protected String Save(DataSet data, GeneralAccessor accessor)
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();
            try
            {
                accessor.SaveSingleT(data);
                jsonhlp.AddObjectToJson("success", "true");
            }
            catch (Exception e)
            {
                jsonhlp.AddObjectToJson("success", "false");
                jsonhlp.AddObjectToJson("msg", e.Message);
            }
            return(jsonhlp.ToString());

            #endregion
        }
コード例 #13
0
 internal string GetJsonCurrentRate()
 {
     #region
     JsonHelper jsonhlp = new JsonHelper();
     if (AliCache._CurrentRate != null)
     {
         jsonhlp.AddObjectToJson("success", "true");
         CurrentRate rate = AliCache._CurrentRate;
         jsonhlp.AddObjectToJson(CurrentRate.KeyNameFetchTime, rate._FetchTime.ToString("yyyy-MM-dd HH:mm:ss"));
         jsonhlp.AddObjectToJson(CurrentRate.KeyNameMonth1To6, getMonthRate(rate._Month1To6));
         jsonhlp.AddObjectToJson(CurrentRate.KeyNameMonth6To12, getMonthRate(rate._Month6To12));
         jsonhlp.AddObjectToJson(CurrentRate.KeyNameMonth12To24, getMonthRate(rate._Month12To24));
         return(jsonhlp.ToString());
     }
     else
     {
         return(JsonHelper.GetErrorJson("服务器暂未获取成功阿里招财宝利率!"));
     }
     #endregion
 }
コード例 #14
0
        /// <summary>
        /// 注册界面判定用户名是否可用
        /// </summary>
        /// <param name="username">用户名</param>
        /// <returns>返回json串</returns>
        public String CheckUserregister(string username)
        {
            #region
            JsonHelper   jsonhelp            = new JsonHelper();
            DBConditions querybusinessparams = new DBConditions();
            querybusinessparams.Add(ApplicationUserData.Username, EnumSqlType.nvarchar, EnumCondition.Equal, username);
            ApplicationUserData applicationuserdata = new ApplicationUserData();
            this._applicationuserclass.GetSingleTAll(applicationuserdata, querybusinessparams);
            if (applicationuserdata.Tables[0].Rows.Count == 0)
            {
                jsonhelp.AddObjectToJson("success", "true");
            }
            else
            {
                jsonhelp.AddObjectToJson("success", "false");
                jsonhelp.AddObjectToJson("msg", "用户名已经存在");
            }
            return(jsonhelp.ToString());

            #endregion
        }
コード例 #15
0
        /// <summary>
        /// 登录界面判定用户名密码是否有效,并返回相关用户信息
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">未加密的密码字符串</param>
        /// <param name="roleid">角色编号</param>
        /// <param name="userid">用户编号</param>
        /// <param name="fullname">用户全名</param>
        /// <returns>返回json串</returns>
        public string CheckUserlogon(string username, string password,
                                     ref string roleid, ref string userid, ref string fullname)
        {
            #region
            int          totalCount          = 0;
            string       encodemd5           = Password.ToMD5(password);
            DBConditions querybusinessparams = new DBConditions();
            querybusinessparams.Add(ApplicationUserData.Username, EnumSqlType.nvarchar, EnumCondition.Equal, username);
            querybusinessparams.Add(ApplicationUserData.passWord, EnumSqlType.nvarchar, EnumCondition.Equal, encodemd5);
            ApplicationUserData applicationuserdata = new ApplicationUserData();
            totalCount = this._applicationuserclass.GetSingleTAll(applicationuserdata, querybusinessparams);
            if (applicationuserdata.Tables[0].Rows.Count > 0)
            {
                int currentlogintimes = 0;

                DataRow dr = applicationuserdata.Tables[0].Rows[0];
                roleid   = dr[ApplicationUserData.roleId].ToString();
                userid   = dr[ApplicationUserData.userid].ToString();
                fullname = dr[ApplicationUserData.fullName].ToString();

                //更新用户登录次数和上次登录时刻
                dr[ApplicationUserData.lastLoginTime] = DateTime.Now;
                int.TryParse(dr[ApplicationUserData.loginTimes].ToString(), out currentlogintimes);
                dr[ApplicationUserData.loginTimes] = currentlogintimes + 1;
                this._applicationuserclass.SaveSingleT(applicationuserdata);

                return(base.GetJson(applicationuserdata, totalCount));
            }
            else
            {
                JsonHelper jsonhlp = new JsonHelper();
                jsonhlp.AddObjectToJson("success", "false");
                jsonhlp.AddObjectToJson("msg", "用户名密码不正确,请重新输入!");
                return(jsonhlp.ToString());
            }


            #endregion
        }
コード例 #16
0
        public string UpdateSysUserPwd(string userid, string oldPassword, string newPassword)
        {
            #region
            JsonHelper jsonhlp = new JsonHelper();

            if (oldPassword == newPassword)
            {
                jsonhlp.AddObjectToJson("success", "false");
                jsonhlp.AddObjectToJson("msg", "新旧密码相同!");
                return(jsonhlp.ToString());
            }
            else
            {
                string       encodemd5           = Password.ToMD5(oldPassword);
                DBConditions querybusinessparams = new DBConditions();
                querybusinessparams.Add(ApplicationUserData.userid, EnumSqlType.sqlint, EnumCondition.Equal, userid);
                querybusinessparams.Add(ApplicationUserData.passWord, EnumSqlType.nvarchar, EnumCondition.Equal, encodemd5);
                ApplicationUserData applicationuserdata = new ApplicationUserData();
                this._applicationuserclass.GetSingleTAll(applicationuserdata, querybusinessparams);
                if (applicationuserdata.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = applicationuserdata.Tables[0].Rows[0];
                    applicationuserdata.Assign(dr, ApplicationUserData.passWord, Password.ToMD5(newPassword));
                    //applicationuserclass.Save(applicationuserdata);
                    return(this.SaveApplicationUser(applicationuserdata));
                }
                else
                {
                    jsonhlp.AddObjectToJson("success", "false");
                    jsonhlp.AddObjectToJson("msg", "用户名密码不正确,请重新输入!");
                    return(jsonhlp.ToString());
                }
            }

            #endregion
        }
コード例 #17
0
 public bool FindUserCurrentDayLog(EntityWLOGPersonLog wlogpersonlog, ref string json)
 {
     #region
     PageParams   pageparams          = new PageParams();
     DBConditions querybusinessparams = new DBConditions(pageparams);
     querybusinessparams.Add(WLOGPersonLogData.writeUser, EnumSqlType.sqlint, EnumCondition.Equal, wlogpersonlog.writeUser);
     querybusinessparams.Add(WLOGPersonLogData.logDate, EnumSqlType.datetime, EnumCondition.Equal, wlogpersonlog.logDate);
     WLOGPersonLogData personlog = new WLOGPersonLogData();
     this._wlogpersonlogclass.GetSingleT(personlog, querybusinessparams);
     JsonHelper jsonhlp = new JsonHelper();
     if (personlog.Tables[0].Rows.Count > 0)
     {
         jsonhlp.AddObjectToJson("msg", "请注意:每人每天只限一篇日志!");
         jsonhlp.SetResult(false);
         json = jsonhlp.ToString();
         return(true);
     }
     else
     {
         return(false);
     }
     #endregion
 }
コード例 #18
0
        /// <summary>
        /// 获取系统登录信息
        /// </summary>
        /// <param name="context"></param>
        /// <param name="username"></param>
        /// <param name="fullname"></param>
        /// <returns></returns>
        public string GetAppParameters(HttpContext context, string username,
                                       string fullname)//string roleId, string userid
        {
            #region
            SystemPlatform platform = new SystemPlatform(context);
            JsonHelper     jsonhlp  = new JsonHelper();

            jsonhlp.AddObjectToJson("contactus", platform.GetContactUs());
            jsonhlp.AddObjectToJson("developby", platform.GetDevelopBy());
            jsonhlp.AddObjectToJson("systemversion", "V " + Assembly.GetCallingAssembly().GetName().Version.ToString());
            jsonhlp.AddObjectToJson("serverIp", platform.GetServerIp());
            jsonhlp.AddObjectToJson("browserversion", platform.GetBrowserVersion());
            jsonhlp.AddObjectToJson("browser", platform.GetBrowserName());
            jsonhlp.AddObjectToJson("osname", platform.GetClientOS());
            jsonhlp.AddObjectToJson("clientIp", platform.GetClientIp());
            jsonhlp.AddObjectToJson("logontime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            jsonhlp.AddObjectToJson("fullname", fullname);
            //jsonhlp.AddObjectToJson("rolename", rolename);
            jsonhlp.AddObjectToJson(ApplicationUserData.Username, username);

            return(jsonhlp.ToString());

            #endregion
        }