public bool DeleteThesisInfo(int id)
        {
            bool       ret        = false;
            ThesisInfo thesisInfo = DBThesis.ThesisInfo.FirstOrDefault(f => f.Id == id);

            if (thesisInfo != null)
            {
                String thesisFilelName     = AppDomain.CurrentDomain.BaseDirectory + AppSetting.GetFileUploadPath + thesisInfo.ThesisFilelName;
                String checkReportFileName = AppDomain.CurrentDomain.BaseDirectory + AppSetting.GetFileUploadPath + thesisInfo.CheckReportFileName;
                if (File.Exists(thesisFilelName))
                {
                    File.Delete(thesisFilelName);
                }
                if (File.Exists(checkReportFileName))
                {
                    File.Delete(checkReportFileName);
                }
                DBThesis.ThesisInfo.Remove(thesisInfo);
                if (DBThesis.SaveChanges() > 0)
                {
                    ret = true;
                }
            }

            return(ret);
        }
        public bool save(NameValueCollection nvParams, out string msg)
        {
            msg = "";
            bool result = false;

            try
            {
                String    fileName     = nvParams["fileName"];
                String    fileName1    = nvParams["fileName1"];
                String    UserName     = nvParams["txtUserName"];
                int       specId       = int.Parse(nvParams["selSpec"]);
                Specialty specialty    = DBThesis.Specialty.FirstOrDefault(f => f.Id == specId);
                String    TicketNumber = nvParams["txtTicketNumber"];

                if (DBThesis.ThesisInfo.Count(c => c.TicketNumber.Equals(TicketNumber)) > 0)
                {
                    msg    = "该准考证号已经上传完成论文,如果需要重新上传论文,请联系统管理员处理无效数据!";
                    result = false;
                }
                else
                {
                    //论文
                    String newThesisName     = UserName + "_" + specialty.Name + "_" + TicketNumber + "_论文";
                    String newThesisFileName = newThesisName + Path.GetExtension(fileName);
                    String oldThesisFileName = fileName;
                    //查重报告

                    String newCheckReportName     = UserName + "_" + specialty.Name + "_" + TicketNumber + "_查重报告";
                    String newCheckReportFileName = newCheckReportName + Path.GetExtension(fileName1);
                    String oldCheckReportFileName = fileName1;

                    ThesisInfo thesisInfo = new ThesisInfo()
                    {
                        UserName            = UserName,
                        Specialty           = specialty.Name,
                        TicketNumber        = TicketNumber,
                        Phone               = nvParams["txtPhone"],
                        CreateDate          = DateTime.Now,
                        IsDelete            = 0,
                        ThesisName          = newThesisName,
                        ThesisFilelName     = newThesisFileName,
                        CheckReportName     = newCheckReportName,
                        CheckReportFileName = newCheckReportFileName,
                    };
                    DBThesis.ThesisInfo.Add(thesisInfo);

                    SaveFile(newCheckReportFileName, oldCheckReportFileName, AppSetting.GetFileUploadTempPath, AppSetting.GetFileUploadPath);
                    SaveFile(newThesisFileName, oldThesisFileName, AppSetting.GetFileUploadTempPath, AppSetting.GetFileUploadPath);
                    DBThesis.SaveChanges();
                    result = true;
                }
            }
            catch (Exception e)
            {
                log.WriteLog(e.Message, e, CommonLoggerLevel.Error);
            }
            return(result);
        }
        public bool DeleteSpecialInfo(int id)
        {
            bool      ret       = false;;
            Specialty specialty = DBThesis.Specialty.FirstOrDefault(f => f.Id == id);

            DBThesis.Specialty.Remove(specialty);
            if (DBThesis.SaveChanges() > 0)
            {
                ret = true;
            }
            return(ret);
        }
        public bool EditSpecialInfo(int id, String name)
        {
            bool      ret       = false;;
            Specialty specialty = null;

            if (id > 0)
            {
                specialty      = DBThesis.Specialty.FirstOrDefault(f => f.Id == id);
                specialty.Name = name;
            }
            else
            {
                specialty      = new Specialty();
                specialty.Name = name;
                DBThesis.Specialty.Add(specialty);
            }
            if (DBThesis.SaveChanges() > 0)
            {
                ret = true;
            }
            return(ret);
        }