예제 #1
0
 //
 public dynamic GetModel(int id)
 {
     try
     {
         dynamic model  = null;
         string  strSql = string.Format(" select Id,FK_LiceTranId,FK_UploadTypeIndicatorId,ScanUrl,UploadName,UploadDate from T_LiceTranScan  where Id = {0}", id);
         using (dynamic read = DbHelperSQL.ExecuteReader(strSql))
         {
             if (read.Read())
             {
                 model = new LiceTranScan();
                 try { model.Id = int.Parse(read["Id"].ToString()); }
                 catch { }
                 model.FK_LiceTranId            = int.Parse(read["FK_LiceTranId"].ToString());
                 model.FK_UploadTypeIndicatorId = int.Parse(read["FK_UploadTypeIndicatorId"].ToString());
                 model.ScanUrl    = read["ScanUrl"].ToString();
                 model.UploadName = read["UploadName"].ToString();
                 model.UploadDate = DateTime.Parse(read["UploadDate"].ToString());
             }
             read.Dispose();
         }
         return(model);
     }
     catch { throw; }
 }
예제 #2
0
 //
 private dynamic Delete(HttpContext context)
 {
     try
     {
         SysLogBll.Create("出让/受让方上传附件", "删除出让/受让方上传附件操作", adminUser.AdminName);
         int Id = 0;
         try { Id = int.Parse(context.Request.QueryString["Id"].ToString()); }
         catch { }
         if (dal.Exists(Id))
         {
             LiceTranScan obj = dal.GetModel(Id);
             if (dal.Delete(Id))
             {
                 Component.DeleteImg("~/Super/Scan/lt/" + obj.FK_LiceTranId + "/" + obj.ScanUrl);
                 return("删除成功!");
             }
             else
             {
                 return("删除失败请重新操作! ");
             }
         }
         else
         {
             return("数据已经开始受理中无法删除操作!");
         }
     }
     catch (Exception ex)
     {
         SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]");
         return("删除失败请重新操作,错误代码:500 ");
     }
 }
예제 #3
0
        //
        private dynamic GetModels(HttpContext context)
        {
            LiceTranScan model = new LiceTranScan();

            try { model.Id = int.Parse(context.Request.Form["Id"].ToString()); }
            catch { }
            model.FK_LiceTranId            = int.Parse(context.Request.Form["FK_LiceTranId"].ToString());
            model.FK_UploadTypeIndicatorId = int.Parse(context.Request.Form["FK_UploadTypeIndicatorId"].ToString());
            string ImgName = new UpLoadImgPlug().UploadImg("~/Super/Scan/lt/" + model.FK_LiceTranId + "/", 0);
            string imgUrl  = HttpContext.Current.Server.MapPath("~/Super/Scan/lt/" + model.FK_LiceTranId + "/" + ImgName);
            string pdfUrl  = "~/Super/Scan/lt/" + model.FK_LiceTranId + "/";

            new ProducePdfPlug().CreatePdf(imgUrl, pdfUrl, ImgName.Split('.')[0] + ".pdf");
            model.ScanUrl    = ImgName.Split('.')[0] + ".pdf";
            model.UploadName = UserName;
            model.UploadDate = DateTime.Now;
            return(model);
        }
예제 #4
0
 //
 private SqlParameter[] GetSqlParameter(LiceTranScan model)
 {
     SqlParameter[] parameters =
     {
         new SqlParameter("@FK_LiceTranId",            SqlDbType.Int,         4),
         new SqlParameter("@FK_UploadTypeIndicatorId", SqlDbType.Int,         4),
         new SqlParameter("@ScanUrl",                  SqlDbType.NVarChar,  100),
         new SqlParameter("@UploadName",               SqlDbType.NVarChar,  100),
         new SqlParameter("@UploadDate",               SqlDbType.DateTime),
         new SqlParameter("@Id",                       SqlDbType.Int, 4)
     };
     parameters[0].Value = model.FK_LiceTranId;
     parameters[1].Value = model.FK_UploadTypeIndicatorId;
     parameters[2].Value = model.ScanUrl;
     parameters[3].Value = model.UploadName;
     parameters[4].Value = model.UploadDate;
     parameters[5].Value = model.Id;
     return(parameters);
 }
