示例#1
0
        protected void fileuploadF_FileSelected(object sender, EventArgs e)
        {
            int    Fattachid = pm.UpLoadPhoto(fileuploadF);
            string path      = at.FindPath(Fattachid);

            switch (Fattachid)
            {
            case -1:
                Alert.ShowInTop("封面文件类型不符,请重新选择!");
                return;

            case 0:
                Alert.ShowInTop("封面文件名已经存在!");
                return;

            case -2:
                Alert.ShowInTop("封面文件不能大于150M");
                return;
            }
            if (Fattachid != -3)
            {
                Session["FAttachmentID"] = Fattachid;
            }
            else
            {
                Session["FAttachmentID"] = null;
            }
            Image_showF.ImageUrl = path;
        }
示例#2
0
        protected void photoupload_FileSelected(object sender, EventArgs e)

        {
            int AttachID = publicmethod.UpLoadPhoto(photoupload);

            switch (AttachID)
            {
            case -1:
                Alert.ShowInTop("照片类型不符,请重新选择!");
                return;

            case 0:
                Alert.ShowInTop("文件名已经存在!");
                return;

            case -2:
                Alert.ShowInTop("照片不能大于150M");
                return;

            case -3:
                Session["AttachID"] = null;
                break;

            //Alert.ShowInTop("请上传附件");
            //return;
            default:
            {
                Session["AttachID"] = AttachID;
                BLHelper.BLLAttachment att = new BLHelper.BLLAttachment();
                Image_show.ImageUrl = att.FindPath(AttachID);
                break;
            }
            }
        }
示例#3
0
        //保存增加会议信息
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                NewcademicMeeting = ObjectAcademicMeeting();
                if (Session["LoginName"].ToString() == "")
                {
                    Response.Redirect("login.aspx");
                    Alert.Show("登录超时!");
                }
                string MeetingName = txtMeetingName.Text;
                int    MeetingID   = BLLAM.FindMeetingID(MeetingName);
                if (MeetingID != 0)
                {
                    //txtMeetingName.Text = "";
                    txtMeetingName.Reset();
                    Alert.ShowInTop("该学术会议名称已存在,请重新输入!");
                    return;
                }
                if (DatePicker_EndTime != null)
                {
                    if (DatePicker_StratTime.SelectedDate > DatePicker_EndTime.SelectedDate)
                    {
                        Alert.ShowInTop("结束日期应该大于开始日期!");
                        return;
                    }
                }
                if (txtMeetingName.Text.Trim() == "")
                {
                    Alert.ShowInTop("会议名称不能为空!");
                    txtMeetingName.Reset();
                    return;
                }
                if (txtOrganizer.Text.Trim() == "")
                {
                    Alert.ShowInTop("主办方不能为空!");
                    txtOrganizer.Reset();
                    return;
                }
                if (txtMeetingPlace.Text.Trim() == "")
                {
                    Alert.ShowInTop("会议地点不能为空!");
                    txtMeetingPlace.Reset();
                    return;
                }
                //int attachId = publicMethod.UpLoad(filePath);
                //学术会议表对象
                //Common.Entities.AcademicMeeting NewcademicMeeting = ObjectAcademicMeeting();
                int AttachID = publicMethod.UpLoadFile(fileupload).Attachid;
                switch (AttachID)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

                case 0:
                    Alert.ShowInTop("文件名已经存在!");
                    return;

                case -2:
                    Alert.ShowInTop("文件不能大于150M");
                    return;

                case -3:
                    NewcademicMeeting.AttachmentID = null;
                    break;

                //Alert.ShowInTop("请上传附件");
                //return;
                default:
                    NewcademicMeeting.AttachmentID = AttachID;
                    break;
                }

                AttachID = publicMethod.UpLoadPhoto(photoupload);
                switch (AttachID)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

                case 0:
                    Alert.ShowInTop("文件名已经存在!");
                    return;

                case -2:
                    Alert.ShowInTop("文件不能大于150M");
                    return;

                case -3:
                    NewcademicMeeting.PhotoID = null;
                    break;

                //Alert.ShowInTop("请上传附件");
                //return;
                default:
                    NewcademicMeeting.PhotoID = AttachID;
                    break;
                }
                //向学术会议表插入信息
                BLLAM.Insert(NewcademicMeeting);
                //非管理员登陆需要向操作日志表中插入信息,等待管理员审核
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    //操作日志表对象
                    Common.Entities.OperationLog operationLog = InsertOperationLog();
                    operationLog.OperationDataID = NewcademicMeeting.AcademicMeetingID;
                    //向操作日志表中插入信息
                    BLLOL.Insert(operationLog);
                    Alert.ShowInTop("您的数据已提交,请等待确认");
                }
                else
                {
                    Alert.ShowInTop("保存成功");
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
            }
            catch (Exception ex)
            {
                int    AttactID = BLLAM.FindAttachmentID(NewcademicMeeting.AcademicMeetingID);
                string strPath;
                if (AttactID != 0)
                {
                    strPath = BLLattachment.FindPath(AttactID);
                    if (strPath != "")
                    {
                        //删除附件文件
                        publicMethod.DeleteFile(AttactID, strPath);
                        //在附件表中删除附件数据
                        BLLattachment.Delete(AttactID);
                    }
                }
                BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
                Alert.ShowInTop("保存失败!");
                // return;
            }
        }
