Exemple #1
0
        /// <summary>
        /// 新增代理/修改代理
        /// </summary>
        /// <param name="requestMsg"></param>
        /// <param name="head"></param>
        /// <returns></returns>
        public string InsertAgent(string requestMsg, HeadMessage head)
        {
            sendHead.Method = head.Method ?? "";
            error.ErrNo     = "0004";
            try
            {
                AgentSearchModel aSearch   = JSON.ToObject <AgentSearchModel>(requestMsg);
                bool             insertRes = false;
                string           pId;
                if (CommonDAL.IsSubAgent(head.LoginID, out pId))
                {
                    head.LoginID = pId;
                    error.ErrMsg = "子账号不具有此权限";
                }
                else if (!CommonDAL.IsYes(head.LoginID))
                {
                    error.ErrMsg = "当前代理未启用,不具有此权限";
                }
                else if (aSearch == null)
                {
                    error.ErrMsg = "没有接收到正确的参数";
                }
                else
                {
                    switch (sendHead.Method)
                    {
                    case "InsertAgent":
                        insertRes = agentListDal.InsertAgent(aSearch, head, out error);
                        break;

                    case "UpdateAgent":
                        insertRes = agentListDal.UpdateAgent(aSearch, head, out error);
                        break;

                    case "AgentModifyPwd":
                        insertRes = agentListDal.UpdateAPwd(aSearch, head, out error);
                        break;

                    case "AgentSelfModifyPwd":
                        insertRes = agentListDal.UpdateLoginAPwd(aSearch, head, out error);
                        break;

                    case "AgentPoint":
                        insertRes = agentListDal.AgentPoint(aSearch, head, out error);
                        break;

                    case "AgentClear":
                        insertRes = agentListDal.ClearAgent(aSearch, head, out error);
                        break;

                    case "SettleOdds4Agent":
                        insertRes = agentListDal.SettleOdds(aSearch, head, out error);
                        break;

                    case "SettleWashF4Agent":
                        insertRes = agentListDal.SettleWashF(aSearch, head, out error);
                        break;

                    case "DeleteAgent":

                    default:
                        insertRes = false;
                        break;
                    }
                }
                sendMsg.Head    = JSON.ToJSON(sendHead);
                sendMsg.Error   = JSON.ToJSON(error);
                sendMsg.Reponse = JSON.ToJSON(new { JsonData = JSON.ToJSON(new { Result = insertRes }) });
                return(JSON.ToJSON(sendMsg));
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteLog(typeof(LoginBLL), ex);
                error.ErrMsg    = ex.Message.Replace("\r", "").Replace("\n", "");
                sendMsg.Head    = JSON.ToJSON(sendHead);
                sendMsg.Reponse = "{}";
                sendMsg.Error   = JSON.ToJSON(error);
                return(JSON.ToJSON(sendMsg));
            }
        }