示例#1
0
 //重置
 protected void Reset_Click(object sender, EventArgs e)
 {
     try
     {
         ProjectName2.Reset();
         ProjectName2.Reset();
         DropDownListAgencyP.Reset();
         AcceptUnit2.Reset();
         SourceUnit2.Reset();
         DropDownListProjectSort.Reset();
         DropDownListProjectSortName.Reset();
         DropDownListState.Reset();
         ApprovedMoney2.Reset();
         GetMoney2.Reset();
         DropDownListExpecteResults.Reset();//CooperationForms2.Reset();
         DropDownListProjectLevel.Reset();
         ProjectHeads2.Reset();
         DatePickerStartTime.Reset();
         DatePickerEndTime.Reset();
         DatePickerExpectEndTime.Reset();
         DropDownListExpecteResults.Reset();//ExpecteResults2.Reset();
         GivenMoneyUnits2.Reset();
         DropDownListNature.Reset();
         Remark2.Reset();
         DropDownListSecrecyLevel.Reset();
         ManageMoney.Reset();
         PactNum2.Reset();
         TaskNum2.Reset();
         ProjectManager.Reset();//项目负责人(前三)
         PageContext.RegisterStartupScript("clearFile();");
         PageContext.RegisterStartupScript("clearFiles();");
     }
     catch (Exception ex)
     {
         publicmethod.SaveError(ex, this.Request);
     }
 }
示例#2
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;
                }
                if (ProjectInNum.Text.Trim() == "")
                {
                    Alert.ShowInTop("项目内部编号(科技处)不能为空!");
                    ProjectInNum.Text = "";
                    return;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    aproject.IsPass = false;
                }
                else
                {
                    aproject.IsPass = true;
                }
                aproject.ProjectName     = ProjectName2.Text.Trim();
                aproject.AgencyID        = bllAgency.SelectAgencyID(DropDownListAgencyP.SelectedText);
                aproject.AcceptUnit      = AcceptUnit2.Text.Trim();
                aproject.SourceUnit      = SourceUnit2.Text.Trim();
                aproject.ProjectSortName = DropDownListProjectSortName.SelectedItem.Text;
                aproject.ProjectState    = DropDownListState.SelectedItem.Text;
                aproject.ApprovedMoney   = ApprovedMoney2.Text.Trim();
                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.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.Value;
                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.Text = "";
                        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.ProjectMember  = ProjectMember.Text.Trim();  //项目成员
                //经济效益附件
                //int attachidbenefit = pm.UpLoadFile(FileUploadFile).Attachid;
                //switch (attachidbenefit)
                //{
                //    case -1:
                //        Alert.ShowInTop("经济效益文件类型不符,请重新选择!");
                //        return;
                //    case 0:
                //        Alert.ShowInTop("经济效益文件名已经存在!");
                //        return;
                //    case -2:
                //        Alert.ShowInTop("经济效益文件不能大于150M");
                //        return;
                //}
                ////经济预算效益
                //int attachidbudget = pm.UpLoadFile(FileUploadFileM).Attachid;
                //switch (attachidbudget)
                //{
                //    case -1:
                //        Alert.ShowInTop("经费预算文件类型不符,请重新选择!");
                //        if (attachidbenefit != -1 && attachidbenefit != 0 && attachidbenefit != -2)
                //            pm.DeleteFile(attachidbenefit, bllAttachment.FindPath(attachidbenefit));
                //        return;
                //    case 0:
                //        Alert.ShowInTop("经费预算文件名已经存在!");
                //        if (attachidbenefit != -1 && attachidbenefit != 0 && attachidbenefit != -2)
                //            pm.DeleteFile(attachidbenefit, bllAttachment.FindPath(attachidbenefit));
                //        return;
                //    case -2:
                //        Alert.ShowInTop("经费预算文件不能大于150M");
                //        if (attachidbenefit != -1 && attachidbenefit != 0 && attachidbenefit != -2)
                //            pm.DeleteFile(attachidbenefit, bllAttachment.FindPath(attachidbenefit));
                //        return;
                //}
                ////经济效益
                //if (attachidbenefit != -3)
                //{
                //    aproject.BenefitAttachment = attachidbenefit;
                //}
                //else
                //{
                //    aproject.BenefitAttachment = null;
                //}
                ////经费预算
                //if (attachidbudget != -3)
                //{
                //    aproject.BudgetAttachment = attachidbudget;
                //}
                //else
                //{
                //    aproject.BudgetAttachment = null;
                //}
                aproject.EntryPerson = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                bllProject.InsertProject(aproject);
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    //向操作日志表中插入
                    OperationLog operate = new OperationLog();
                    operate.LoginName        = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    operate.LoginIP          = "";
                    operate.OperationType    = "添加";
                    operate.OperationContent = "Project";
                    operate.OperationDataID  = bllProject.SelectProjectID(ProjectName2.Text);
                    operate.OperationTime    = System.DateTime.Now;
                    operate.Remark           = "";
                    bllOperate.Insert(operate);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的操作已提交审核,请等待!"));
                }
                else
                {
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("项目信息已添加完成!"));
                }
            }
            catch (Exception ex)
            {
                pm.DeleteFile(Convert.ToInt32(aproject.BenefitAttachment), bllAttachment.FindPath(Convert.ToInt32(aproject.BenefitAttachment)));
                pm.DeleteFile(Convert.ToInt32(aproject.BudgetAttachment), bllAttachment.FindPath(Convert.ToInt32(aproject.BudgetAttachment)));
                pm.SaveError(ex, this.Request);
            }
        }