Esempio n. 1
0
        //保存通知公告信息
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (txtHeadLine.Text.Trim() == "")
            {
                Alert.ShowInTop("标题不能为空!");
                txtHeadLine.Reset();
                return;
            }

            NewAnnouncement.HeadLine             = txtHeadLine.Text;
            NewAnnouncement.AnnouncementSortName = DropDownList_Sort.SelectedItem.Text;
            NewAnnouncement.Time         = DatePicker_Time.SelectedDate;
            NewAnnouncement.SourceAgency = txtSourceAgency.Text;
            //NewAnnouncement.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedText);
            NewAnnouncement.SecrecyLevel = 1;
            NewAnnouncement.EntryPerson  = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
            NewAnnouncement.IsPass       = true;
            int AttachID = pm.UpLoadFile(fileupload).Attachid;

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

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

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

            case -3:
                Alert.ShowInTop("请上传附件");
                return;

            default:
                NewAnnouncement.AttachmentID = AttachID;
                break;
            }
            BLLAnnouncement.Insert(NewAnnouncement);
            Alert.ShowInTop("通知公告信息添加成功!");
            PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
        }
Esempio n. 2
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tAchievementName.Text.Trim() == "")
                {
                    Alert.Show("成果名称不能为空!");
                    return;
                }
                if (tAppraisalUnit.Text.Trim() == "")
                {
                    Alert.Show("鉴定组织部门不能为空!");
                    return;
                }
                if (tApRemarkRank.Text.Trim() == "")
                {
                    Alert.Show("鉴定评语级别不能为空!");
                    return;
                }
                if (tApprovalNum.Text.Trim() == "")
                {
                    Alert.Show("鉴定批文号不能为空!");
                    return;
                }
                if (ProjectInNum.Text.Trim() == "")
                {
                    Alert.Show("项目内部编号不能为空!");
                    return;
                }
                if (ProjectPeople.Text.Trim() == "")
                {
                    Alert.Show("成员不能为空!");
                    return;
                }
                if (FirstFinishedPeople.Text.Trim() == "")
                {
                    Alert.Show("成果第一完成人不能为空!");
                    return;
                }
                BLHelper.BLLAgency agency = new BLHelper.BLLAgency();
                achs.AchievementName     = tAchievementName.Text.Trim();
                achs.AgencyID            = agency.SelectAgencyID(DropDownListAgency.SelectedText.Trim());
                achs.ProjectName         = tProjectID.Text.Trim();
                achs.AppraisalTime       = dAppraisalTime.SelectedDate;
                achs.AppraisalUnit       = tAppraisalUnit.Text.Trim();
                achs.ApRemarkRank        = tApRemarkRank.Text.Trim();
                achs.ApprovalNum         = tApprovalNum.Text.Trim();
                achs.ProjectInNum        = ProjectInNum.Text.Trim();        //项目分类编号
                achs.ProjectPeople       = ProjectPeople.Text.Trim();       //成员
                achs.FirstFinishedPeople = FirstFinishedPeople.Text.Trim(); //成果第一完成人
                // achs.ProjectRank = DropDownListProjectRank.SelectedText;//鉴定级别
                achs.ProjectLevel = DropDownListProjectLevel.SelectedText;  //鉴定水平
                achs.ProjectForm  = DropDownListProjectForm.SelectedText;   //鉴定形式
                achs.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1);
                achs.EntryPerson  = achieve.Findmodel(Convert.ToInt32(Session["AchievementID"])).EntryPerson;
                int AttachmentID = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"]));
                int OpinionPage  = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"]));
                int MemberPage   = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"]));
                int SealPage     = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"]));
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级
                {
                    achs.IsPass        = true;
                    achs.AchievementID = Convert.ToInt32(Session["AchievementID"]);
                    string path     = at.FindPath(AttachmentID);
                    int    attachid = pm.UpLoadFile(fileupload).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.AttachmentID = attachid; //成果表的附件为新插入的附件ID
                        achieve.Update(achs);         //更新
                        pm.DeleteFile(AttachmentID, path);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    else //上传空间没有值
                    {
                        if (AttachmentID != 0)
                        {
                            achs.AttachmentID = AttachmentID;
                        }
                        achieve.Update(achs);//更新成果表
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    string path1   = at.FindPath(OpinionPage);
                    int    opinion = pm.UpLoadFile(OpinionPage1).Attachid;
                    if (opinion != -3)//上传控件是否有值
                    {
                        switch (opinion)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.OpinionPage = opinion;
                        achieve.Update(achs);//更新
                        pm.DeleteFile(OpinionPage, path1);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    else //上传空间没有值
                    {
                        if (OpinionPage != 0)
                        {
                            achs.OpinionPage = OpinionPage;
                        }
                        achieve.Update(achs);//更新成果表
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    string path2  = at.FindPath(MemberPage);
                    int    member = pm.UpLoadFile(MemberPage1).Attachid;
                    if (member != -3)//上传控件是否有值
                    {
                        switch (member)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.MemberPage = member; //成果表的附件为新插入的附件ID
                        achieve.Update(achs);     //更新
                        pm.DeleteFile(MemberPage, path2);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    else //上传空间没有值
                    {
                        if (MemberPage != 0)
                        {
                            achs.MemberPage = MemberPage;
                        }
                        achieve.Update(achs);//更新成果表
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    string path3 = at.FindPath(SealPage);
                    int    seal  = pm.UpLoadFile(SealPage1).Attachid;
                    if (seal != -3)//上传控件是否有值
                    {
                        switch (seal)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.SealPage = seal; //成果表的附件为新插入的附件ID
                        achieve.Update(achs); //更新
                        pm.DeleteFile(SealPage, path3);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    else //上传空间没有值
                    {
                        if (SealPage != 0)
                        {
                            achs.SealPage = SealPage;
                        }
                        achieve.Update(achs);//更新成果表
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                }
                else//小于5级
                {
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Achievement";
                    log.OperationType    = "更新";
                    achs.IsPass          = false;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.AttachmentID = attachid; //成果表的附件为新插入的附件ID
                        achieve.Insert(achs);         //插入成果表
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);//将成果更新插入操作表
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    else//上传控件没有值
                    {
                        if (AttachmentID != 0)//原来有附件
                        {
                            achs.AttachmentID = AttachmentID;
                        }
                        achieve.Insert(achs);
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    int opinion = pm.UpLoadFile(OpinionPage1).Attachid;
                    if (opinion != -3)//上传控件是否有值
                    {
                        switch (opinion)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.OpinionPage = opinion;
                        achieve.Insert(achs);//插入成果表
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);//将成果更新插入操作表
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    else//上传控件没有值
                    {
                        if (OpinionPage != 0)//原来有附件
                        {
                            achs.OpinionPage = OpinionPage;
                        }
                        achieve.Insert(achs);
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    int member = pm.UpLoadFile(MemberPage1).Attachid;
                    if (member != -3)//上传控件是否有值
                    {
                        switch (member)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.MemberPage = member;
                        achieve.Insert(achs);//插入成果表
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);//将成果更新插入操作表
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    else//上传控件没有值
                    {
                        if (MemberPage != 0)//原来有附件
                        {
                            achs.MemberPage = MemberPage;
                        }
                        achieve.Insert(achs);
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    int seal = pm.UpLoadFile(SealPage1).Attachid;
                    if (seal != -3)//上传控件是否有值
                    {
                        switch (seal)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        achs.SealPage = seal;
                        achieve.Insert(achs);//插入成果表
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);//将成果更新插入操作表
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    else//上传控件没有值
                    {
                        if (SealPage != 0)//原来有附件
                        {
                            achs.SealPage = SealPage;
                        }
                        achieve.Insert(achs);
                        log.OperationDataID = Convert.ToInt32(Session["AchievementID"]);
                        log.Remark          = achs.AchievementID.ToString();
                        op.Insert(log);
                        achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(achs.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 3
0
        //更新保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                //if (tPatentName.Text.Trim() == "")
                //{
                //    Alert.Show("专利名称不能为空!");
                //    return;
                //}
                //if (tPatentNumber.Text.Trim() == "")
                //{
                //    Alert.Show("专利号不能为空!");
                //    return;
                //}
                //if (tGivenUnit.Text.Trim() == "")
                //{
                //    Alert.Show("授予机构不能为空!");
                //    return;
                //}
                //if (tState.Text.Trim() == "")
                //{
                //    Alert.Show("状态不能为空!");
                //    return;
                //}
                //if (PatentPeople.Text.Trim() == "")
                //{
                //    Alert.Show("发明人不能为空!");
                //    return;
                //}
                //if (FirstPeople.Text.Trim() == "")
                //{
                //    Alert.Show("第一发明人不能为空!");
                //    return;
                //}
                //if (tAccreditTime.SelectedDate < tApplicationTime.SelectedDate)
                //{
                //    Alert.ShowInTop("授权时间不能小于申请时间!");
                //    return;
                //}
                List <string> list = new List <string>();
                string        unit = "";
                list.Add(tPatentDepartment1.Text.ToString());
                list.Add(tPatentDepartment2.Text.ToString());
                list.Add(tPatentDepartment3.Text.ToString());
                List <string> newlist = new List <string>();
                for (int i = 0; i < 3; i++)
                {
                    if (!string.IsNullOrEmpty(list[i].ToString()))
                    {
                        newlist.Add(list[i].ToString());
                    }
                }

                if (newlist.Count != 0)
                {
                    for (int j = 0; j < newlist.Count; j++)
                    {
                        unit += newlist[j].ToString();
                        if (j == newlist.Count() - 1)
                        {
                            break;
                        }
                        unit += ",";
                    }
                    pat.PatentDepartment = unit;
                }
                else
                {
                    pat.PatentDepartment = null;
                }
                //lby ↓
                int[] AttachmentID = patent.FindAttachmentID(Convert.ToInt32(Session["PatentID"]));
                UpdateValue();
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级
                {
                    string path_Patent, path_Application;
                    if (AttachmentID != null)
                    {
                        path_Patent      = at.FindPath(AttachmentID[0]);
                        path_Application = at.FindPath(AttachmentID[1]);
                    }
                    else
                    {
                        path_Patent      = null;
                        path_Application = null;
                    }
                    pat.IsPass   = true;
                    pat.PatentID = Convert.ToInt32(Session["PatentID"]);
                    //lby ↓
                    int attachid = pm.UpLoadFile(PatentFile).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        pat.Attachment_Patent = attachid;//附件为新插入的附件ID
                        pm.DeleteFile(AttachmentID[0], path_Patent);
                    }
                    else //上传控件没有值
                    {
                        if (AttachmentID != null && AttachmentID[0] != 0)
                        {
                            pat.Attachment_Patent = AttachmentID[0];
                        }
                    }

                    attachid = pm.UpLoadFile(ApplicationFile).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        pat.Attachment_Application = attachid;//附件为新插入的附件ID
                        pm.DeleteFile(AttachmentID[1], path_Application);
                    }
                    else //上传控件没有值
                    {
                        if (AttachmentID != null && AttachmentID[1] != 0)
                        {
                            pat.Attachment_Application = AttachmentID[1];
                        }
                    }
                    patent.Update(pat);//更新
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("更新成功!"));
                }
                else//小于5级
                {
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    operate.LoginName        = username;
                    operate.OperationTime    = DateTime.Now;
                    operate.LoginIP          = " ";
                    operate.OperationContent = "Patent";
                    operate.OperationType    = "更新";
                    pat.IsPass = false;

                    //lby ↓
                    int attachid = pm.UpLoadFile(PatentFile).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        pat.Attachment_Patent = attachid;//附件为新插入的附件ID
                    }
                    else//上传控件没有值
                    {
                        if (AttachmentID[0] != 0)//原来有附件
                        {
                            pat.Attachment_Patent = AttachmentID[0];
                        }
                    }

                    attachid = pm.UpLoadFile(ApplicationFile).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        pat.Attachment_Application = attachid;//附件为新插入的附件ID
                    }
                    else//上传控件没有值
                    {
                        if (AttachmentID[1] != 0)//原来有附件
                        {
                            pat.Attachment_Application = AttachmentID[1];
                        }
                    }

                    patent.Insert(pat);//插入
                    operate.OperationDataID = Convert.ToInt32(Session["PatentID"]);
                    operate.Remark          = pat.PatentID.ToString();
                    op.Insert(operate);//将成果更新插入操作表
                    patent.UpdateIsPass(Convert.ToInt32(Session["PatentID"]), false);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("数据已缓存,正在等待审核!"));
                }
            }
            catch (Exception ex)
            {
                //lby ↓
                if (pat.Attachment_Patent != null && pat.Attachment_Application != null)
                {
                    int[]  attachid         = { pat.Attachment_Patent.Value, pat.Attachment_Application.Value };
                    string path_Patent      = at.FindPath(attachid[0]);
                    string path_Application = at.FindPath(attachid[1]);
                    pm.DeleteFile(attachid[0], path_Patent);
                    pm.DeleteFile(attachid[1], path_Application);
                }
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 4
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                //if (tAwardName.Text.Trim() == "")
                //{
                //    Alert.Show("获奖名称不能为空!");
                //    return;
                //}
                //if (tGivenAgency.Text.Trim() == "")
                //{
                //    Alert.Show("授予机构不能为空!");
                //    return;
                //}
                //if (AwardPeople.Text.Trim() == "")
                //{
                //    Alert.Show("获奖人不能为空!");
                //    return;
                //}
                //if (Member.Text.Trim() == "")
                //{
                //    Alert.Show("成员不能为空!");
                //    return;
                //}
                BLHelper.BLLAgency agency  = new BLHelper.BLLAgency();
                int           AttachmentID = award.FindAttachmentID(Convert.ToInt32(Session["AwardID"]));
                string        path         = at.FindPath(AttachmentID);
                List <string> list         = new List <string>();
                string        unit         = "";
                list.Add(Unit1.Text.ToString());
                list.Add(Unit2.Text.ToString());
                list.Add(Unit3.Text.ToString());
                list.Add(Unit4.Text.ToString());
                list.Add(Unit5.Text.ToString());
                List <string> newlist  = new List <string>();
                List <string> newlist1 = new List <string>();
                for (int i = 0; i < 5; i++)
                {
                    if (!string.IsNullOrEmpty(list[i].ToString()))
                    {
                        newlist.Add(list[i].ToString());
                    }
                }

                if (newlist.Count != 0)
                {
                    for (int j = 0; j < newlist.Count; j++)
                    {
                        unit += newlist[j].ToString();
                        if (j == newlist.Count() - 1)
                        {
                            break;
                        }
                        unit += ",";
                    }
                    aww.Unit = unit;
                }
                else
                {
                    aww.Unit = null;
                }
                UpdateValue();
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级
                {
                    aww.IsPass  = true;
                    aww.AwardID = Convert.ToInt32(Session["AwardID"]);
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        aww.AttachmentID = attachid; //附件为新插入的附件ID
                        award.Update(aww);           //更新
                        pm.DeleteFile(AttachmentID, path);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("更新成功!"));
                    }
                    else //上传空间没有值
                    {
                        if (AttachmentID != 0)
                        {
                            aww.AttachmentID = AttachmentID;
                        }
                        award.Update(aww);; //更新成果表
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("更新成功!"));
                    }
                }
                else//小于5级
                {
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Award";
                    log.OperationType    = "更新";
                    aww.IsPass           = false;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    if (attachid != -3)//有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        aww.AttachmentID = attachid; //附件为新插入的附件ID
                        award.Insert(aww);           //插入
                        log.OperationDataID = Convert.ToInt32(Session["AwardID"]);
                        log.Remark          = aww.AwardID.ToString();
                        op.Insert(log);//将成果更新插入操作表
                        award.UpdateIsPass(Convert.ToInt32(Session["AwardID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("数据已缓存,正在等待审核!"));
                    }
                    else//上传控件没有值
                    {
                        if (AttachmentID != 0)//原来有附件
                        {
                            aww.AttachmentID = AttachmentID;
                        }
                        award.Insert(aww);
                        log.OperationDataID = Convert.ToInt32(Session["AwardID"]);
                        log.Remark          = aww.AwardID.ToString();
                        op.Insert(log);
                        award.UpdateIsPass(Convert.ToInt32(Session["AwardID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("数据已缓存,正在等待审核!"));
                    }
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(aww.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 5
0
        //保存更改
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tInspectName.Text.Trim() == "")
                {
                    Alert.Show("姓名不能为空!");
                    return;
                }
                if (tWorkPlace.Text.Trim() == "")
                {
                    Alert.Show("工作单位不能不空!");
                    return;
                }
                if (tVisitContent.Text.Trim() == "")
                {
                    Alert.Show("参观内容不能为空!");
                    return;
                }
                BLHelper.BLLAgency agency = new BLHelper.BLLAgency();
                ins.EntryPerson  = inspect.Findmodel(Convert.ToInt32(Session["InspectID"])).EntryPerson;
                ins.InspectName  = tInspectName.Text.Trim();
                ins.VisitContent = tVisitContent.Text.Trim();
                ins.InspectTime  = dInspectTime.SelectedDate;
                ins.WorkPlace    = tWorkPlace.Text.Trim();
                ins.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1);
                ins.AgencyID     = agency.SelectAgencyID(DropDownListAgency.SelectedText);
                ins.Duty         = tDuty.Text.Trim();
                int    AttachmentID = inspect.FindAttachmentID(Convert.ToInt32(Session["InspectID"]));
                string path         = attachment.FindPath(AttachmentID);
                string username     = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    ins.IsPass        = true;
                    ins.UnitInspectID = Convert.ToInt32(Session["InspectID"]);
                    int Attachment = pm.UpLoadFile(fileupload).Attachid;
                    if (Attachment != -3)
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        ins.AccessoryID = Attachment;
                        inspect.Update(ins);
                        pm.DeleteFile(AttachmentID, path);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    else
                    {
                        if (AttachmentID != 0)
                        {
                            ins.AccessoryID = AttachmentID;
                        }
                        inspect.Update(ins);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                }
                else
                {
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "UnitInspect";
                    log.OperationType    = "更新";
                    ins.IsPass           = false;
                    int Attachment = pm.UpLoadFile(fileupload).Attachid;
                    if (Attachment != -3)
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        ins.AccessoryID = Attachment;
                        inspect.Insert(ins);
                        log.OperationDataID = Convert.ToInt32(Session["InspectID"]);
                        log.Remark          = ins.UnitInspectID.ToString();
                        op.Insert(log);
                        inspect.ChangePass(Convert.ToInt32(Session["InspectID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                    else
                    {
                        if (AttachmentID != 0)
                        {
                            ins.AccessoryID = AttachmentID;
                        }
                        inspect.Insert(ins);
                        log.OperationDataID = Convert.ToInt32(Session["InspectID"]);
                        log.Remark          = ins.UnitInspectID.ToString();
                        op.Insert(log);
                        inspect.ChangePass(Convert.ToInt32(Session["InspectID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                    }
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(ins.AccessoryID);
                string path     = attachment.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 6
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //lby↓
                int    AttachmentID = BLLPlatform.FindAttachmentID(Convert.ToInt32(Session["PlatformID"]));
                string path         = at.FindPath(AttachmentID);

                Common.Entities.Platform platform = new Common.Entities.Platform();
                string PlatformName = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])).PlatformName;//原平台名称
                if (txtPlatformName.Text.Trim() == "")
                {
                    Alert.ShowInTop("平台名称不能为空!");
                    txtPlatformName.Reset();
                    return;
                }
                //新更新的数据是否与原数据的平台名称相同
                if (txtPlatformName.Text.Trim() != PlatformName)//不同
                {
                    if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()) == null)
                    {
                        platform.PlatformName = txtPlatformName.Text.Trim();
                    }
                    else
                    {
                        if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false)
                        {
                            Alert.ShowInTop("该平台名称正在审核中,请等待!");
                            txtPlatformName.Text = "";
                            return;
                        }
                        if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true)
                        {
                            Alert.ShowInTop("平台名称已存在!");
                            txtPlatformName.Text = "";
                            return;
                        }
                    }
                }
                else//相同
                {
                    if (txtPlatformName.Text.Trim() == PlatformName)//新更新的数据与原数据的平台名称相同
                    {
                        platform.PlatformName = txtPlatformName.Text.Trim();
                    }
                    else
                    {
                        if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false)
                        {
                            Alert.ShowInTop("该平台名称正在审核中,请等待!");
                            txtPlatformName.Text = "";
                            return;
                        }
                        if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true)
                        {
                            Alert.ShowInTop("平台名称已存在!");
                            txtPlatformName.Text = "";
                            return;
                        }
                    }
                }

                // platform.PlatformName = txtPlatformName.Text.Trim();
                platform.PlatformRank = DropDownListPlatformRank.SelectedText;
                platform.AgreeUnit    = DropDownListAgreeUnit.SelectedText;
                platform.AgreeTime    = DatePicker_AgreeTime.SelectedDate;
                platform.PlatformType = DropDownListPlatformType.SelectedText;
                platform.SecrecyLevel = DropDownList_SecrecyLevel.SelectedIndex + 1;
                platform.EntryPerson  = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])).EntryPerson;
                //lby↓
                platform.PlatformManagement = txtPlatformManagement.Text.Trim();
                platform.AgreeNumber        = txtAgreeNumber.Text.Trim();
                platform.AgreeExpenditure   = txtAgreeExpenditure.Text.Trim();
                platform.PlatformPrincipal  = txtPlatformPrincipal.Text.Trim();
                platform.PlatformMember     = txtPlatformMember.Text.Trim();

                //向操作日志表中
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    platform.IsPass               = false;
                    operationLog.LoginIP          = " ";
                    operationLog.LoginName        = platform.EntryPerson;
                    operationLog.OperationType    = "更新";
                    operationLog.OperationContent = "Platform";
                    operationLog.OperationTime    = DateTime.Now;
                    //operationLog.OperationDataID = Convert.ToInt32(Session["PlatformID"]);
                    //operationLog.Remark = platform.PlatformID.ToString();
                    //PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交审核!"));

                    //lby↓
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    if (attachid != -3)//有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        platform.AttachmentID = attachid;//附件为新插入的附件ID
                    }
                    else//上传控件没有值
                    {
                        if (AttachmentID != 0)//原来有附件
                        {
                            platform.AttachmentID = AttachmentID;
                        }
                    }
                    BLLPlatform.insert(platform);//插入
                    operationLog.OperationDataID = Convert.ToInt32(Session["PlatformID"]);
                    operationLog.Remark          = platform.PlatformID.ToString();
                    BLLOp.Insert(operationLog);//将成果更新插入操作表
                    BLLPlatform.UpdateIsPass(Convert.ToInt32(Session["PlatformID"]), false);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交,正在等待审核!"));
                }
                else
                {
                    platform.IsPass     = true;
                    platform.PlatformID = Convert.ToInt32(Session["PlatformID"]);
                    //lby↓
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    if (attachid != -3)//上传控件是否有值
                    {
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        platform.AttachmentID = attachid;//附件为新插入的附件ID
                        pm.DeleteFile(AttachmentID, path);
                    }
                    else //上传空间没有值
                    {
                        if (AttachmentID != 0)
                        {
                            platform.AttachmentID = AttachmentID;
                        }
                    }
                    BLLPlatform.Update(platform);//5级直接更新平台表
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已更新完成!"));
                }
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 7
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;
            }
        }
