Ejemplo n.º 1
0
        public JsonResult CardDisable(string userid, string agentid, string cardno)
        {
            var  data  = new CommonDbResponse();
            bool valid = true;

            if (!String.IsNullOrEmpty(userid) || !String.IsNullOrEmpty(agentid))
            {
                userid  = userid.DecryptParameter();
                agentid = agentid.DecryptParameter();
                if (string.IsNullOrEmpty(userid) || string.IsNullOrEmpty(agentid))
                {
                    data = new CommonDbResponse {
                        Code = ResponseCode.Failed, Message = "Invalid User."
                    };
                    valid = false;
                }
            }

            if (!String.IsNullOrEmpty(cardno))
            {
                cardno = cardno.DecryptParameter();
                if (string.IsNullOrEmpty(cardno))
                {
                    data = new CommonDbResponse {
                        Code = ResponseCode.Failed, Message = "Invalid Card"
                    };
                    valid = false;
                }
            }
            if (valid)
            {
                CardCommon cardCommon = new CardCommon();
                cardCommon.UserId  = userid;
                cardCommon.AgentId = agentid;
                cardCommon.CardNo  = cardno;
                data = _card.EnableDisableCard(cardCommon);
                if (data.ErrorCode == 0)
                {
                    data.Message = "Successfully Disabled Card";
                }
            }

            data.SetMessageInTempData(this);
            return(Json(data));
        }