예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(NCPEP.Model.T_FujianBiao model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_FujianBiao(");
            strSql.Append("fjname,fjpath,fid,fjlx,fjdynameid)");
            strSql.Append(" values (");
            strSql.Append("@fjname,@fjpath,@fid,@fjlx,@fjdynameid)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@fjname",     SqlDbType.VarChar,   50),
                new SqlParameter("@fjpath",     SqlDbType.NVarChar, 150),
                new SqlParameter("@fid",        SqlDbType.VarChar,   50),
                new SqlParameter("@fjlx",       SqlDbType.VarChar,   50),
                new SqlParameter("@fjdynameid", SqlDbType.VarChar, 150)
            };
            parameters[0].Value = model.fjname;
            parameters[1].Value = model.fjpath;
            parameters[2].Value = model.fid;
            parameters[3].Value = model.fjlx;
            parameters[4].Value = model.fjdynameid;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public NCPEP.Model.T_FujianBiao DataRowToModel(DataRow row)
 {
     NCPEP.Model.T_FujianBiao model = new NCPEP.Model.T_FujianBiao();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["fjname"] != null)
         {
             model.fjname = row["fjname"].ToString();
         }
         if (row["fjpath"] != null)
         {
             model.fjpath = row["fjpath"].ToString();
         }
         if (row["fid"] != null)
         {
             model.fid = row["fid"].ToString();
         }
         if (row["fjlx"] != null)
         {
             model.fjlx = row["fjlx"].ToString();
         }
         if (row["fjdynameid"] != null)
         {
             model.fjdynameid = row["fjdynameid"].ToString();
         }
     }
     return(model);
 }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(NCPEP.Model.T_FujianBiao model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_FujianBiao set ");
            strSql.Append("fjname=@fjname,");
            strSql.Append("fjpath=@fjpath,");
            strSql.Append("fid=@fid,");
            strSql.Append("fjlx=@fjlx,");
            strSql.Append("fjdynameid=@fjdynameid");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@fjname",     SqlDbType.VarChar,   50),
                new SqlParameter("@fjpath",     SqlDbType.NVarChar, 150),
                new SqlParameter("@fid",        SqlDbType.VarChar,   50),
                new SqlParameter("@fjlx",       SqlDbType.VarChar,   50),
                new SqlParameter("@fjdynameid", SqlDbType.VarChar,  150),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.fjname;
            parameters[1].Value = model.fjpath;
            parameters[2].Value = model.fid;
            parameters[3].Value = model.fjlx;
            parameters[4].Value = model.fjdynameid;
            parameters[5].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NCPEP.Model.T_FujianBiao GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,fjname,fjpath,fid,fjlx,fjdynameid from T_FujianBiao ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            NCPEP.Model.T_FujianBiao model = new NCPEP.Model.T_FujianBiao();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #5
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
                    {
                        NCPEP.Model.T_FujianBiao model = new NCPEP.Model.T_FujianBiao();

                        try { }
                        catch { }
                        try
                        {
                            model.fid = Request.QueryString["p"];
                        }
                        catch { }
                        model.fjdynameid = this.txtFK_UploadTypeIndicatorId.SelectedValue;
                        string strname = Guid.NewGuid().ToString("N") + System.IO.Path.GetExtension(FileUpload1.FileName);
                        string strpath = Server.MapPath("~/Super/Scan/bsrffujian/" + model.fid + "");
                        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.fjpath = strname;
                        model.fjname = adminUser.AdminName;
                        model.fjlx   = "4";//意向受让方申请附件
                        try
                        {
                            SysLogBll.Create("意向受让方申请附件", "增加标的意向受让方申请附件上传附件操作", adminUser.AdminName);
                            NCPEP.Bll.T_FujianBiao bll = new NCPEP.Bll.T_FujianBiao();

                            if (bll.Add(model) > 0)
                            {
                                MessageBox.Show(this, "上传成功。");
                                BindFujian(Request.QueryString["p"]);
                            }
                            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;
            }
        }
예제 #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(NCPEP.Model.T_FujianBiao model)
 {
     return(dal.Update(model));
 }
예제 #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(NCPEP.Model.T_FujianBiao model)
 {
     return(dal.Add(model));
 }