Esempio n. 8
0
        //项目修改
        public void AddProjects()
        {
            try
            {
                if (SourceUnit2.Text.Trim() == "")
                {
                    //Alert.ShowInTop("来源单位不能为空!");
                    SourceUnit2.Text = "";
                    //return;
                }
                if (ProjectManager.Text.Trim() == "")
                {
                    //Alert.ShowInTop("项目负责人(前三)不能为空!");
                    ProjectManager.Text = "";
                    //return;
                }
                if (ProjectHeads2.Text.Trim() == "")
                {
                    //Alert.ShowInTop("实际负责人不能为空!");
                    ProjectHeads2.Text = "";
                    //return;
                }
                if (AcceptUnit2.Text.Trim() == "")
                {
                    //Alert.ShowInTop("承担部门不能为空!");
                    AcceptUnit2.Text = "";
                    //return;
                }
                if (GivenMoneyUnits2.Text.Trim() == "")
                {
                    //Alert.ShowInTop("来款单位不能为空!");
                    GivenMoneyUnits2.Text = "";
                    //return;
                }
                aproject.ProjectName = ProjectName2.Text.Trim();
                aproject.AgencyID    = bllAgency.SelectAgencyID(DropDownListAgencyP.SelectedItem.Text);
                aproject.AcceptUnit  = AcceptUnit2.Text.Trim();
                aproject.SourceUnit  = SourceUnit2.Text.Trim();
                if (DropDownListProjectSortName.SelectedItem != null)
                {
                    aproject.ProjectSortName = DropDownListProjectSortName.SelectedItem.Text;
                }
                else
                {
                    aproject.ProjectSortName = "";
                }
                aproject.ProjectState  = DropDownListState.SelectedItem.Text;
                aproject.ApprovedMoney = ApprovedMoney2.Text.Trim();
                aproject.ProjectMember = ProjectMember.Text; //项目成员
                //if (!string.IsNullOrEmpty(GetMoney2.Text))
                //{
                //    if (Convert.ToDecimal(ApprovedMoney2.Text) - Convert.ToDecimal(GetMoney2.Text) < 0)
                //    {
                //        GetMoney2.Reset();
                //        Alert.ShowInTop("到账金额小于等于项目经费");
                //        return;
                //    }
                //    else
                //        aproject.GetMoney = GetMoney2.Text.Trim();
                //}
                //else
                aproject.GetMoney         = GetMoney2.Text.Trim();
                aproject.CooperationForms = DropDownListCooperationForms.SelectedItem.Text;//CooperationForms2.Text.Trim();
                aproject.ProjectLevel     = DropDownListProjectLevel.SelectedItem.Text;
                aproject.ProjectHeads     = ProjectHeads2.Text.Trim();
                aproject.StartTime        = DatePickerStartTime.SelectedDate;
                if (DatePickerEndTime.SelectedDate.HasValue)
                {
                    if (DatePickerEndTime.SelectedDate < DatePickerStartTime.SelectedDate)
                    {
                        DatePickerEndTime.Reset();
                        Alert.ShowInTop("结束时间不能小于开始时间!");
                        return;
                    }
                    else
                    {
                        aproject.EndTime = DatePickerEndTime.SelectedDate;
                    }
                }
                if (DatePickerExpectEndTime.SelectedDate.HasValue)
                {
                    if (DatePickerExpectEndTime.SelectedDate < DatePickerStartTime.SelectedDate)
                    {
                        DatePickerExpectEndTime.Reset();
                        Alert.ShowInTop("预期结束时间不能小于开始时间!");
                        return;
                    }
                    else
                    {
                        aproject.ExpectEndTime = DatePickerExpectEndTime.SelectedDate;
                    }
                }
                aproject.ExpecteResults  = DropDownListExpecteResults.SelectedItem.Text;//ExpecteResults2.Text.Trim();
                aproject.GivenMoneyUnits = GivenMoneyUnits2.Text.Trim();
                aproject.ProjectNature   = DropDownListNature.SelectedItem.Text;
                aproject.Remark          = Remark2.Text.Trim();
                aproject.SecrecyLevel    = DropDownListSecrecyLevel.SelectedIndex + 1;

                //管理费比例
                if (!string.IsNullOrEmpty(ManageMoney.Text))
                {
                    double num = 0.0;
                    if (double.TryParse(ManageMoney.Text.Trim(), out num))
                    {
                        if (Convert.ToDouble(ManageMoney.Text) > 0 && Convert.ToDouble(ManageMoney.Text) < 100)
                        {
                            aproject.ManageMoney = ManageMoney.Text.Trim();
                        }
                        else
                        {
                            ManageMoney.Text = "";
                            Alert.ShowInTop("管理费比例为0~100%!");
                            return;
                        }
                    }
                    else
                    {
                        ManageMoney.Reset();
                        Alert.ShowInTop("请输入数字!");
                        return;
                    }
                }
                else
                {
                    aproject.ManageMoney = bllFundingSet.FindProportion(aproject.ProjectNature, "管理费");
                }
                aproject.PactNum        = PactNum2.Text.Trim();
                aproject.TaskNum        = TaskNum2.Text.Trim();
                aproject.ProjectManager = ProjectManager.Text.Trim(); //项目负责人(前三)
                aproject.ProjectInNum   = ProjectInNum.Text.Trim();   //项目内部编号(科技处)
                aproject.EntryPerson    = bllProject.FindByid(Convert.ToInt32(Session["ProjectID"])).EntryPerson;
                //原经济效益附件
                int    BenefitID = bllProject.FindBenefit(Convert.ToInt32(Session["ProjectID"]));
                string path      = bllAttachment.FindPath(BenefitID);
                //原经费预算附件
                int    BudgetID   = bllProject.FindBudget(Convert.ToInt32(Session["ProjectID"]));
                string budgetpath = bllAttachment.FindPath(BudgetID);

                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级
                {
                    aproject.IsPass    = true;
                    aproject.ProjectID = Convert.ToInt32(Session["ProjectID"]);
                    int Attachment = publicmethod.UpLoadFile(FileUploadFile).Attachid;//经济效益附件
                    switch (Attachment)
                    {
                    case -1:
                        Alert.ShowInTop("经济效益文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("经济效益文件不能大于150M");
                        return;
                    }
                    int budgetAttanchment = publicmethod.UpLoadFile(FileUploadFileM).Attachid;//经费预算附件
                    switch (budgetAttanchment)
                    {
                    case -1:
                        Alert.ShowInTop("经费预算文件类型不符,请重新选择!");
                        if (Attachment != -1 && Attachment != 0 && Attachment != -2)
                        {
                            publicmethod.DeleteFile(Attachment, bllAttachment.FindPath(Attachment));
                        }
                        return;

                    case 0:
                        Alert.ShowInTop("经费预算文件名已经存在!");
                        if (Attachment != -1 && Attachment != 0 && Attachment != -2)
                        {
                            publicmethod.DeleteFile(Attachment, bllAttachment.FindPath(Attachment));
                        }
                        return;

                    case -2:
                        Alert.ShowInTop("经费预算文件不能大于150M");
                        if (Attachment != -1 && Attachment != 0 && Attachment != -2)
                        {
                            publicmethod.DeleteFile(Attachment, bllAttachment.FindPath(Attachment));
                        }
                        return;
                    }
                    if (Attachment != -3)                        //上传控件是否有值
                    {
                        aproject.BenefitAttachment = Attachment; //附件为新插入的经济效益附件ID
                        publicmethod.DeleteFile(BenefitID, path);
                    }
                    else //上传空间没有值
                    {
                        if (BenefitID != 0)//原来有附件
                        {
                            aproject.BenefitAttachment = Attachment;
                        }
                    }
                    if (budgetAttanchment != -3)                       //上传控件是否有值
                    {
                        aproject.BudgetAttachment = budgetAttanchment; //附件为新插入的经费预算附件
                        publicmethod.DeleteFile(BudgetID, budgetpath);
                    }
                    else//上传空间没有值
                    {
                        if (BudgetID != 0)
                        {
                            aproject.BudgetAttachment = budgetAttanchment;
                        }
                    }
                    bllProject.Update(aproject);//更新
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else//小于5级
                {
                    aproject.IsPass = false;
                    int Attachment = publicmethod.UpLoadFile(FileUploadFile).Attachid;//经济效益附件
                    switch (Attachment)
                    {
                    case -1:
                        Alert.ShowInTop("经济效益文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("经济效益文件不能大于150M");
                        return;
                    }
                    int budgetAttanchment = publicmethod.UpLoadFile(FileUploadFileM).Attachid;//经费预算附件
                    switch (budgetAttanchment)
                    {
                    case -1:
                        Alert.ShowInTop("经费预算文件类型不符,请重新选择!");
                        if (Attachment != -1 && Attachment != 0 && Attachment != -2)
                        {
                            publicmethod.DeleteFile(Attachment, bllAttachment.FindPath(Attachment));
                        }
                        return;

                    case 0:
                        Alert.ShowInTop("经费预算文件名已经存在!");
                        if (Attachment != -1 && Attachment != 0 && Attachment != -2)
                        {
                            publicmethod.DeleteFile(Attachment, bllAttachment.FindPath(Attachment));
                        }
                        return;

                    case -2:
                        Alert.ShowInTop("经费预算文件不能大于150M");
                        if (Attachment != -1 && Attachment != 0 && Attachment != -2)
                        {
                            publicmethod.DeleteFile(Attachment, bllAttachment.FindPath(Attachment));
                        }
                        return;
                    }
                    if (Attachment != -3)                        //有值
                    {
                        aproject.BenefitAttachment = Attachment; //附件为新插入的经济效益附件ID
                    }
                    else//上传控件没有值
                    {
                        if (BenefitID != 0)//原来有附件
                        {
                            aproject.BenefitAttachment = Attachment;
                        }
                    }
                    if (budgetAttanchment != -3)                       //有值
                    {
                        aproject.BudgetAttachment = budgetAttanchment; ///附件为新插入的经费预算附件
                    }
                    else
                    {
                        if (BudgetID != 0)//原来有附件
                        {
                            aproject.BudgetAttachment = budgetAttanchment;
                        }
                    }
                    //向操作日志表中插入
                    bllProject.InsertProject(aproject);//插入
                    OperationLog operate = new OperationLog();
                    operate.LoginName        = bllProject.FindByid(Convert.ToInt32(Session["ProjectID"])).EntryPerson;
                    operate.LoginIP          = "";
                    operate.OperationType    = "更新";
                    operate.OperationContent = "Project";
                    operate.OperationDataID  = Convert.ToInt32(Session["ProjectID"]);
                    operate.OperationTime    = System.DateTime.Now;
                    operate.Remark           = bllProject.SelectProjectID(ProjectName2.Text).ToString();
                    bllOperate.Insert(operate);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("你的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                publicmethod.SaveError(ex, this.Request);
            }
        }
Esempio n. 9
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);
            }
        }
Esempio n. 10
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tAchievement.Text.Trim() == "")
                {
                    Alert.Show("项目名称不能为空!");
                    return;
                }
                if (tCAUnit.Text.Trim() == "")
                {
                    Alert.Show("验收部门不能为空!");
                    return;
                }
                if (tProjectMember.Text.Trim() == "")
                {
                    Alert.Show("成员不能为空!");
                    return;
                }
                if (tCACommnetLevel.Text.Trim() == "")
                {
                    Alert.Show("验收评语级别不能为空!");
                    return;
                }
                int    AttachmentID = ca.FindAttachmentID(Convert.ToInt32(Session["AchievementCAID"]));
                string path         = at.FindPath(AttachmentID);
                UpdateValue();
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级
                {
                    aca.IsPass          = true;
                    aca.AchievementCAID = Convert.ToInt32(Session["AchievementCAID"]);
                    int Attachment = pm.UpLoadFile(fileupload).Attachid;
                    if (Attachment != -3)//上传控件是否有值
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        aca.AttachmentID = Attachment; //附件为新插入的附件ID
                        ca.Update(aca);                //更新
                        pm.DeleteFile(AttachmentID, path);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                    else //上传空间没有值
                    {
                        if (AttachmentID != 0)//原来有附件
                        {
                            aca.AttachmentID = AttachmentID;
                        }
                        ca.Update(aca);; //更新项目表
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                    }
                }
                else//小于5级
                {
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "AchievementCA";
                    log.OperationType    = "更新";
                    aca.IsPass           = false;
                    int Attachment = pm.UpLoadFile(fileupload).Attachid;
                    if (Attachment != -3)//有值
                    {
                        switch (Attachment)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        aca.AttachmentID = Attachment; //附件为新插入的附件ID
                        ca.Insert(aca);                //插入
                        log.OperationDataID = Convert.ToInt32(Session["AchievementCAID"]);
                        log.Remark          = aca.AchievementCAID.ToString();
                        op.Insert(log);//将项目更新插入操作表
                        ca.UpdateIsPass(Convert.ToInt32(Session["AchievementCAID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("你的数据已提交,请等待确认!"));
                    }
                    else//上传控件没有值
                    {
                        if (AttachmentID != 0)//原来有附件
                        {
                            aca.AttachmentID = AttachmentID;
                        }
                        ca.Insert(aca);
                        log.OperationDataID = Convert.ToInt32(Session["AchievementCAID"]);
                        log.Remark          = aca.AchievementCAID.ToString();
                        op.Insert(log);
                        ca.UpdateIsPass(Convert.ToInt32(Session["AchievementCAID"]), false);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("你的数据已提交,请等待确认!"));
                    }
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(aca.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 11
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Common.Entities.Platform platform = new Common.Entities.Platform();
                if (txtPlatformName.Text.Trim() == "")
                {
                    Alert.ShowInTop("平台名称不能为空!");
                    txtPlatformName.Reset();
                    return;
                }
                if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()) == null)
                {
                    platform.PlatformName = txtPlatformName.Text.Trim();
                    platform.PlatformRank = DropDownListPlatformRank.SelectedText;
                    platform.AgreeUnit    = DropDownListAgreeUnit.SelectedText;
                    platform.AgreeTime    = DatePicker_AgreeTime.SelectedDate;
                    platform.PlatformType = DropDownListPlatformType.SelectedText;
                    platform.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue) + 1;
                    //Lby↓
                    platform.AgreeNumber        = txtAgreeNumber.Text.Trim();
                    platform.AgreeExpenditure   = txtAgreeExpenditure.Text.Trim();
                    platform.PlatformMember     = txtPlatformMember.Text.Trim();
                    platform.PlatformManagement = txtPlatformManagement.Text.Trim();
                    platform.PlatformPrincipal  = txtPlatformPrincipal.Text.Trim();
                    platform.EntryPerson        = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;

                    if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                    {
                        platform.IsPass = true;

                        //lby↓
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        if (attachid != -3)
                        {
                            platform.AttachmentID = attachid;
                        }
                        else
                        {
                            platform.AttachmentID = null;
                        }
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已添加完成!"));
                    }
                    else
                    {
                        platform.IsPass = false;

                        //lby ↓
                        switch (attachid)
                        {
                        case -1:
                            Alert.ShowInTop("文件类型不符,请重新选择!");
                            return;

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

                        case -2:
                            Alert.ShowInTop("文件不能大于150M");
                            return;
                        }
                        if (attachid != -3)
                        {
                            platform.AttachmentID = attachid;
                        }
                        else
                        {
                            platform.AttachmentID = null;
                        }
                        operationLog.LoginName        = Session["LoginName"].ToString();
                        operationLog.OperationTime    = DateTime.Now;
                        operationLog.LoginIP          = " ";
                        operationLog.OperationContent = "Platform";
                        operationLog.OperationType    = "添加";
                        operationLog.OperationDataID  = platform.PlatformID;
                        BLLOp.Insert(operationLog);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交审核"));
                    }
                    //向平台表中插入数据
                    BLLPlatform.insert(platform);
                }
                else
                {
                    if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false)
                    {
                        Alert.ShowInTop("该平台名称正在审核中,请等待!");
                        txtPlatformName.Text = "";
                        return;
                    }
                    if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true)
                    {
                        Alert.ShowInTop("平台名称已存在!");
                        txtPlatformName.Text = "";
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(pm.UpLoadFile(fileupload).Attachid);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 12
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                scienceReport = InserScienceReport();
                if (Session["LoginName"].ToString() == "")
                {
                    Response.Redirect("login.aspx");
                    Alert.Show("登录超时!");
                }
                if (txtReportName.Text.Trim() == "")
                {
                    Alert.ShowInTop("报告名称不能为空!");
                    txtReportName.Reset();
                    return;
                }
                if (txtReportName.Text.Trim() == "")
                {
                    Alert.ShowInTop("报告名称不能为空!");
                    txtReportName.Reset();
                    return;
                }
                if (txtReportPeople.Text.Trim() == "")
                {
                    Alert.ShowInTop("报告人不能为空!");
                    txtReportPeople.Reset();
                    return;
                }
                //int attachId = publicMethod.UpLoad(fileupload);
                //Common.Entities.ScienceReport scienceReport = InserScienceReport();
                //上传文件并向附件表中插入数据
                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:
                    scienceReport.AccessoryID = null;
                    break;

                //Alert.ShowInTop("请上传附件");
                //return;
                default:
                    scienceReport.AccessoryID = AttachID;
                    break;
                }
                //向学术报告表中插入数据
                BLLScience.Insert(scienceReport);
                Common.Entities.OperationLog OL = InsertOperationLog();
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    //向操作日志表中插入数据
                    OL.OperationDataID = scienceReport.ScienceReportID;
                    operationLog.Insert(OL);
                    Alert.ShowInTop("您的数据已提交,请等待确认");
                }
                else
                {
                    Alert.ShowInTop("保存成功");
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
                //Reset();
            }
            catch (Exception ex)
            {
                int?attachid = scienceReport.AccessoryID;
                if (attachid != 0 && attachid != null)
                {//删除附件
                    //在附件表中删除学术报告附件
                    BLLattachment.Delete(Convert.ToInt32(attachid));
                    //删除附件文件
                    string path = BLLattachment.FindPath(Convert.ToInt32(attachid));
                    if (path != "")
                    {
                        publicMethod.DeleteFile(Convert.ToInt32(attachid), path);
                    }
                }
                BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
                return;
            }
        }