示例#4
0
        //上传照片
        public void UploadPhotos()
        {
            try
            {
                int UserID = bllUser.FindByLoginName(Session["LoginName"].ToString(), Convert.ToInt32(Session["SecrecyLevel"])).FirstOrDefault().UserInfoID;
                Session["PhotoID"] = bllPhotos.FindPhotoID(UserID);
                if (bllPhotos.FindPhotoID(UserID) == 0)//判断是否有照片,是添加还是更新
                {
                    //先进行附件判断
                    int AttachID = pm.UpLoadPhoto(filePhoto);
                    switch (AttachID)
                    {
                    case 0:
                        Alert.ShowInTop("无效的文件类型!");
                        return;

                    case -1:
                        Alert.ShowInTop("文件名已经存在!");
                        return;

                    case -2:
                        Alert.ShowInTop("文件不能大于5M");
                        return;

                    case -3:
                        Alert.ShowInTop("没有选择照片!");
                        return;
                    }
                    photo.AttachmentID = AttachID;
                    photo.UserInfoID   = UserID;
                    photo.SecrecyLevel = Convert.ToInt32(Session["SecrecyLevel"]);
                    photo.EntryPerson  = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    if (Convert.ToInt32(Session["SecrecyLevel"]) < 5)
                    {
                        photo.IsPass = false;
                        bllPhotos.Insert(photo);//插入照片表
                        log.LoginName        = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                        log.OperationTime    = DateTime.Now;
                        log.LoginIP          = " ";
                        log.OperationType    = "添加";
                        log.OperationContent = "Photos";
                        log.OperationDataID  = photo.PhotosID;
                        log.Remark           = "";
                        bllOperate.Insert(log);//插入操作日志表
                        Alert.ShowInTop("照片已上传,等待管理员审核!");
                        filePhoto.Reset();
                    }
                    else
                    {
                        photo.IsPass = true;
                        bllPhotos.Insert(photo);//插入照片表
                        //显示照片
                        string FindPath = bllAttachment.FindPath(bllPhotos.FindAttachmentID(photo.PhotosID));
                        imgPhoto.ImageUrl = FindPath;
                        Alert.ShowInTop("照片上传成功!");
                        filePhoto.Reset();
                    }
                }
                else//更新
                {
                    //先进行附件判断
                    int AttachID = pm.UpLoadPhoto(filePhoto);
                    switch (AttachID)
                    {
                    case 0:
                        Alert.ShowInTop("无效的文件类型!");
                        return;

                    case -1:
                        Alert.ShowInTop("文件名已经存在!");
                        return;

                    case -2:
                        Alert.ShowInTop("文件不能大于5M");
                        return;

                    case -3:
                        Alert.ShowInTop("没有选择照片!");
                        return;
                    }
                    if (Convert.ToInt32(Session["SecrecyLevel"]) < 5)
                    {
                        //bllPhotos.UpdateIsPass(Convert.ToInt32(Session["PhotoID"]), false);//原照片状态为false
                        photo.AttachmentID = AttachID;
                        photo.UserInfoID   = UserID;
                        photo.SecrecyLevel = Convert.ToInt32(Session["SecrecyLevel"]);
                        photo.EntryPerson  = bllPhotos.find(Convert.ToInt32(Session["PhotoID"])).EntryPerson;
                        photo.IsPass       = false;
                        bllPhotos.Insert(photo);//插入照片表
                        log.LoginName        = bllPhotos.find(Convert.ToInt32(Session["PhotoID"])).EntryPerson;
                        log.OperationTime    = DateTime.Now;
                        log.LoginIP          = " ";
                        log.OperationType    = "更新";
                        log.OperationContent = "Photos";
                        log.OperationDataID  = Convert.ToInt32(Session["PhotoID"]); //原照片ID
                        log.Remark           = photo.PhotosID.ToString();
                        bllOperate.Insert(log);                                     //插入操作日志表
                        Alert.ShowInTop("照片已上传,等待管理员审核!");
                        filePhoto.Reset();
                    }
                    else
                    {
                        int    AttanchmentID = bllPhotos.FindAttachmentID(Convert.ToInt32(Session["PhotoID"]));
                        string path          = bllAttachment.FindPath(AttanchmentID);
                        pm.DeleteFile(AttanchmentID, path);
                        photo.PhotosID     = Convert.ToInt32(Session["PhotoID"]);
                        photo.AttachmentID = AttachID;
                        photo.UserInfoID   = bllUser.FindByLoginName(Session["LoginName"].ToString(), Convert.ToInt32(Session["SecrecyLevel"])).FirstOrDefault().UserInfoID;
                        photo.SecrecyLevel = Convert.ToInt32(Session["SecrecyLevel"]);
                        photo.EntryPerson  = Session["LoginName"].ToString();
                        photo.IsPass       = true;
                        bllPhotos.Update(photo);//更新照片表
                        //显示照片
                        string FindPath = bllAttachment.FindPath(bllPhotos.FindAttachmentID(photo.PhotosID));
                        imgPhoto.ImageUrl = FindPath;
                        Alert.ShowInTop("照片修改成功!");
                        filePhoto.Reset();
                    }
                }
            }
            catch (Exception ex)
            {
                pm.DeleteFile(Convert.ToInt32(photo.AttachmentID), bllAttachment.FindPath(Convert.ToInt32(photo.AttachmentID)));
                pm.SaveError(ex, this.Request);
            }
        }
