//搜索条件即搜索框变化
        protected void dChoose_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (dChoose.SelectedValue)
            {
            case "全部":
                dCondition.Enabled = false;
                tCondition.Enabled = false;
                break;

            /*case "类别":
             *  dCondition.Enabled = false;
             *  tCondition.Enabled = true;
             *  break;*/
            case "作者":
                dCondition.Enabled = false;
                tCondition.Enabled = true;
                break;

            case "出版年份":
                dCondition.Items.Clear();
                for (int i = 1960; i <= 2060; i++)
                {
                    dCondition.Items.Add(i.ToString(), i.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.Enabled           = true;
                tCondition.Enabled           = false;
                break;

            case "第一作者身份":
                dCondition.Items.Clear();
                List <BasicCode> list1 = ba.FindByCategoryName("第一作者身份");
                for (int i = 0; i < list1.Count(); i++)
                {
                    dCondition.Items.Add(list1[i].CategoryContent.ToString(), list1[i].CategoryContent.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                tCondition.Enabled           = false;
                dCondition.Enabled           = true;
                break;

            case "部门":
                dCondition.Items.Clear();
                BLHelper.BLLAgency            agency = new BLHelper.BLLAgency();
                List <Common.Entities.Agency> list   = agency.FindAllAgencyName();
                for (int i = 0; i < list.Count(); i++)
                {
                    dCondition.Items.Add(list[i].AgencyName.ToString(), list[i].AgencyName.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                tCondition.Enabled           = false;
                dCondition.Enabled           = true;
                break;
            }
        }
Beispiel #2
0
        //初始化机构下拉框
        public void InitDropListAgency()
        {
            BLHelper.BLLAgency            agency = new BLHelper.BLLAgency();
            List <Common.Entities.Agency> list   = agency.FindAllAgencyName();

            for (int i = 0; i < list.Count(); i++)
            {
                DropDownListAgency.Items.Add(list[i].AgencyName.ToString(), list[i].AgencyName.ToString());
            }
        }
 //lby 初始化机构下拉框
 public void InitDropListAgency()
 {
     try
     {
         List<Common.Entities.Agency> list = new BLHelper.BLLAgency().FindAll(Convert.ToInt32(Session["SecrecyLevel"]));
         for (int i = 0; i < list.Count(); ++i)
             Agency.Items.Add(list[i].AgencyName, list[i].AgencyName);
     }
     catch (Exception ex)
     {
         publicmethod.SaveError(ex, this.Request);
     }
 }
Beispiel #4
0
 //初始化机构下拉框
 public void InitDropListAgency()
 {
     try
     {
         BLHelper.BLLAgency            agency = new BLHelper.BLLAgency();
         List <Common.Entities.Agency> list   = agency.FindAllAgencyName();
         for (int i = 0; i < list.Count(); i++)
         {
             DropDownListAgency.Items.Add(list[i].AgencyName.ToString(), list[i].AgencyName.ToString());
         }
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }
Beispiel #5
0
        //初始化下拉框
        public void InitDropList()
        {
            BLHelper.BLLAgency agency = new BLHelper.BLLAgency();
            List <Agency>      list   = agency.FindAllAgencyName();

            for (int i = 0; i < list.Count(); i++)
            {
                DropDownListAgency.Items.Add(list[i].AgencyName.ToString(), (i + 1).ToString());
            }

            string[] SecrecyLevels = new string[] { "四级", "三级", "二级", "一级", "管理员" };
            for (int i = 0; i < Convert.ToInt32(Session["SecrecyLevel"]); i++)
            {
                DroSecrecyLevel.Items.Add(SecrecyLevels[i], i.ToString());
            }
        }
Beispiel #6
0
 //根据所属部门查询
 public void FindByDepartment()
 {
     try
     {
         ViewState["page"] = 6;
         BLHelper.BLLAgency BLLAgency   = new BLHelper.BLLAgency();
         List <Student>     StudentList = bllStudent.FindByDepartment(BLLAgency.SelectAgencyID(DropDownList.SelectedItem.Text));
         GridProjectStudent.RecordCount = StudentList.Count();
         var result = StudentList.Skip(GridProjectStudent.PageIndex * GridProjectStudent.PageSize).Take(GridProjectStudent.PageSize).ToList();
         this.GridProjectStudent.DataSource = result;
         this.GridProjectStudent.DataBind();
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         publicmethod.SaveError(ex, this.Request);
     }
 }
Beispiel #7
0
 //根据机构名查找设备信息
 private void FindByAgencyID()
 {
     try
     {
         BLHelper.BLLAgency blag = new BLHelper.BLLAgency();
         //int agencyid = blag.SelectAgencyID(tCondition.Text.Trim());
         ViewState["page"] = 6;
         List <Common.Entities.Equipment> list = bllequipment.FindByAgencyID(tCondition.Text.Trim(), Convert.ToInt32(Session["SecrecyLevel"]));
         Grid_Equipment.RecordCount = list.Count();//改变分页数
         if (list != null)
         {
             this.Grid_Equipment.DataSource = list.Skip(Grid_Equipment.PageIndex * Grid_Equipment.PageSize).Take(Grid_Equipment.PageSize);
             this.Grid_Equipment.DataBind();
         }
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }
Beispiel #8
0
        //数据绑定
        private void BindData()
        {
            try
            {
                //初始化机构下拉框
                BLHelper.BLLAgency            agency = new BLHelper.BLLAgency();
                List <Common.Entities.Agency> list   = agency.FindAllAgencyName();
                for (int i = 0; i < list.Count(); i++)
                {
                    ddl_agencyname.Items.Add(list[i].AgencyName.ToString(), list[i].AgencyName.ToString());
                }
                //初始化等级下拉框
                string[] SecrecyLevels = new string[] { "四级", "三级", "二级", "一级", "管理员" };
                for (int i = 0; i < Convert.ToInt32(Session["SecrecyLevel"]); i++)
                {
                    ddl_Level.Items.Add(SecrecyLevels[i], i.ToString());
                }

                Common.Entities.Furniture furniture = bllfurni.FindByid(Convert.ToInt32(Session["FurnitureID"]));
                tb_FurnitureName.Text   = furniture.FurnitureName;
                tb_price.Text           = furniture.Price;
                tb_Purchase.Text        = furniture.Purchase;
                tb_UsePerson.Text       = furniture.UsePerson;
                ddl_Level.SelectedIndex = furniture.SecrecyLevel.Value - 1;
                //ddl_agencyname.SelectedValue = agency.FindAgenName(furniture.AgencyID.Value);
                if (furniture.IsGowerProcu.Value)
                {
                    ddl_isgov.SelectedIndex = 0;
                }
                else
                {
                    ddl_isgov.SelectedIndex = 1;
                }
                dp_PurchaseTime.SelectedDate = furniture.PurchaseTime;
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }
Beispiel #9
0
        //初始化文本框数据
        public void TextChange()
        {
            BLHelper.BLLAgency     agen = new BLHelper.BLLAgency();
            Common.Entities.Agency ag   = new Common.Entities.Agency();

            if (Session["AgencyName"].ToString() == "")
            {
                return;
            }

            ag = agen.FindByName(Session["AgencyName"].ToString());
            AgencyName2.Text = Session["AgencyName"].ToString();
            if (ag.ParentID != null)
            {
                string str = agen.FindAgenName(Convert.ToInt32(ag.ParentID));
                if (str != "")
                {
                    ParentID2.Text = str;
                }
                else
                {
                    ParentID2.Text = "  ";
                }
            }
            else
            {
                ParentID2.Text = " ";
            }

            if (ag.SecrecyLevel != null)
            {
                DroSecrecyLevel.SelectedValue = (ag.SecrecyLevel - 1).ToString();
            }
            else
            {
                DroSecrecyLevel.Text = " ";
            }

            if (ag.AgencyHeads != null)
            {
                AgencyHeads2.Text = ag.AgencyHeads.ToString();
            }
            else
            {
                AgencyHeads2.Text = " ";
            }

            if (ag.Research != null)
            {
                Research2.Text = ag.Research.ToString();
            }
            else
            {
                Research2.Text = " ";
            }

            if (ddl_glo.SelectedText == ag.IsGlobal.Trim())
            {
                ddl_glo.Items[0].Selected = true;
            }
            else
            {
                ddl_glo.Items[1].Selected = true;
            }

            if (ag.FullTimeNumbers != null)
            {
                FullTimeNumber2.Text = ag.FullTimeNumbers.ToString();
            }
            else
            {
                FullTimeNumber2.Text = " ";
            }

            if (ag.PartTimeNumbers != null)
            {
                PartTimeNumber2.Text = ag.PartTimeNumbers.ToString();
            }
            else
            {
                PartTimeNumber2.Text = " ";
            }

            if (ag.Area != null)
            {
                Area2.Text = ag.Area.ToString();
            }
            else
            {
                Area2.Text = " ";
            }

            if (ag.Location != null)
            {
                Location2.Text = ag.Location.ToString();
            }
            else
            {
                Location2.Text = " ";
            }
        }
Beispiel #10
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);
            }
        }
        //保存
        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);
            }
        }
Beispiel #12
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            BLCommon.PublicMethod pm   = new BLCommon.PublicMethod();
            BLHelper.BLLUser      user = new BLHelper.BLLUser();
            try
            {
                if (tName.Text.Trim() == "")
                {
                    Alert.ShowInTop("姓名不能为空!");
                    tName.Text = "";
                    return;
                }
                if (tLearnPlace.Text.Trim() == "")
                {
                    Alert.ShowInTop("进修地点不能为空!");
                    tLearnPlace.Text = "";
                    return;
                }
                if (tLearnSchool.Text.Trim() == "")
                {
                    Alert.ShowInTop("进修学校不能为空!");
                    tLearnSchool.Text = "";
                    return;
                }
                if (tLearnContent.Text.Trim() == "")
                {
                    Alert.ShowInTop("进修内容不能为空!");
                    tLearnContent.Text = "";
                    return;
                }

                if (dLearnEndTime.SelectedDate < dLearnBeginTime.SelectedDate)
                {
                    Alert.ShowInTop("结束时间不能小于开始时间!");
                    return;
                }
                BLHelper.BLLAgency       agency = new BLHelper.BLLAgency();
                OperationLog             op     = new OperationLog();
                BLHelper.BLLOperationLog blop   = new BLHelper.BLLOperationLog();

                fu.Name = tName.Text.Trim();
                if (dBirthday.SelectedDate != null)
                {
                    fu.Birthday = Convert.ToDateTime(dBirthday.Text.Trim());
                }
                fu.DocuType       = tDocuType.SelectedText.Trim();
                fu.IDNum          = tIDNum.Text.Trim();
                fu.Email          = tEmail.Text.Trim();
                fu.Hometown       = tHometown.Text.Trim();
                fu.LearnBeginTime = dLearnBeginTime.SelectedDate;
                fu.LearnContent   = tLearnContent.Text.Trim();
                if (dLearnEndTime.SelectedDate != null)
                {
                    fu.LearnEndTime = dLearnEndTime.SelectedDate;
                }
                fu.LearnPlace  = tLearnPlace.Text.Trim();
                fu.LearnSchool = tLearnSchool.Text.Trim();
                fu.PhoneNum    = tPhoneNum.Text.Trim();
                fu.Profile     = tPintroduce.Text.Trim();
                fu.Remark      = tRemark.Text.Trim();

                fu.SecrecyLevel = Convert.ToInt32(DroSecrecyLevel.SelectedValue.Trim()) + 1;

                if (rbtnBoy.Checked == true)
                {
                    fu.Sex = true;
                }
                else
                {
                    fu.Sex = false;
                }

                fu.AgencyID = agency.SelectAgencyID(DropDownListAgency.SelectedText);
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                fu.EntryPerson = username;

                if (Convert.ToInt32(Session["SecrecyLevel"].ToString()) == 5)
                {
                    fu.IsPass = true;
                    futherstudy.Insert(fu);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!"));
                }
                else
                {
                    fu.IsPass = false;
                    futherstudy.Insert(fu);
                    op.LoginIP          = "";
                    op.LoginName        = Session["LoginName"].ToString();
                    op.OperationContent = "FutherStudy";
                    op.OperationDataID  = futherstudy.FindIdByNT(tName.Text.Trim().ToString(), dLearnBeginTime.SelectedDate.Value);
                    op.OperationType    = "添加";
                    op.OperationTime    = DateTime.Now;
                    blop.Insert(op);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHidePostBackReference() + Alert.GetShowInTopReference("数据已经提交,请等待管理员确认!"));
                }
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }
Beispiel #13
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            BLHelper.BLLFurniture    blfurni = new BLHelper.BLLFurniture();
            BLHelper.BLLUser         user    = new BLHelper.BLLUser();
            BLHelper.BLLAgency       agency  = new BLHelper.BLLAgency();
            BLHelper.BLLOperationLog op      = new BLHelper.BLLOperationLog();

            Common.Entities.Furniture    furniture = new Common.Entities.Furniture();
            Common.Entities.OperationLog log       = new Common.Entities.OperationLog();
            try
            {
                if (string.IsNullOrEmpty(tb_FurnitureName.Text.Trim()))
                {
                    Alert.ShowInTop("请填写家具名称!");
                    return;
                }
                furniture.FurnitureName = tb_FurnitureName.Text.Trim();
                if (ddl_isgov.SelectedIndex == 0)
                {
                    furniture.IsGowerProcu = true;
                }
                else
                {
                    furniture.IsGowerProcu = false;
                }
                if (ddl_isshare.SelectedIndex == 0)
                {
                    furniture.IsShare = true;
                }
                else
                {
                    furniture.IsShare = false;
                }
                //furniture.AgencName = tb_Agency.Text.Trim();
                furniture.AgencName = ddl_Agency.SelectedText;

                furniture.CategoryName    = "无";
                furniture.CategoryName    = ddl_Category.SelectedText.Trim();
                furniture.ClassNum        = tb_ClassNum.Text.Trim();
                furniture.EquipNum        = tb_Equipnum.Text.Trim();
                furniture.Manufacturer    = tb_Manufacturer.Text.Trim();
                furniture.MeasurementUnit = tb_MeasurementUnit.Text.Trim();
                furniture.Model           = tb_Model.Text.Trim();
                furniture.Remarks         = tb_Remarks.Text.Trim();
                furniture.StorageLocation = tb_StorageLocation.Text.Trim();


                furniture.Price        = tb_price.Text.Trim();
                furniture.Purchase     = tb_Purchase.Text.Trim();
                furniture.PurchaseTime = dp_PurchaseTime.SelectedDate.Value;
                furniture.UsePerson    = tb_UsePerson.Text.Trim();
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                furniture.EntryPerson  = username;
                furniture.SecrecyLevel = Convert.ToInt32(ddl_Level.SelectedIndex + 1);

                //furniture.AgencyID = agency.SelectAgencyID(ddl_agencyname.SelectedText.Trim());
                if (Convert.ToInt32(Session["SecrecyLevel"]) < 5)
                {
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Furnitures";
                    log.OperationType    = "添加";
                    furniture.IsPass     = false;

                    blfurni.Insert(furniture);//插入家具表
                    log.OperationDataID = furniture.FurnitureID;
                    op.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待审核!"));
                }
                else
                {
                    furniture.IsPass = true;
                    blfurni.Insert(furniture);//插入家具表
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功"));
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop("保存出错,请联系管理员!");
                pm.SaveError(ex, this.Request);
            }
        }
Beispiel #14
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);
            }
        }
