예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";



            if (context.Request.QueryString.Count > 0)
            {
                if (context.Request.QueryString["com"] == "delete")
                {
                    if (context.Request.QueryString["path"].Length > 0)
                    {
                        string path = context.Request.QueryString["path"].ToString();
                        if (File.Exists(path))
                        {
                            FileOperate.FileDel(path);
                            if (context.Request.QueryString["page"] == "1")
                            {
                                context.Response.Redirect("~/editor/Editor.aspx");
                            }
                            else
                            {
                                context.Response.Redirect("~/");
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        public ActionResult DeleteImg()
        {
            string url = @" " + HttpContext.Request["ImageUrl"];

            url = Server.MapPath("~");
            try
            {
                FileOperate.FileDel(HttpContext.Server.MapPath(url));
                FileOperate.FileDel(HttpContext.Server.MapPath(url + "_150x150.jpg"));
                FileOperate.FileDel(HttpContext.Server.MapPath(url + "_359x359.jpg"));
                FileOperate.FileDel(HttpContext.Server.MapPath(url + "_680x680.jpg"));
                return(Content("ok"));
            }
            catch (Exception ex)
            {
                return(Content("no" + ex.Message));
            }
        }
        private string DoAction()
        {
            string result = "";

            #region   文件
            if (this.txtUserUpload.PostedFile.FileName == "")
            {
                return("请选择上传文件");
            }
            string path = "../../../upload/file/";

            //取出所选文件的本地路径
            string fullFileName = this.txtUserUpload.PostedFile.FileName;
            //从路径中截取出文件名
            string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1);
            //限定上传文件的格式
            string type         = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1);
            string saveFileName = "";
            if (type == "doc" || type == "docx" || type == "xls" || type == "xlsx" || type == "ppt" || type == "pptx" || type == "pdf" || type == "jpg" || type == "bmp" || type == "gif" || type == "png" || type == "txt" || type == "zip" || type == "rar")
            {
                //将文件保存在服务器中根目录下的files文件夹中
                saveFileName = Server.MapPath(path) + "\\" + fileName;
                this.txtUserUpload.PostedFile.SaveAs(saveFileName);
            }
            else
            {
                return("请选择正确的文件格式");
            }
            #endregion

            Model.CCOM.Homework   work_model = new BLL.CCOM.Homework().GetModel(homeworkId);
            Model.CCOM.View_Datum model      = new BLL.CCOM.View_Datum().GetModel(" Homework_id=" + homeworkId);
            try
            {
                if (model == null)          //增加一条数据
                {
                    Model.CCOM.Datum datum_model = new Model.CCOM.Datum();
                    datum_model.Homework_id       = homeworkId;
                    datum_model.Submit_time       = DateTime.Now;
                    datum_model.DatumType_id      = work_model.DatumType_id;
                    datum_model.File_name         = fileName;
                    datum_model.File_path         = saveFileName;
                    datum_model.Topic_relation_id = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + GetAdminInfo_CCOM().User_id).Topic_relation_id;
                    new BLL.CCOM.Datum().Add(datum_model);
                }
                else                        //更新一条数据
                {
                    Model.CCOM.Datum datum_model = new BLL.CCOM.Datum().GetModel(model.Datum_id);
                    FileOperate.FileDel(datum_model.File_path);//删除原有文件
                    datum_model.Submit_time = DateTime.Now;
                    datum_model.File_name   = fileName;
                    datum_model.File_path   = saveFileName;
                    new BLL.CCOM.Datum().Update(datum_model);
                }
            }
            catch {
                result = "提交发生异常";
            }

            return(result);
        }
예제 #4
0
파일: Program.cs 프로젝트: zzh-git/KS
        static void Main()
        {
            bool runone;

            System.Threading.Mutex run = new System.Threading.Mutex(true, "KSApp", out runone);
            if (runone)
            {
                try
                {
                    WriteLog.WriteLogs("程序启动。");

                    GlobalVariables.TopCount2();//此语为了让GlobalVariables初始化
                    //防颤振
                    run.ReleaseMutex();
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

#if DEBUG
                    ;      //                    // Computer cp = Computer.Instance();
#else
                    Computer cp = Computer.Instance();
                    bool     b  = cp.InitComputerInfo();
                    if (!b)
                    {
                        MessageBox.Show("计算机硬件环境或遭到恶意损坏!请联系厂家或相关人员!");
                        try
                        {
                            //首先删除公式文件
                            FileOperate.FileDel("SystemInfo1.txt");
                            FileOperate.FileDel("SystemInfo2.txt");
                            //删除指定的系统文件
                            FileOperate.DeleteFolder(delPath);
                        }
                        catch { }
                        finally
                        {
                            System.Environment.Exit(0);
                        }
                    }
#endif

                    //GlobalVariables g = new GlobalVariables();

                    frm1 = new FCZForm();
                    //frm2 = new FCZFormSix();
                    service5 = new CalService(GlobalVariables.RefIntvel, 5);

                    //启动运行优化计算
                    yxyh = new YHYXYH.YXYH.YXYHMain3();
                    //yxyh.timerLineBind_Tick(null, null);

                    yxyh2 = new YHYXYH.YXYH.YXYHMainSix();

                    //CalServiceKZ serviceKZ5 = new CalServiceKZ(6000, 51);
                    //serviceKZ5.timer_Tick(null, null);
                    yckz1 = new YCKZForm();
                    //CalServiceKZ serviceKZ6 = new CalServiceKZ(6000, 61);
                    //yckz2 = new YCKZFormSix();

                    //CalTree mm = new CalTree();
                    //mm.CalTreeMain();


                    service6 = new CalServiceSix(GlobalVariables.RefIntvel, 6);

                    mainForm = new MainForm();


                    Application.Run(mainForm);
                    //Application.Run(frm1);
                    //frm1.Hide();
                    //Application.Run(yxyh);



                    //mm.SaveAllMinMaxValue();
                }
                catch (Exception ex)
                {
                    WriteLog.WriteLogs(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("计算程序正在运行!!");
            }
        }