Esempio n. 1
0
 //按AchievementApplyID进行删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> selections = pm.GridCount(Grid_Achievementt, CBoxSelect);
         if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
         {
             for (int i = 0; i < selections.Count(); i++)
             {
                 achieve.Delete(Convert.ToInt32(Grid_Achievementt.DataKeys[selections[i]][0]));
             }
             InitData();
             btnSelect_All.Text = "全选";
             Alert.ShowInTop("删除数据成功!");
         }
         else
         {
             for (int i = 0; i < selections.Count(); i++)
             {
                 achieve.UpdateIsPass(Convert.ToInt32(Grid_Achievementt.DataKeys[selections[i]][0]), false);
                 //向操作日志表中插入
                 OperationLog operate = new OperationLog();
                 operate.LoginName        = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                 operate.LoginIP          = "";
                 operate.OperationType    = "删除";
                 operate.OperationContent = "ProjectImportantNode";
                 operate.OperationDataID  = Convert.ToInt32(Grid_Achievementt.DataKeys[selections[i]][0]);
                 operate.OperationTime    = System.DateTime.Now;
                 operate.Remark           = "";
                 bllOperate.Insert(operate);
             }
             btnSelect_All.Text = "全选";
             Alert.ShowInTop("您的操作已提交,请等待审核!");
             InitData();
         }
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }
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);
            }
        }