Beispiel #15
0
        //搜索框变化
        protected void dChoose_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (dChoose.SelectedValue)
            {
            case "全部":
                dCondition.Enabled = false;
                tCondition.Enabled = false;
                break;

            case "部门":
                dCondition.Items.Clear();
                BLHelper.BLLAgency            agency = new BLHelper.BLLAgency();
                List <Common.Entities.Agency> list   = agency.FindAllAgencyName();
                for (int i = 0; i < list.Count(); i++)
                {
                    dCondition.Items.Add(list[i].AgencyName.ToString(), list[i].AgencyName.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                tCondition.Enabled           = false;
                dCondition.Enabled           = true;
                break;

            case "发表年份":
                dCondition.Items.Clear();
                for (int i = 1960; i <= 2060; i++)
                {
                    dCondition.Items.Add(i.ToString(), i.ToString());
                }
                dCondition.Items[0].Selected = true;
                //dCondition.EnableEdit = false;
                dCondition.Enabled = true;
                tCondition.Enabled = false;
                break;

            case "第一作者身份":
                dCondition.Items.Clear();
                List <BasicCode> list1 = ba.FindByCategoryName("第一作者身份");
                //List<Common.Entities.Paper> list1 = paper.FindByFirstWriterPosition();
                for (int i = 0; i < list1.Count(); i++)
                {
                    dCondition.Items.Add(list1[i].CategoryContent.ToString(), list1[i].CategoryContent.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                tCondition.Enabled           = false;
                dCondition.Enabled           = true;
                break;

            case "发表状态":
                dCondition.Items.Clear();
                List <BasicCode> list2 = ba.FindByCategoryName("发表状态");
                for (int i = 0; i < list2.Count(); i++)
                {
                    dCondition.Items.Add(list2[i].CategoryContent.ToString(), list2[i].CategoryContent.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                tCondition.Enabled           = false;
                dCondition.Enabled           = true;
                break;

            case "作者":
                dCondition.Enabled = false;
                tCondition.Enabled = true;
                break;

            case "刊物级别":
                dCondition.Items.Clear();
                List <BasicCode> listname = ba.FindByCategoryName("刊物级别");
                for (int i = 0; i < listname.Count(); i++)
                {
                    dCondition.Items.Add(listname[i].CategoryContent.ToString(), listname[i].CategoryContent.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                dCondition.Enabled           = true;
                tCondition.Enabled           = false;
                break;

            case "收录情况":
                dCondition.Items.Clear();
                List <BasicCode> listname1 = ba.FindByCategoryName("收录情况");
                for (int i = 0; i < listname1.Count(); i++)
                {
                    dCondition.Items.Add(listname1[i].CategoryContent.ToString(), listname1[i].CategoryContent.ToString());
                }
                dCondition.Items[0].Selected = true;
                dCondition.EnableEdit        = false;
                dCondition.Enabled           = true;
                tCondition.Enabled           = false;
                break;
            }
        }
Beispiel #16
0
        //保存
        protected void Save_Click(object sender, EventArgs e)
        {
            BLHelper.BLLEquipment    blequip = new BLHelper.BLLEquipment();
            BLHelper.BLLUser         user    = new BLHelper.BLLUser();
            BLHelper.BLLAgency       agency  = new BLHelper.BLLAgency();
            BLHelper.BLLOperationLog op      = new BLHelper.BLLOperationLog();

            Common.Entities.Equipment    Equipment = new Common.Entities.Equipment();
            Common.Entities.OperationLog log       = new Common.Entities.OperationLog();
            try
            {
                //if (string.IsNullOrEmpty(tb_EquipmenteName.Text.Trim()))
                //{
                //    Alert.ShowInTop("请填写设备名称!");
                //    return;
                //}
                Equipment.EquipmentName = tb_EquipmenteName.Text.Trim();
                if (ddl_isgov.SelectedIndex == 0)
                {
                    Equipment.IsGowerProcu = true;
                }
                else
                {
                    Equipment.IsGowerProcu = false;
                }
                if (ddl_isshare.SelectedIndex == 0)
                {
                    Equipment.IsShare = true;
                }
                else
                {
                    Equipment.IsShare = false;
                }
                Equipment.Price        = tb_price.Text.Trim();
                Equipment.Purchase     = tb_Purchase.Text.Trim();
                Equipment.PurchaseTime = dp_PurchaseTime.SelectedDate;
                Equipment.UsePerson    = tb_UsePerson.Text.Trim();
                Equipment.EquipNum     = tb_Equipnum.Text.Trim();
                string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                Equipment.EntryPerson  = username;
                Equipment.SecrecyLevel = Convert.ToInt32(DropDownListSecrecyLevel.SelectedIndex + 1);
                //Equipment.AgencyID = agency.SelectAgencyID(ddl_agencyname.SelectedText.Trim());
                //Equipment.AgencName = tb_Agency.Text.Trim();
                Equipment.AgencName       = ddl_Agency.SelectedText;
                Equipment.CategoryName    = "无";
                Equipment.CategoryName    = ddl_Category.SelectedText;
                Equipment.ClassNum        = tb_ClassNum.Text.Trim();
                Equipment.Manufacturer    = tb_Manufacturer.Text.Trim();
                Equipment.MeasurementUnit = tb_MeasurementUnit.Text.Trim();
                Equipment.Model           = tb_Model.Text.Trim();
                Equipment.Remarks         = tb_Remarks.Text.Trim();
                Equipment.StorageLocation = tb_StorageLocation.Text.Trim();
                if (Convert.ToInt32(Session["SecrecyLevel"]) < 5)
                {
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Equipments";
                    log.OperationType    = "更新";
                    Equipment.IsPass     = false;

                    blequip.Insert(Equipment);//插入设备表
                    log.OperationDataID = Convert.ToInt32(Session["EquipmentID"]);
                    log.Remark          = Convert.ToString(Equipment.EquipmentID);
                    op.Insert(log);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待审核!"));
                }
                else
                {
                    Equipment.IsPass      = true;
                    Equipment.EquipmentID = Convert.ToInt32(Session["EquipmentID"]);
                    blequip.Update(Equipment);//更新设备表
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功"));
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop("保存出错,请联系管理员!");
                pm.SaveError(ex, this.Request);
            }
        }
Beispiel #17
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);
            }
        }
Beispiel #18
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);
            }
        }