Esempio n. 13
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tDocument.Text.Trim() == null)
                {
                    Alert.Show("文档编号不能为空!");
                    return;
                }
                if (tNDocument.Text.Trim() == null)
                {
                    Alert.Show("文档名不能为空!");
                    return;
                }
                //lby ↓
                List <ProjectFile> list = project.FindByFileCode(tDocument.Text.Trim(), Convert.ToInt32(Session["SecrecyLevel"]));
                if (list.Count != 0)
                {
                    if (list.FirstOrDefault().IsPass == true)
                    {
                        Alert.ShowInTop("文件已存在!");
                        tDocument.Text = "";
                        return;
                    }
                    else
                    {
                        Alert.ShowInTop("该文件正在审核中,请等待!");
                        tDocument.Text = "";
                        return;
                    }
                }
                proj.ProjectID    = Convert.ToInt32(Session["ProjectID"]);
                proj.FileCode     = tDocument.Text.Trim();
                proj.FileName     = tNDocument.Text.Trim();
                proj.FileType     = DropDownListDocument.SelectedText;
                proj.SecrecyLevel = listSecrecyLevel.SelectedIndex + 1;
                proj.EntryPerson  = user.FindByLoginName(Session["LoginName"].ToString()).UserName;

                //lby ↓
                int attachid = pm.UpLoadFile(fileupload).Attachid;

                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    proj.IsPass = true;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        proj.AttachmentID = attachid;
                    }
                    else
                    {
                        //proj.AttachmentID = 0;
                        Alert.Show("没有上传文件!");
                        return;
                    }
                    //向表中插入数据
                    if (project.InsertProjectFile(proj))
                    {
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("文件信息已添加完成!"));
                    }
                    else
                    {
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("文件信息添加失败!"));
                    }
                }
                else
                {
                    proj.IsPass = false;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        proj.AttachmentID = attachid;
                    }
                    else
                    {
                        Alert.Show("没有上传文件!");
                        return;
                        //proj.AttachmentID = 0;
                    }
                    //向表中插入数据
                    if (project.InsertProjectFile(proj))
                    {
                        log.LoginName        = Session["LoginName"].ToString();
                        log.OperationTime    = DateTime.Now;
                        log.LoginIP          = " ";
                        log.OperationContent = "ProjectFile";
                        log.OperationType    = "添加";
                        log.OperationDataID  = proj.ProjectFileID;
                        bllLog.Insert(log);
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("文件信息已提交审核"));
                    }
                    else
                    {
                        PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("文件信息提交失败!"));
                    }
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(pm.UpLoadFile(fileupload).Attachid);
                string path     = bllAttachment.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 14
0
        //添加
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tAchievementName.Text.Trim() == "")
                {
                    Alert.Show("成果名称不能为空!");
                    return;
                }
                if (tAppraisalUnit.Text.Trim() == "")
                {
                    Alert.Show("鉴定组织部门不能为空!");
                    return;
                }
                if (tApRemarkRank.Text.Trim() == "")
                {
                    Alert.Show("成果登记号不能为空!");
                    return;
                }
                if (tApprovalNum.Text.Trim() == "")
                {
                    Alert.Show("证书文号不能为空!");
                    return;
                }
                if (ProjectInNum.Text.Trim() == "")
                {
                    Alert.Show("项目内部编号不能为空!");
                    return;
                }
                if (FirstFinishedPeople.Text.Trim() == "")
                {
                    Alert.Show("成果第一完成人不能为空!");
                    return;
                }
                if (ProjectPeople.Text.Trim() == "")
                {
                    Alert.Show("成员不能为空!");
                    return;
                }
                BLHelper.BLLAgency agency = new BLHelper.BLLAgency();
                ach.AchievementName     = tAchievementName.Text.Trim();
                ach.AgencyID            = agency.SelectAgencyID(DropDownListAgency.SelectedText);
                ach.ProjectName         = tProjectID.Text.Trim();
                ach.AppraisalTime       = dAppraisalTime.SelectedDate;
                ach.AppraisalUnit       = tAppraisalUnit.Text.Trim();
                ach.ApRemarkRank        = tApRemarkRank.Text.Trim();
                ach.ApprovalNum         = tApprovalNum.Text.Trim();
                ach.ProjectInNum        = ProjectInNum.Text.Trim();        //项目分类编号
                ach.ProjectPeople       = ProjectPeople.Text.Trim();       //成员
                ach.FirstFinishedPeople = FirstFinishedPeople.Text.Trim(); //成果第一完成人
                //ach.ProjectRank = DropDownListProjectRank.SelectedText;//鉴定级别
                ach.ProjectLevel = DropDownListProjectLevel.SelectedText;  //鉴定水平
                ach.ProjectForm  = DropDownListProjectForm.SelectedText;   //鉴定形式
                ach.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1);
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                ach.EntryPerson = username;

                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        ach.AttachmentID = attachid;
                    }
                    else
                    {
                        ach.AttachmentID = null;
                    }
                    int opinion = pm.UpLoadFile(OpinionPage).Attachid;
                    switch (opinion)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (opinion != -3)
                    {
                        ach.OpinionPage = opinion;
                    }
                    else
                    {
                        ach.OpinionPage = null;
                    }
                    int member = pm.UpLoadFile(MemberPage).Attachid;
                    switch (member)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (member != -3)
                    {
                        ach.MemberPage = member;
                    }
                    else
                    {
                        ach.MemberPage = null;
                    }
                    int seal = pm.UpLoadFile(SealPage).Attachid;
                    switch (seal)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (seal != -3)
                    {
                        ach.SealPage = seal;
                    }
                    else
                    {
                        ach.SealPage = null;
                    }
                    ach.IsPass = true;
                    achieve.Insert(ach);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else
                {
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        ach.AttachmentID = attachid;
                    }
                    else
                    {
                        ach.AttachmentID = null;
                    }
                    int opinion = pm.UpLoadFile(OpinionPage).Attachid;
                    switch (opinion)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (opinion != -3)
                    {
                        ach.OpinionPage = opinion;
                    }
                    else
                    {
                        ach.OpinionPage = null;
                    }
                    int member = pm.UpLoadFile(MemberPage).Attachid;
                    switch (member)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (member != -3)
                    {
                        ach.MemberPage = member;
                    }
                    else
                    {
                        ach.MemberPage = null;
                    }
                    int seal = pm.UpLoadFile(SealPage).Attachid;
                    switch (seal)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (seal != -3)
                    {
                        ach.SealPage = seal;
                    }
                    else
                    {
                        ach.SealPage = null;
                    }
                    ach.IsPass = false;
                    achieve.Insert(ach);
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Achievement";
                    log.OperationType    = "添加";
                    log.OperationDataID  = ach.AchievementID;
                    op.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(ach.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 15
0
        //保存按钮
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (FileName.Text.Trim() == "")
                {
                    Alert.Show("文件名不能为空!");
                    return;
                }
                BLHelper.BLLAgency agency = new BLHelper.BLLAgency();
                files.FileName      = FileName.Text.Trim();
                files.LevinTime     = LevinTime.SelectedDate;
                files.LevinUnit     = LevinUnit.Text.Trim();
                files.FileRecipient = FileRecipient.Text.Trim();
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                files.EntryPerson        = username;
                files.SecrecyLevel       = Convert.ToInt32(DropDownListLevel.SelectedIndex + 1);
                files.AgencyID           = agency.SelectAgencyID(DropDownListAgency.SelectedText.Trim());
                files.DocumentCategoryID = DropDownListFile.SelectedText.Trim();
                if (Convert.ToInt32(Session["SecrecyLevel"]) < 5)
                {
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Files";
                    log.OperationType    = "添加";
                    files.IsPass         = false;

                    //文件上传并获取附件id
                    //先进行附件判断

                    int AttachID = pm.UpLoadFile(fileupload).Attachid;
                    switch (AttachID)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

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

                    case -3:
                        Alert.ShowInTop("请上传附件");
                        return;
                    }
                    files.AttachmentID = AttachID;
                    file.Insert(files);//插入文件表
                    log.OperationDataID = files.FilesID;
                    op.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待审核!"));
                }
                else
                {
                    files.IsPass = true;
                    int AttachID = pm.UpLoadFile(fileupload).Attachid;
                    switch (AttachID)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

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

                    case -3:
                        Alert.ShowInTop("请上传附件");
                        return;
                    }
                    files.AttachmentID = AttachID;
                    file.Insert(files);//插入文件表
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功"));
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(files.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 16
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtLecturesName.Text.Trim() == "")
                {
                    Alert.ShowInTop("姓名不能为空!");
                    txtLecturesName.Reset();
                    return;
                }
                if (txtWorkPlace.Text.Trim() == "")
                {
                    Alert.ShowInTop("工作单位不能为空!");
                    txtWorkPlace.Reset();
                    return;
                }
                //原单位讲学对象
                unitLectures = BLLUL.FindByUnitLecturesID(Convert.ToInt32(Session["UnitLecturesID"]));
                //单位讲学表对象
                NewUnitLectures.LecturesName   = txtLecturesName.Text;
                NewUnitLectures.AgencyID       = BLLAgency.SelectAgencyID(DropDownList_Agency.SelectedText);
                NewUnitLectures.UReportName    = txtUReportName.Text;
                NewUnitLectures.LecturesTime   = Convert.ToDateTime(DatePikerLecturesTime.Text);
                NewUnitLectures.WorkUnit       = txtWorkPlace.Text;
                NewUnitLectures.listenerNumber = Convert.ToInt32(txtlistenerNumber.Text);
                NewUnitLectures.SecrecyLevel   = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue);
                NewUnitLectures.LecturesPlace  = txtLecturesPlace.Text;
                NewUnitLectures.WorkTitle      = txtjobtitle.Text;
                NewUnitLectures.Identity       = txtIDCard.Text;
                NewUnitLectures.Telephone      = txtTel.Text;
                NewUnitLectures.Remark         = Remark.Text;
                NewUnitLectures.EntryPerson    = unitLectures.EntryPerson;
                //用户等级为5级可直接通过
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    NewUnitLectures.IsPass = true;
                }
                else
                {
                    NewUnitLectures.IsPass = false;
                }

                int AttachID = pm.UpLoadFile(fileupload).Attachid;
                switch (AttachID)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

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

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

                case -3:
                    NewUnitLectures.AttachmentID = unitLectures.AttachmentID;
                    break;

                default:
                    NewUnitLectures.AttachmentID = AttachID;
                    break;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    //操作日志表对象
                    Common.Entities.OperationLog operationLog = InsertOperationLog();
                    operationLog.OperationDataID = Convert.ToInt32(Session["UnitLecturesID"]);
                    NewUnitLectures.EntryPerson  = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    NewUnitLectures.IsPass       = false;
                    unitLectures.IsPass          = false;
                    BLLUL.Insert(NewUnitLectures); //向单位讲学表插入信息
                    operationLog.Remark = NewUnitLectures.UnitLecturesID.ToString();
                    BLLOL.Insert(operationLog);    //向操作日志表插入信息
                    Alert.ShowInTop("操数据已经提交,等待管理员确认!");
                }
                else
                {
                    NewUnitLectures.UnitLecturesID = Convert.ToInt32(Session["UnitLecturesID"]);
                    BLLUL.Update(NewUnitLectures);
                    Alert.ShowInTop("保存成功!");
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
            }
            catch (Exception ex)
            {
                //删除附件文件
                string path = BLLattachment.FindPath(Convert.ToInt32(unitLectures.AttachmentID));
                if (path != "")
                {
                    pm.DeleteFile(Convert.ToInt32(unitLectures.AttachmentID), path);
                    //删除附件表中的数据
                    BLLattachment.Delete(Convert.ToInt32(unitLectures.AttachmentID));//删除成功返回true
                }
                //BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 17
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tAwardName.Text.Trim() == "")
                {
                    Alert.Show("获奖名称不能为空!");
                    return;
                }
                if (tGivenAgency.Text.Trim() == "")
                {
                    Alert.Show("授予机构不能为空!");
                    return;
                }
                //if (AwardPeople.Text.Trim() == "")
                //{
                //    Alert.Show("获奖人不能为空!");
                //    return;
                //}
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                aw.EntryPerson = username;
                List <string> list = new List <string>();
                string        unit = "";
                list.Add(Unit1.Text.ToString());
                list.Add(Unit2.Text.ToString());
                list.Add(Unit3.Text.ToString());
                list.Add(Unit4.Text.ToString());
                list.Add(Unit5.Text.ToString());
                List <string> newlist  = new List <string>();
                List <string> newlist1 = new List <string>();
                for (int i = 0; i < 5; i++)
                {
                    if (!string.IsNullOrEmpty(list[i].ToString()))
                    {
                        newlist.Add(list[i].ToString());
                    }
                }

                if (newlist.Count != 0)
                {
                    for (int j = 0; j < newlist.Count; j++)
                    {
                        unit += newlist[j].ToString();
                        if (j == newlist.Count() - 1)
                        {
                            break;
                        }
                        unit += ",";
                    }
                    aw.Unit = unit;
                }
                else
                {
                    aw.Unit = null;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    InsertValue();
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        aw.AttachmentID = attachid;
                    }
                    else
                    {
                        aw.AttachmentID = null;
                    }
                    aw.IsPass = true;
                    award.Insert(aw);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else
                {
                    InsertValue();
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        aw.AttachmentID = attachid;
                    }
                    else
                    {
                        aw.AttachmentID = null;
                    }
                    aw.IsPass = false;
                    award.Insert(aw);
                    operate.LoginName        = username;
                    operate.OperationTime    = DateTime.Now;
                    operate.LoginIP          = " ";
                    operate.OperationContent = "Award";
                    operate.OperationType    = "添加";
                    operate.OperationDataID  = aw.AwardID;
                    op.Insert(operate);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(aw.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 18
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tAchievement.Text.Trim() == "")
                {
                    Alert.Show("成果名称不能为空!");
                    return;
                }
                if (tApplyUnit.Text.Trim() == "")
                {
                    Alert.Show("应用单位不能为空!");
                    return;
                }
                if (tUse.Text.Trim() == "")
                {
                    Alert.Show("用途不能为空!");
                    return;
                }
                if (dEndTime.SelectedDate < dStartTime.SelectedDate)
                {
                    Alert.ShowInTop("结束时间不能小于开始时间!");
                    return;
                }
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                app.EntryPerson = username;
                int attachid = pm.UpLoadFile(fileupload).Attachid;
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    InsertValue();

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

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        app.AttachmentID = attachid;
                    }
                    else
                    {
                        app.AttachmentID = null;
                    }
                    app.IsPass = true;
                    apply.Insert(app);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else
                {
                    InsertValue();
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        app.AttachmentID = attachid;
                    }
                    else
                    {
                        app.AttachmentID = null;
                    }
                    app.IsPass = false;
                    apply.Insert(app);
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "AchivementApply";
                    log.OperationType    = "添加";
                    log.OperationDataID  = app.AchivementApplyID;
                    op.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                int    attachid = Convert.ToInt32(app.AttachmentID);
                string path     = at.FindPath(attachid);
                pm.DeleteFile(attachid, path);
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 19
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtPactNum.Text.Trim() == "")
                {
                    Alert.ShowInTop("合同编号不能为空!");
                    txtPactNum.Reset();
                    return;
                }
                if (txtPactType.Text.Trim() == "")
                {
                    Alert.ShowInTop("合同类别不能为空!");
                    txtPactType.Reset();
                    return;
                }
                if (DatePicker_StartTime.SelectedDate > DatePicker_EndTime.SelectedDate)
                {
                    Alert.ShowInTop("结束日期应该大于开始日期!");
                    return;
                }
                NewPact.EndTime        = DatePicker_EndTime.SelectedDate;
                NewPact.EntryPerson    = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                NewPact.PactNum        = txtPactNum.Text;
                NewPact.PactType       = txtPactType.Text;
                NewPact.ProjectID      = BLLProject.SelectProjectID(DropDownList_Project.SelectedText);
                NewPact.SecrecyLevel   = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue);
                NewPact.StartTime      = DatePicker_StartTime.SelectedDate;
                NewPact.PactName       = txtPactName.Text;
                NewPact.ChargePerson   = txtChargePerson.Text;
                NewPact.PactMoney      = txtPactMoney.Text;
                NewPact.RealMoney      = txtRealMoney.Text;
                NewPact.PactCompletion = txtPactCompletion.Text;
                NewPact.IsExistingFile = txtIsExistingFile.Text;
                NewPact.FileNum        = txtFileNum.Text;
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    NewPact.IsPass = true;
                }
                else
                {
                    NewPact.IsPass = false;
                }
                int AttachID = pm.UpLoadFile(fileupload).Attachid;
                switch (AttachID)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

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

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

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

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

                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    NewPact.IsPass = false;
                }
                else
                {
                    NewPact.IsPass = true;
                }

                //向合同档案表中插入数据
                BLLPact.Insert(NewPact);

                //向操作日志表中插入数据
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    operationLog.LoginIP          = " ";
                    operationLog.LoginName        = Session["LoginName"].ToString();
                    operationLog.OperationType    = "添加";
                    operationLog.OperationContent = "Pact";
                    operationLog.OperationTime    = DateTime.Now;
                    operationLog.OperationDataID  = NewPact.PactID;
                    BLLOp.Insert(operationLog);
                    Alert.ShowInTop("您的数据已提交,请等待确认!");
                }
                else
                {
                    Alert.ShowInTop("保存成功!");
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
            }
            catch (Exception ex)
            {
                int PactID = Convert.ToInt32(NewPact.AttachmentID);
                //删除资料附件
                int    AttactID = BLLPact.FindAttachmentID(PactID);
                string strPath;
                if (AttactID != 0)
                {
                    strPath = BLLattachment.FindPath(AttactID);
                    if (strPath != "")
                    {
                        //在附件表中删除附件数据
                        BLLattachment.Delete(AttactID);
                        //删除附件文件
                        pm.DeleteFile(AttactID, strPath);
                    }
                }
                //BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 20
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (tPatentName.Text.Trim() == "")
                {
                    Alert.Show("专利名称不能为空!");
                    return;
                }
                if (tPatentNumber.Text.Trim() == "")
                {
                    Alert.Show("专利号不能为空!");
                    return;
                }
                if (tGivenUnit.Text.Trim() == "")
                {
                    Alert.Show("授予机构不能为空!");
                    return;
                }
                if (tState.Text.Trim() == "")
                {
                    Alert.Show("状态不能为空!");
                    return;
                }
                if (PatentPeople.Text.Trim() == "")
                {
                    Alert.Show("全部发明人不能为空!");
                    return;
                }
                if (FirstPeople.Text.Trim() == "")
                {
                    Alert.Show("第一发明人不能为空!");
                    return;
                }
                if (tAccreditTime.SelectedDate < tApplicationTime.SelectedDate)
                {
                    Alert.ShowInTop("授权时间不能小于申请时间!");
                    return;
                }
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                pa.EntryPerson = username;
                //pa.Member = PatentMember.Text.Trim();
                List <string> list = new List <string>();
                string        unit = "";
                list.Add(tPatentDepartment1.Text.ToString());
                list.Add(tPatentDepartment2.Text.ToString());
                list.Add(tPatentDepartment3.Text.ToString());
                List <string> newlist = new List <string>();
                for (int i = 0; i < 3; i++)
                {
                    if (!string.IsNullOrEmpty(list[i].ToString()))
                    {
                        newlist.Add(list[i].ToString());
                    }
                }

                if (newlist.Count != 0)
                {
                    for (int j = 0; j < newlist.Count; j++)
                    {
                        unit += newlist[j].ToString();
                        if (j == newlist.Count() - 1)
                        {
                            break;
                        }
                        unit += ",";
                    }
                    pa.PatentDepartment = unit;
                }
                else
                {
                    pa.PatentDepartment = null;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    InsertValue();
                    pa.IsPass = true;
                    //lby ↓
                    int attachid = pm.UpLoadFile(PatentFile).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("专利证书文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("专利证书文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        pa.Attachment_Patent = attachid;
                    }
                    else
                    {
                        pa.Attachment_Patent = null;
                    }

                    attachid = pm.UpLoadFile(ApplicationFile).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("申请书文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("申请书文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        pa.Attachment_Application = attachid;
                    }
                    else
                    {
                        pa.Attachment_Application = null;
                    }
                    if (tAchievement.SelectedItem != null)
                    {
                        pa.AchievementID = tAchievement.SelectedItem.Text;
                    }
                    else
                    {
                        pa.AchievementID = tAchievement.Text;
                    }
                    patent.Insert(pa);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else
                {
                    InsertValue();
                    pa.IsPass = false;
                    //lby ↓
                    int attachid = pm.UpLoadFile(PatentFile).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("专利证书文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("专利证书文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        pa.Attachment_Patent = attachid;
                    }
                    else
                    {
                        pa.Attachment_Patent = null;
                    }

                    attachid = pm.UpLoadFile(ApplicationFile).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("申请书文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("申请书文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        pa.Attachment_Application = attachid;
                    }
                    else
                    {
                        pa.Attachment_Application = null;
                    }

                    patent.Insert(pa);
                    operate.LoginName        = username;
                    operate.OperationTime    = DateTime.Now;
                    operate.LoginIP          = " ";
                    operate.OperationContent = "Patent";
                    operate.OperationType    = "添加";
                    operate.OperationDataID  = pa.PatentID;
                    op.Insert(operate);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                //lby ↓
                if (pa.Attachment_Patent != null && pa.Attachment_Application != null)
                {
                    int[]  attachid         = { pa.Attachment_Patent.Value, pa.Attachment_Application.Value };
                    string path_Patent      = at.FindPath(attachid[0]);
                    string path_Application = at.FindPath(attachid[1]);
                    pm.DeleteFile(attachid[0], path_Patent);
                    pm.DeleteFile(attachid[1], path_Application);
                }
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 21
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            /*try
             * {*/

            if (tAchievement.Text.Trim() == "")
            {
                Alert.Show("项目名称不能为空!");
                return;
            }
            if (tCAUnit.Text.Trim() == "")
            {
                Alert.Show("验收部门不能为空!");
                return;
            }
            if (tCAUnit.Text.Trim() == "")
            {
                Alert.Show("成员不能为空!");
                return;
            }
            if (tCACommnetLevel.Text.Trim() == "")
            {
                Alert.Show("验收评语级别不能为空!");
                return;
            }
            string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;

            ahievementca.EntryPerson = username;
            if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
            {
                ahievementca.IsPass = true;
                int attachid = pm.UpLoadFile(fileupload).Attachid;
                switch (attachid)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

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

                case -2:
                    Alert.ShowInTop("文件不能大于150M");
                    return;
                }
                if (attachid != -3)
                {
                    ahievementca.AttachmentID = attachid;
                }
                else
                {
                    ahievementca.AttachmentID = null;
                }
                InsertValue();
                ca.Insert(ahievementca);
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
            }
            else
            {
                ahievementca.IsPass = false;
                int attachid = pm.UpLoadFile(fileupload).Attachid;
                switch (attachid)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

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

                case -2:
                    Alert.ShowInTop("文件不能大于150M");
                    return;
                }
                if (attachid != -3)
                {
                    ahievementca.AttachmentID = attachid;
                }
                else
                {
                    ahievementca.AttachmentID = null;
                }
                InsertValue();
                ca.Insert(ahievementca);
                operate.LoginName        = username;
                operate.OperationTime    = DateTime.Now;
                operate.LoginIP          = " ";
                operate.OperationContent = "AchievementCA";
                operate.OperationType    = "添加";
                operate.OperationDataID  = ahievementca.AchievementCAID;
                op.Insert(operate);
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
            }

            /*}
             * catch (Exception ex)
             * {
             *  int attachid = Convert.ToInt32(ahievementca.AttachmentID);
             *  string path = at.FindPath(attachid);
             *  pm.DeleteFile(attachid, path);
             *  pm.SaveError(ex, this.Request);
             * }*/
        }
