Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            string ids  = context.Request["ids"];
            string type = context.Request["forward_type"];

            if (string.IsNullOrEmpty(ids))
            {
                apiResp.msg  = "请至少选择一条记录进行操作!";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }

            string[] qIds = ids.Split(',');

            foreach (var item in qIds)
            {
                Questionnaire qModel = bllQuestion.Get <Questionnaire>(string.Format(" WebsiteOwner='{0}' AND QuestionnaireID={1} AND QuestionnaireType=1 ", bllQuestion.WebsiteOwner, item));

                if (qModel == null)
                {
                    continue;
                }

                ActivityForwardInfo forwardModel = bllQuestion.Get <ActivityForwardInfo>(string.Format(" WebsiteOwner='{0}'  AND  ActivityId='{1}'", bllQuestion.WebsiteOwner, item));

                if (forwardModel != null)
                {
                    apiResp.msg  = forwardModel.ActivityName + "已经转发,请您重新选择!";
                    apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat;
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                    return;
                }
                ActivityForwardInfo model = new ActivityForwardInfo();
                model.ActivityId     = item;
                model.ActivityName   = qModel.QuestionnaireName;
                model.InsertDate     = DateTime.Now;
                model.ReadNum        = qModel.PV;
                model.UserId         = bllQuestion.GetCurrUserID();
                model.ThumbnailsPath = qModel.QuestionnaireImage;
                model.WebsiteOwner   = bllQuestion.WebsiteOwner;
                model.ForwardType    = type;
                model.PV             = 0;
                bllQuestion.Add(model);
            }
            apiResp.msg    = "操作完成";
            apiResp.status = true;
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Пример #2
0
        public void ProcessRequest(HttpContext context)
        {
            string ids = context.Request["ids"];

            string[] arrayIds = ids.Split(',');

            foreach (var item in arrayIds)
            {
                ActivityForwardInfo model = bllForward.GetActivityForwardInfo(item);

                if (model == null)
                {
                    continue;
                }

                bllForward.Delete(model);
            }

            apiResp.msg    = "删除了" + arrayIds.Length + "条数据!";
            apiResp.status = true;
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }