예제 #1
0
 /// <summary>
 /// 上传图片
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btn_upload_Click(object sender, EventArgs e)
 {
     if (file_link_logo.FileName != string.Empty)
     {
         FileOperate.FolderCreate(Server.MapPath("~/upload/adlink/"));
         string filename      = Path.GetFileNameWithoutExtension(file_link_logo.FileName); //文件名
         string fileExtension = Path.GetExtension(file_link_logo.FileName);                //扩展名
         //上传图片
         file_link_logo.SaveAs(Server.MapPath("~/upload/adlink/") + filename + fileExtension);
         txt_link_logo.Value = "upload/adlink/" + filename + fileExtension;
     }
 }
예제 #2
0
        protected void btn_upload_Click(object sender, EventArgs e)
        {
            string ReturnID = Request.QueryString["cid"];//图片地址返回的ID

            if (File_ImgLink.Value != "")
            {
                //string filename = Path.GetFileName(File_ImgLink.Value);
                string filename = string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + new Random().Next(10, 100);
                filename = filename + Path.GetExtension(File_ImgLink.Value);
                //不存在文件夹则自动创建
                string filepath = Server.MapPath("~/upload/images/");
                FileOperate.FolderCreate(filepath);
                File_ImgLink.PostedFile.SaveAs(filepath + filename);
                string img = "upload/images/" + filename;
                Response.Write("<script>parent.document.getElementById(\"" + ReturnID + "\").value = \"" + img + "\";</script>");
            }
        }
        /// <summary>
        /// 发布或保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.txtTitle.Text.Trim() == "")
            {
                JscriptMsg("资讯标题不能为空!", "", "Error");
                return;
            }
            if (this.txtTitle.Text.Trim().Length > 100)
            {
                JscriptMsg("资讯标题超过100字!", "", "Error");
                return;
            }
            if (Tools.CheckParams(this.txtTitle.Text.Trim()))
            {
                JscriptMsg("资讯标题含有非法字符!", "", "Error");
                return;
            }

            //创建文件夹
            FileOperate.FolderCreate(Utils.GetMapPath(DataDic.News_Attach_Path));

            if (action == MyEnums.ActionEnum.Edit.ToString()) //修改
            {
                if (!DoEdit(this.newsId))
                {
                    JscriptMsg("保存过程中发生错误啦!", "", "Error");
                    return;
                }
                String reStr   = "资讯修改成功!";
                string pageUrl = "News_list_manager.aspx?fun_id=" + get_fun_id("CCOM/notification/News_list_manager.aspx");
                JscriptMsg(reStr, pageUrl, "Success");
            }
            else //添加
            {
                Int32 newsId = DoAdd();
                if (newsId < 1)
                {
                    JscriptMsg("保存过程中发生错误啦!", "", "Error");
                    return;
                }
                String reStr   = "资讯发布成功!";
                string pageUrl = "News_list_manager.aspx?fun_id=" + get_fun_id("CCOM/notification/News_list_manager.aspx");
                JscriptMsg(reStr, pageUrl, "Success");
            }
        }
        private bool DoUpdateUserInfo(long _id)
        {
            BLL.CCOM.User_property   user_bll   = new BLL.CCOM.User_property();
            Model.CCOM.User_property user_model = user_bll.GetModel(_id);

            bool result = false;

            //国籍
            user_model.UP_nation = Convert.ToInt32(this.ddl_UP_nation.SelectedValue);

            //民族
            user_model.UP_nationality = Convert.ToInt32(this.ddl_UP_nationality.SelectedValue);

            //政治面貌
            user_model.UP_politics = Convert.ToInt32(this.ddl_UP_politics.SelectedValue);

            //文化程度
            user_model.UP_degree = Convert.ToInt32(this.ddl_UP_degree.SelectedValue);

            //高中毕业院校
            user_model.UP_high_school = this.txt_UP_high_school.Text;

            //高考报名号
            user_model.UP_CEE_number = this.txt_UP_CEE_number.Text;

            //省艺术联考考生号
            user_model.UP_AEE_number = this.txt_UP_AEE_number.Text;

            //专业考试期间移动电话
            user_model.UP_PE_Iphone = this.txt_UP_PE_Iphone.Text;

            //常规移动电话
            user_model.UP_PE_Aphone = this.txt_UP_PE_Aphone.Text;

            //高考所在地
            user_model.UP_province = Convert.ToInt32(this.ddl_UP_province.SelectedValue);

            //录取通知书地址
            user_model.UP_address = this.txt_UP_address.Text;

            //收件人
            user_model.UP_receiver = this.txt_UP_receiver.Text;

            //收件人电话
            this.txt_UP_receiver_phone.Text = user_model.UP_receiver_phone;

            //邮编
            user_model.UP_postal_code = this.txt_UP_postal_code.Text;

            //复印件证件图片
            if (this.txt_UP_ID_picture.Text != "")
            {
                user_model.UP_ID_picture = Utils.Filter(this.txt_UP_ID_picture.Text.Trim());
            }


            if (!String.IsNullOrEmpty(user_model.UP_ID_picture))
            {
                //创建文件夹
                FileOperate.FolderCreate(Utils.GetMapPath(DataDic.UP_ID_picture_Path));


                //图片处理
                String toFilePath = DataDic.UP_ID_picture_Path + DateTime.Now.Ticks.ToString() +
                                    FileOperate.GetPostfixStr(user_model.UP_ID_picture);
                FileOperate.FileMove(Server.MapPath(user_model.UP_ID_picture),
                                     Server.MapPath(toFilePath));
                user_model.UP_ID_picture = toFilePath;
            }

            //上传近期免冠照片
            if (this.txt_UP_picture.Text != "")
            {
                user_model.UP_picture = Utils.Filter(this.txt_UP_picture.Text.Trim());
            }


            if (!String.IsNullOrEmpty(user_model.UP_picture))
            {
                //创建文件夹
                FileOperate.FolderCreate(Utils.GetMapPath(DataDic.UP_picture_Path));

                //图片处理
                String toFilePath = DataDic.UP_picture_Path + DateTime.Now.Ticks.ToString() +
                                    FileOperate.GetPostfixStr(user_model.UP_picture);
                FileOperate.FileMove(Server.MapPath(user_model.UP_picture),
                                     Server.MapPath(toFilePath));
                user_model.UP_picture = toFilePath;
            }

            //上传省联考合格证
            if (this.txt_UP_AEE_picture.Text != "")
            {
                user_model.UP_AEE_picture = Utils.Filter(this.txt_UP_AEE_picture.Text.Trim());
            }


            if (!String.IsNullOrEmpty(user_model.UP_AEE_picture))
            {
                //创建文件夹
                FileOperate.FolderCreate(Utils.GetMapPath(DataDic.UP_AEE_picture_Path));

                //图片处理
                String toFilePath = DataDic.UP_AEE_picture_Path + DateTime.Now.Ticks.ToString() +
                                    FileOperate.GetPostfixStr(user_model.UP_AEE_picture);
                FileOperate.FileMove(Server.MapPath(user_model.UP_AEE_picture),
                                     Server.MapPath(toFilePath));
                user_model.UP_AEE_picture = toFilePath;
            }



            //更新的状态
            try
            {
                bool res = user_bll.Update(user_model);
                if (res == true)
                {
                    return(res);
                }
            }
            catch
            {
                result = false;
            }
            return(result);
        }