Esempio n. 22
0
        //保存资料信息
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["LoginName"].ToString() == "")
                {
                    Response.Redirect("login.aspx");
                    Alert.Show("登录超时!");
                }
                if (txtContractHeadLine.Text.Trim() == "")
                {
                    Alert.ShowInTop("资料题目不能为空!");
                    txtContractHeadLine.Reset();
                    return;
                }
                if (txtContractAuthors.Text.Trim() == "")
                {
                    Alert.ShowInTop("资料保存人不能为空!");
                    txtContractAuthors.Reset();
                    return;
                }
                if (txtContractOriginal.Text.Trim() == "")
                {
                    Alert.ShowInTop("原始文件保存人不能为空 ! ");
                    txtContractOriginal.Reset();
                    return;
                }
                NewContract.ContractAuthors  = txtContractAuthors.Text;
                NewContract.ContractHeadLine = txtContractHeadLine.Text;
                NewContract.ContractOriginal = txtContractOriginal.Text;
                NewContract.EntryPerson      = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                NewContract.SecrecyLevel     = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue);
                //上传附件
                int AttachID = pm.UpLoadFile(fileupload).Attachid;
                switch (AttachID)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

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

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

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

                //Alert.ShowInTop("请上传附件");
                //return;
                default:
                    NewContract.AttachmentID = AttachID;
                    break;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    NewContract.IsPass = true;
                    //向资料表中插入数据
                    BLLcontract.Insert(NewContract);
                    Alert.ShowInTop("保存成功");
                }
                else
                {
                    NewContract.IsPass = false;
                    //向资料表中插入数据
                    BLLcontract.Insert(NewContract);
                    //向操作日志表中插入信息
                    operationLog.LoginIP          = " ";
                    operationLog.LoginName        = Session["LoginName"].ToString();
                    operationLog.OperationType    = "添加";
                    operationLog.OperationContent = "Contract";
                    operationLog.OperationTime    = DateTime.Now;
                    operationLog.OperationDataID  = NewContract.ContractID;
                    //向操作日志表中插入数据
                    BLLOL.Insert(operationLog);
                    Alert.ShowInTop("您的数据已提交,请等待确认");
                }

                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
            }
            catch (Exception ex)
            {
                int ContractID = NewContract.ContractID;
                //删除资料附件
                int    AttactID = BLLcontract.FindAttachmentID(ContractID);
                string strPath;
                if (AttactID != 0)
                {
                    strPath = BLLattachment.FindPath(AttactID);
                    if (strPath != "")
                    {
                        //删除附件文件
                        pm.DeleteFile(AttactID, strPath);
                        //在附件表中删除附件数据
                        BLLattachment.Delete(AttactID);
                    }
                }
                //BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 23
0
        //保存更新
        protected void AddWriter_Click(object sender, EventArgs e)
        {
            try
            {
                //if (tSubject.Text.Trim() == "")
                //{
                //    Alert.Show("题目不能为空!");
                //    return;
                //}
                //if (tPublicJournalName.Text.Trim() == "")
                //{
                //    Alert.Show("发表刊物不能为空!");
                //    return;
                //}
                //if (PaperPeople.Text.Trim() == "")
                //{
                //    Alert.Show("全部作者不能为空!");
                //    return;
                //}
                //if (FirstWriter.Text.Trim() == "")
                //{
                //    Alert.Show("第一作者不能为空!");
                //    return;
                //}
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    UpdateValue();
                    paper.PaperID = Convert.ToInt32(Session["PaperID"]);
                    paper.IsPass  = true;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        paper.AttachmentID = attachid;
                    }
                    else
                    {
                        if (papers.FindAttachment(Convert.ToInt32(Session["PaperID"])) != 0)
                        {
                            paper.AttachmentID = null;
                        }
                    }
                    papers.Update(paper);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功"));
                }
                else
                {
                    UpdateValue();
                    paper.IsPass = false;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

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

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        paper.AttachmentID = attachid;
                    }
                    else
                    {
                        paper.AttachmentID = null;
                    }
                    papers.Insert(paper);
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Paper";
                    log.OperationType    = "更新";
                    log.OperationDataID  = Convert.ToInt32(Session["PaperID"]);
                    log.Remark           = (Convert.ToInt32(papers.FindByPaperNames(paper.Subject, Convert.ToInt32(Session["PaperID"])))).ToString();
                    op.Insert(log);
                    papers.UpdateIsPass(Convert.ToInt32(Session["PaperID"]), false);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }
Esempio n. 24
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtReportPeople.Text.Trim() == "")
                {
                    Alert.ShowInTop("姓名不能为空!");
                    txtReportPeople.Reset();
                    return;
                }
                if (txtReportUnit.Text.Trim() == "")
                {
                    Alert.ShowInTop("报告人单位不能为空!");
                    txtReportUnit.Reset();
                    return;
                }
                if (txtReportName.Text.Trim() == "")
                {
                    Alert.ShowInTop("学术报告名称不能为空!");
                    txtReportName.Reset();
                    return;
                }
                if (txtReportPlace.Text.Trim() == "")
                {
                    Alert.ShowInTop("报告地点不能为空!");
                    txtReportPlace.Reset();
                    return;
                }
                if (DatePikerReportTime.Text == "")
                {
                    Alert.ShowInTop("报告时间不能为空!");
                    DatePikerReportTime.Reset();
                    return;
                }

                if (txtPeopleCount.Text.Trim() == "")
                {
                    Alert.ShowInTop("参与人数不能为空!");
                    txtPeopleCount.Reset();
                    return;
                }

                newacademicreporting         = BLLNAR.FindByNAReportingID(Convert.ToInt32(Session["NewAcademicReporting"]));
                Newnareporting.ReportTime    = Convert.ToDateTime(DatePikerReportTime.Text);
                Newnareporting.PeopleCount   = Convert.ToInt32(txtPeopleCount.Text.Trim());
                Newnareporting.SecrecyLevel  = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue);
                Newnareporting.Remark        = Remark.Text;
                Newnareporting.ReportPeople  = txtReportPeople.Text;
                Newnareporting.JobName       = txtJobName.Text;
                Newnareporting.JobMission    = txtJobMission.Text;
                Newnareporting.ReportUnit    = txtReportUnit.Text;
                Newnareporting.Report        = txtReport.Text;
                Newnareporting.ReportTele    = txtReportTele.Text;
                Newnareporting.AcademicTitle = txtAcademicTitle.Text;
                Newnareporting.ReportName    = txtReportName.Text;
                Newnareporting.ReportPlace   = txtReportPlace.Text;
                Newnareporting.ApplyFund     = txtApplyFund.Text;
                Newnareporting.Organizers    = txtOrganizers.Text;
                Newnareporting.Coorganizer   = txtCoorganizer.Text;
                Newnareporting.ReportType    = txtReportType.Text;
                Newnareporting.MajorPeople   = txtMajorPeople.Text;
                Newnareporting.EntryPerson   = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                //用户等级为5级可直接通过
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    Newnareporting.IsPass = true;
                }
                else
                {
                    Newnareporting.IsPass = false;
                }

                int AttachID = pm.UpLoadFile(fileupload).Attachid;
                switch (AttachID)
                {
                case -1:
                    Alert.ShowInTop("文件类型不符,请重新选择!");
                    return;

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

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

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

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

                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    //操作日志表对象
                    Common.Entities.OperationLog operationLog = InsertOperationLog();
                    operationLog.OperationDataID = Convert.ToInt32(Session["NewAcademicReportingID"]);
                    Newnareporting.EntryPerson   = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    Newnareporting.IsPass        = false;
                    newacademicreporting.IsPass  = false;
                    BLLNAR.Insert(Newnareporting);
                    operationLog.Remark = Newnareporting.NewAcademicReportingID.ToString();
                    BLLOL.Insert(operationLog);
                    Alert.ShowInTop("您的数据已提交,请等待确认");
                }
                else
                {
                    Newnareporting.NewAcademicReportingID = Convert.ToInt32(Session["NewAcademicReportingID"]);
                    BLLNAR.Update(Newnareporting);
                    Alert.ShowInTop("保存成功");
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
            }
            catch (Exception ex)
            {
                //删除附件文件
                string path = BLLattachment.FindPath(Convert.ToInt32(newacademicreporting.AttachmentID));
                if (path != "")
                {
                    pm.DeleteFile(Convert.ToInt32(newacademicreporting.AttachmentID), path);
                    //删除附件表中的数据
                    BLLattachment.Delete(Convert.ToInt32(newacademicreporting.AttachmentID));//删除成功返回true
                }
                //BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
            }
            //PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
        }
