Beispiel #1
0
        public FileResult ResposeFile(string id)
        {
            string file = new DynamicOperation().GetDynamicMsg(Convert.ToInt32(id), (int)DynamicTypes.File).dynamic_body;
            string name = System.IO.Path.GetFileName(file);

            return(File(file, "application/octet-stream", name));
        }
Beispiel #2
0
        public string AddDynamic()
        {
            string title   = Request["title"];
            string body    = Request["body"];
            string isIndex = Request["isIndex"];
            bool   isI     = false;
            int    type    = Convert.ToInt32(Request["type"]);
            string isEdit  = Request["isEdit"];

            if (isIndex == "true")
            {
                isI = true;
            }
            string json = null;

            if (isEdit == "False")
            {
                json = new DynamicOperation().AddDynamic(title, body, isI, type);
            }
            else
            {
                if (Request["id"] == null)
                {
                    return("{\"back\":\"未知错误,请重试!\"}");
                }
                long id = Convert.ToInt64(Request["id"]);
                json = new DynamicOperation().EditDynamic(title, body, isI, type, id);
            }
            return("{\"back\":\"" + json + "\"}");
        }
Beispiel #3
0
        public string MofifyFile()
        {
            string id    = Request["id"];
            string title = Request["title"];
            string json  = new DynamicOperation().ModifyFile(id, title);

            return("{\"back\":\"" + json + "\"}");
        }
Beispiel #4
0
        public ActionResult ExperimentResource(string pageIndex)
        {
            DynamicOperation doper = new DynamicOperation();
            int index = 0;

            ViewBag.resList = doper.GetExperimentResourceList(pageIndex, 30, out index);
            return(View());
        }
Beispiel #5
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            DynamicOperation d = new DynamicOperation();

            ViewBag.indeNews   = d.GetIndexNewsAndToast();
            ViewBag.showNotice = d.GetOneShow((int)DynamicTypes.Toast);
            ViewBag.showNews   = d.GetOneShow((int)DynamicTypes.News);
            ViewBag.showCG     = d.GetOneShow((int)DynamicTypes.Achievement, false);
            return(View());
        }
Beispiel #6
0
        public ActionResult SoftwareCategory(string id, int pageSize = 30)
        {
            DynamicOperation doper = new DynamicOperation();
            int index = 1;

            ViewBag.filelist   = doper.GetFileList(id, pageSize, out index, true);
            ViewBag.index      = index;
            ViewBag.isPrevious = index == 1 ? false : true;
            ViewBag.isNext     = doper.GetFilePageMax(30) == index ? false : true;
            return(View());
        }
Beispiel #7
0
        public ActionResult FileDown(string id)
        {
            DynamicOperation doper = new DynamicOperation();
            int index = 1;

            ViewBag.filelist   = doper.GetFileList(id, 30, out index);
            ViewBag.index      = index;
            ViewBag.isPrevious = index == 1 ? false : true;
            ViewBag.isNext     = doper.GetFilePageMax(30) == index ? false : true;
            return(View());
        }
Beispiel #8
0
        public ActionResult About(string id)
        {
            DynamicOperation doper = new DynamicOperation();

            ViewBag.teamInfo = doper.GetTeamList();
            int index = 1;

            ViewBag.teacherlist = doper.GetTeacherList(id, 12, out index);
            ViewBag.index       = index;
            ViewBag.listsize    = doper.GetTeacherPageMax(12);
            ViewBag.isPrevious  = index == 1 ? false : true;
            ViewBag.isNext      = ViewBag.listsize == index ? false : true;
            return(View());
        }
Beispiel #9
0
        public DynamicOperation GetDynamicOperation(TemplateTypeEnum templateTypeEnum, string submitValue, IEnumerable <DynamicMethod> dynamicMethods)
        {
            var result = new DynamicOperation();
            var matchingSubmitValues = dynamicMethods.Where(x => x.SubmitValue == submitValue).ToList();

            matchingSubmitValues = matchingSubmitValues.Where(x => x.TemplateTypeEnum.HasFlag(templateTypeEnum)).ToList();
            if (matchingSubmitValues.Count > 1)
            {
                throw new Exception("Duplicate dynamic methods found for submit value " + submitValue + " and templatetype " + templateTypeEnum.ToString());
            }

            result.DynamicMethod = matchingSubmitValues.SingleOrDefault();
            return(result);
        }
Beispiel #10
0
        public ActionResult CreativeExercise(string id)
        {
            DynamicOperation doper = new DynamicOperation();
            int index = 1;

            ViewBag.createlist = doper.GetCreateList(id, 12, out index);
            ViewBag.index      = index;
            int filesize = 0;

            ViewBag.listsize   = doper.GetCreatePageMax(12, out filesize);
            ViewBag.isPrevious = index == 1 ? false : true;
            ViewBag.isNext     = ViewBag.listsize == index ? false : true;
            ViewBag.size       = filesize;
            return(View());
        }
Beispiel #11
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            DynamicOperation ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <DynamicOperation>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <DynamicOperation>();

                ent.CreaterID   = UserInfo.UserID;
                ent.CreaterName = UserInfo.Name;
                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <DynamicOperation>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DynamicOperation.Find(id);
                }

                this.SetFormData(ent);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ents = DynamicOperationRule.FindAll(SearchCriterion);

            this.PageState.Add("DOperationList", ents);

            DynamicOperation ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Create:
                ent = this.GetPostedData <DynamicOperation>();
                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                ent = this.GetMergedData <DynamicOperation>();
                ent.DoUpdate();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <DynamicOperation>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                IList <object> idList = RequestData.GetList <object>("IdList");

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        DynamicOperationRule.BatchRemoveByPrimaryKeys(idList);
                    }
                }
                break;
            }
        }