示例#5
0
        //保存增加会议信息
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["LoginName"].ToString() == "")
                {
                    Response.Redirect("login.aspx");
                    Alert.Show("登录超时!");
                }
                if (DatePicker_EndTime != null)
                {
                    if (DatePicker_StratTime.SelectedDate > DatePicker_EndTime.SelectedDate)
                    {
                        Alert.ShowInTop("结束日期应该大于开始日期!");
                        return;
                    }
                }
                if (txtMeetingName.Text.Trim() == "")
                {
                    Alert.ShowInTop("会议名称不能为空!");
                    txtMeetingName.Reset();
                    return;
                }
                if (txtOrganizer.Text.Trim() == "")
                {
                    Alert.ShowInTop("主办方不能为空!");
                    txtOrganizer.Reset();
                    return;
                }
                if (txtMeetingPlace.Text.Trim() == "")
                {
                    Alert.ShowInTop("会议地点不能为空!");
                    txtMeetingPlace.Reset();
                    return;
                }
                int    AttachmentID   = BLLAM.FindAttachmentID(Convert.ToInt32(Session["AcademicMeetingID"]));
                int    PhotoID        = BLLAM.FindPhotoID(Convert.ToInt32(Session["AcademicMeetingID"]));
                string attachmentPath = BLLattachment.FindPath(AttachmentID);
                string photoPath      = BLLattachment.FindPath(PhotoID);
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    UpdateValue();
                    int Attachment = publicMethod.UpLoadFile(fileupload).Attachid;
                    if (Attachment != -3)
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

                        case 0:
                            Alert.ShowInTop("文件名已经存在!");
                            return;

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        academicMeeting.AttachmentID = Attachment;
                        publicMethod.DeleteFile(AttachmentID, attachmentPath);
                    }
                    else
                    {
                        if (AttachmentID != 0)
                        {
                            academicMeeting.AttachmentID = AttachmentID;
                        }
                    }

                    Attachment = publicMethod.UpLoadPhoto(photoupload);
                    if (Attachment != -3)
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

                        case 0:
                            Alert.ShowInTop("文件名已经存在!");
                            return;

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        academicMeeting.PhotoID = Attachment;
                        publicMethod.DeleteFile(PhotoID, photoPath);
                    }
                    else
                    {
                        if (PhotoID != 0)
                        {
                            academicMeeting.PhotoID = PhotoID;
                        }
                    }
                    academicMeeting.IsPass            = true;
                    academicMeeting.AcademicMeetingID = Convert.ToInt32(Session["AcademicMeetingID"]);
                    BLLAM.Update(academicMeeting);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else
                {
                    UpdateValue();
                    int Attachment = publicMethod.UpLoadFile(fileupload).Attachid;
                    if (Attachment != -3)
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

                        case 0:
                            Alert.ShowInTop("文件名已经存在!");
                            return;

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        academicMeeting.AttachmentID = Attachment;
                    }
                    else
                    {
                        if (AttachmentID != 0)
                        {
                            academicMeeting.AttachmentID = AttachmentID;
                        }
                    }

                    Attachment = publicMethod.UpLoadPhoto(photoupload);
                    if (Attachment != -3)
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

                        case 0:
                            Alert.ShowInTop("文件名已经存在!");
                            return;

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        academicMeeting.PhotoID = Attachment;
                    }
                    else
                    {
                        if (PhotoID != 0)
                        {
                            academicMeeting.PhotoID = PhotoID;
                        }
                    }

                    academicMeeting.IsPass = false;
                    BLLAM.Insert(academicMeeting);
                    BLLAM.UpdateIsPass(Convert.ToInt32(Session["AcademicMeetingID"]), false);
                    log.LoginIP          = "";
                    log.LoginName        = Session["LoginName"].ToString();
                    log.OperationContent = "AcademicMeeting";
                    log.OperationTime    = DateTime.Now;
                    log.OperationType    = "更新";
                    log.OperationDataID  = Convert.ToInt32(Session["AcademicMeetingID"]);
                    log.Remark           = academicMeeting.AcademicMeetingID.ToString();
                    BLLOL.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(academicMeeting.AttachmentID);
                string path     = BLLattachment.FindPath(attachid);
                publicMethod.DeleteFile(attachid, path);
                publicMethod.SaveError(ex, this.Request);
            }
        }