Esempio n. 25
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                //if (tMonographName.Text.Trim() == "")
                //{
                //    Alert.Show("著作名称不能为空!");
                //    return;
                //}
                //if (MoPeople.Text.Trim() == "")
                //{
                //    Alert.Show("著作人不能为空!");
                //    return;
                //}
                //if (TFirstWriter.Text.Trim() == null)
                //{
                //    Alert.Show("第一作者不能为空!");
                //    return;
                //}

                /*int AchievementID = ach.FindByAchievementName(tAchievement.Text.Trim());
                 * if (AchievementID != 0)
                 * {
                 *  monh.AchievementID = AchievementID;
                 * }
                 * else
                 * {
                 *  monh.AchievementID = null;
                 * }*/
                monh.BookNuber = tBookNuber.Text.Trim();
                // monh.EntryPerson = Session["LoginName"].ToString();
                monh.EntryPerson   = mo.FindAll(Convert.ToInt32(Session["MonographID"])).EntryPerson;
                monh.MonographName = tMonographName.Text.Trim();

                monh.PaperUnit    = DropDownListAgency.SelectedText; //所属机构
                monh.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1);
                //monh.Sort = tSort.Text.Trim();
                monh.PUblicationTime = dPUblicationTime.SelectedDate;
                monh.Publisher       = tPublisher.Text.Trim();
                monh.Revision        = tRevision.Text.Trim();
                monh.MonographPeople = MoPeople.Text.Trim();
                //monh.MDepartment = DropDownListAgency.SelectedText.Trim();
                monh.CIPNum         = tCIP.Text.Trim();
                monh.ISBNNum        = tISBN.Text.Trim();
                monh.FirstWriter    = TFirstWriter.Text.Trim();
                monh.WriterIdentity = dPaperIdentity.SelectedValue.Trim();
                monh.MonographType  = ddlMonographType.SelectedValue.Trim();
                monh.IssueRegin     = tIssueRegin.Text.Trim();
                monh.Remark         = tRemark.Text.Trim();
                int    BAttachmentID = Convert.ToInt32(mo.IsExitAttacment(Convert.ToInt32(Session["MonographID"])).BAttachmentID);
                int    FAttachmentID = Convert.ToInt32(mo.IsExitAttacment(Convert.ToInt32(Session["MonographID"])).FAttachmentID);
                string Bpath         = at.FindPath(BAttachmentID);
                string Fpath         = at.FindPath(FAttachmentID);
                int    Battachid     = pm.UpLoadFile(fileuploadB).Attachid;
                string nbpath        = at.FindPath(Battachid);
                int    Fattachid     = pm.UpLoadFile(fileuploadF).Attachid;
                switch (Battachid)
                {
                case -1:
                    Alert.ShowInTop("版权页文件类型不符,请重新选择!");
                    return;

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

                case -2:
                    Alert.ShowInTop("版权页文件不能大于150M");
                    return;
                }
                switch (Fattachid)
                {
                case -1:
                    Alert.ShowInTop("封面文件类型不符,请重新选择!");
                    pm.DeleteFile(Battachid, nbpath);
                    return;

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

                case -2:
                    Alert.ShowInTop("封面文件不能大于150M");
                    pm.DeleteFile(Battachid, nbpath);
                    return;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    monh.IsPass      = true;
                    monh.MonographID = Convert.ToInt32(Session["MonographID"]);
                    if (Battachid != -3)
                    {
                        monh.BAttachmentID = Battachid;
                        if (BAttachmentID != 0)
                        {
                            pm.DeleteFile(BAttachmentID, Bpath);
                        }
                    }
                    else
                    {
                        if (BAttachmentID != 0)
                        {
                            monh.BAttachmentID = BAttachmentID;
                        }
                    }
                    if (Fattachid != -3)
                    {
                        monh.FAttachmentID = Fattachid;
                        if (FAttachmentID != 0)
                        {
                            pm.DeleteFile(FAttachmentID, Fpath);
                        }
                    }
                    else
                    {
                        if (FAttachmentID != 0)
                        {
                            monh.FAttachmentID = FAttachmentID;
                        }
                    }
                    mo.Update(monh);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功"));
                }
                else
                {
                    monh.IsPass = false;
                    if (Battachid != -3)
                    {
                        monh.BAttachmentID = Battachid;
                    }
                    else
                    {
                        if (BAttachmentID != 0)
                        {
                            monh.BAttachmentID = BAttachmentID;
                        }
                    }
                    if (Fattachid != -3)
                    {
                        monh.FAttachmentID = Fattachid;
                    }
                    else
                    {
                        if (FAttachmentID != 0)
                        {
                            monh.FAttachmentID = FAttachmentID;
                        }
                    }
                    mo.Insert(monh);
                    mo.UpdateIsPass(Convert.ToInt32(Session["MonographID"]), false);
                    log.LoginIP = "";
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    log.LoginName        = username;
                    log.OperationContent = "Monograph";
                    log.OperationTime    = DateTime.Now;
                    log.OperationType    = "更新";
                    log.OperationDataID  = Convert.ToInt32(Session["MonographID"]);
                    log.Remark           = monh.MonographID.ToString();
                    op.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                int    attachidb = Convert.ToInt32(monh.BAttachmentID);
                int    attachidf = Convert.ToInt32(monh.FAttachmentID);
                string pathb     = at.FindPath(attachidb);
                string pathf     = at.FindPath(attachidf);
                pm.DeleteFile(attachidb, pathb);
                pm.DeleteFile(attachidf, pathf);
                pm.SaveError(ex, this.Request);
            }
        }