示例#1
0
        public ActionResult ConsumeExchangeService(Guid esrId, string password)
        {
            if (esrId == null)
            {
                return(Json("True", JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(password))
            {
                return(Json("False", JsonRequestBehavior.AllowGet));
            }

            // 获取消费密码
            ServiceConsumePassword scp = _serviceConsumePasswordBLL.GetServicePassword();

            if (scp.Password == password)
            {
                ExchangeServiceRecord esr = _exchangeServiceRecordBLL.GetESRById(esrId);
                esr.IsUse = true;

                if (_exchangeServiceRecordBLL.Update(esr))
                {
                    return(Json("True", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json("False", JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json("False", JsonRequestBehavior.AllowGet));
            }
        }
示例#2
0
        public ActionResult PasswordSetting()
        {
            ServiceConsumePassword scp = _serviceConsumePasswordBLL.GetServicePassword();
            string currentpassword     = string.Empty;

            if (scp != null)
            {
                currentpassword = scp.Password;
            }
            ViewBag.password = currentpassword;
            return(View());
        }
示例#3
0
        public ActionResult ConsumeService(Guid serviceId, string password)
        {
            if (serviceId == null)
            {
                return(Json("False", JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(password))
            {
                return(Json("PasswordError", JsonRequestBehavior.AllowGet));
            }
            // 获取消费密码
            ServiceConsumePassword scp = _serviceConsumePasswordBLL.GetServicePassword();

            if (scp.Password == password)
            {
                ServiceConsumeRecord scr = new ServiceConsumeRecord();
                scr.Id          = Guid.NewGuid();
                scr.IsDeleted   = false;
                scr.ServiceId   = serviceId;
                scr.CreatedTime = DateTime.Now;
                scr.DeletedTime = DateTime.MinValue.AddHours(8);

                if (_serviceConsumeRecoredBLL.Add(scr))
                {
                    MyService ms = _serviceBLL.GetMyServiceByServiceId(serviceId);
                    if (ms.CurrentCount > 0)
                    {
                        ms.CurrentCount -= 1;
                    }
                    else
                    {
                        return(Json("False", JsonRequestBehavior.AllowGet));
                    }
                    _serviceBLL.Update(ms);

                    return(Json("True", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json("False", JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json("PasswordError", JsonRequestBehavior.AllowGet));
            }
        }
示例#4
0
        public ActionResult UpdatePassword(string password)
        {
            if (string.IsNullOrEmpty(password))
            {
                return(Json("False", JsonRequestBehavior.AllowGet));
            }
            ServiceConsumePassword scp = _serviceConsumePasswordBLL.GetServicePassword();

            if (scp != null)
            {
                scp.Password    = password;
                scp.CreatedTime = DateTime.Now;

                if (_serviceConsumePasswordBLL.Update(scp))
                {
                    return(Json("True", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json("False", JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                ServiceConsumePassword scp_new = new ServiceConsumePassword();
                scp_new.Id          = Guid.NewGuid();
                scp_new.IsDeleted   = false;
                scp_new.Password    = password;
                scp_new.DeletedTime = DateTime.MinValue.AddHours(8);
                scp_new.CreatedTime = DateTime.Now;

                if (_serviceConsumePasswordBLL.Add(scp_new))
                {
                    return(Json("True", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json("False", JsonRequestBehavior.AllowGet));
                }
            }
        }
 public bool Update(ServiceConsumePassword scp)
 {
     return(_serviceConsumePasswordDAL.Update(scp));
 }
 public bool Add(ServiceConsumePassword scp)
 {
     return(_serviceConsumePasswordDAL.Insert(scp));
 }