예제 #5
0
 //
 public bool Create(LiceTranScan model)
 {
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("insert into T_LiceTranScan(");
         strSql.Append("FK_LiceTranId,FK_UploadTypeIndicatorId,ScanUrl,UploadName,UploadDate)");
         strSql.Append(" values (");
         strSql.Append("@FK_LiceTranId,@FK_UploadTypeIndicatorId,@ScanUrl,@UploadName,@UploadDate)");
         if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch { throw; }
 }
예제 #6
0
 //
 public bool Update(LiceTranScan model)
 {
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("update T_LiceTranScan set ");
         strSql.Append("FK_LiceTranId=@FK_LiceTranId,");
         strSql.Append("FK_UploadTypeIndicatorId=@FK_UploadTypeIndicatorId,");
         strSql.Append("ScanUrl=@ScanUrl,");
         strSql.Append("UploadName=@UploadName,");
         strSql.Append("UploadDate=@UploadDate");
         strSql.Append(" where Id=@Id");
         if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch { throw; }
 }
예제 #7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            AdminUser adminUser = Session["SuperAdminUserSession"] as AdminUser;

            if (this.FileUpload1.HasFile)
            {
                string strtype = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();//ToLower转化为小写
                if (strtype == ".jpg" || strtype == ".gif" || strtype == ".jpeg" || strtype == ".png" || strtype == ".pdf")
                {
                    //获得上传文件的大小

                    int filesize = FileUpload1.PostedFile.ContentLength;

                    if (filesize > 1024 * 1024 * 25)
                    {
                        MessageBox.Show(this, "你上传的文件太大!");
                        return;
                    }
                    else
                    {
                        LiceTranScan model = new LiceTranScan();
                        try {  }
                        catch { }
                        try
                        {
                            model.FK_LiceTranId = int.Parse(Request.QueryString["p"]);
                        }
                        catch { }
                        model.FK_UploadTypeIndicatorId = int.Parse(this.txtFK_UploadTypeIndicatorId.SelectedValue);
                        string strname = Guid.NewGuid().ToString("N") + System.IO.Path.GetExtension(FileUpload1.FileName);
                        string strpath = Server.MapPath("~/Super/Scan/lt/" + model.FK_LiceTranId + "");
                        if (!System.IO.Directory.Exists(strpath))
                        {
                            System.IO.Directory.CreateDirectory(strpath);
                        }
                        FileUpload1.SaveAs(strpath + "/" + strname);
                        //string ImgName = new UpLoadImgPlug().UploadImg("~/Super/Scan/lt/" + model.FK_LiceTranId + "/", 0);
                        //string imgUrl = HttpContext.Current.Server.MapPath("~/Super/Scan/lt/" + model.FK_LiceTranId + "/" + ImgName);
                        //string pdfUrl = "~/Super/Scan/lt/" + model.FK_LiceTranId + "/";
                        //new ProducePdfPlug().CreatePdf(imgUrl, pdfUrl, ImgName.Split('.')[0] + ".pdf");
                        model.ScanUrl    = strname;
                        model.UploadName = adminUser.AdminName;
                        model.UploadDate = DateTime.Now;
                        try
                        {
                            SysLogBll.Create("出让/受让方上传附件", "增加出让/受让方上传附件操作", adminUser.AdminName);
                            LiceTranScanDal dal = new LiceTranScanDal();
                            if (dal.Create(model))
                            {
                                MessageBox.Show(this, "上传成功。");
                            }
                            else
                            {
                                MessageBox.Show(this, "上传失败,请重新操作! ");
                            }
                        }
                        catch (Exception ex)
                        {
                            SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]");
                            MessageBox.Show(this, "添加失败请重新操作,错误代码:500 ");
                        }
                    }
                }
                else
                {
                    MessageBox.Show(this, "上传的附件格式后缀名只能为.jpg,.gif,.jpeg,.png,.pdf,其他格式暂不允许上传");
                    return;
                }
            }
            else
            {
                MessageBox.Show(this, "请选择附件进行上传");
                return;
            }
        }