예제 #1
0
 protected void btn_DownLoadContract_Click(object sender, EventArgs e)
 {
     try
     {
         int unitLecturesID = Convert.ToInt32(Request.QueryString["id"].ToString());
         unitLectures = BLLUL.FindByUnitLecturesID(unitLecturesID);
         if (unitLectures.AttachmentID != null && unitLectures.AttachmentID != 0)
         {
             int    attachID = Convert.ToInt32(BLLUL.FindAttachmentid(unitLecturesID));
             string path     = BLLAttachment.FindPath(attachID);
             if (path != "")
             {
                 publicMethod.DownloadFile(path);
             }
             else
             {
                 Alert.ShowInTop("无附件可下载!");
             }
         }
         else
         {
             Alert.ShowInTop("无附件可下载!");
         }
     }
     catch (Exception ex)
     {
         BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
         pm.SaveError(ex, this.Request);
         PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHidePostBackReference() + Alert.GetShowInTopReference("附件下载失败,请与管理员联系!"));
         //Alert.ShowInTop("附件下载失败!");
     }
 }
예제 #2
0
 //初始化
 public void InitData()
 {
     try
     {
         if (Session["UnitLecturesID"].ToString() != "")
         {
             // OldUnitLectures = BLLUL.FindByUnitLecturesID(Convert.ToInt32(Session["UnitLecturesID"]));
             unitLectures               = BLLUL.FindByUnitLecturesID(Convert.ToInt32(Session["UnitLecturesID"]));
             txtLecturesName.Text       = unitLectures.LecturesName;
             DropDownList_Agency.Text   = BLLAgency.FindAgenName(unitLectures.AgencyID);
             txtUReportName.Text        = unitLectures.UReportName;
             DatePikerLecturesTime.Text = unitLectures.LecturesTime.Value.Year + "-" + unitLectures.LecturesTime.Value.Month + "-" + unitLectures.LecturesTime.Value.Day;
             txtWorkPlace.Text          = unitLectures.WorkUnit;
             txtlistenerNumber.Text     = unitLectures.listenerNumber.ToString();
             DropDownList_SecrecyLevel.SelectedValue = unitLectures.SecrecyLevel.ToString();
             txtLecturesPlace.Text = unitLectures.LecturesPlace;
             txtIDCard.Text        = unitLectures.Identity;
             txtjobtitle.Text      = unitLectures.WorkTitle;
             txtTel.Text           = unitLectures.Telephone;
             Remark.Text           = unitLectures.Remark;
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
         pm.SaveError(ex, this.Request);
     }
 }
예제 #3
0
        public void BindData()
        {
            int unitLecturesID = Convert.ToInt32(Request.QueryString["id"].ToString());

            unitLectures       = BLLUL.FindByUnitLecturesID(unitLecturesID);
            LecturesName.Text  = unitLectures.LecturesName;
            UReportName.Text   = unitLectures.UReportName;
            LecturesPlace.Text = unitLectures.LecturesPlace;
            DateTime?date = unitLectures.LecturesTime;

            LecturesTime.Text = date.Value.Year + "-" + date.Value.Month + "-" + date.Value.Day;
            Agency.Text       = BLLAgency.FindAgenName(unitLectures.AgencyID);
        }
예제 #4
0
 //删除选中的单位讲学信息
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> selections = new List <int>();
         for (int i = 0; i < Grid_Lectures.RecordCount; i++)
         {
             if (CBoxSelect.GetCheckedState(i))
             {
                 selections.Add(i);
             }
         }
         if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
         {
             for (int i = 0; i < selections.Count(); i++)
             {
                 int UnitLecturesID = Convert.ToInt32(Grid_Lectures.DataKeys[selections[i]][0].ToString());
                 Common.Entities.UnitLectures unitLectures = BLLUL.FindByUnitLecturesID(UnitLecturesID);
                 if (unitLectures.AttachmentID != null)
                 {
                     if (BllAttachment.SelectAttachmentName(Convert.ToInt32(unitLectures.AttachmentID)) != "")
                     {
                         //删除附件文件
                         string path = BllAttachment.FindPath(Convert.ToInt32(unitLectures.AttachmentID));
                         if (path != "")
                         {
                             publicMethod.DeleteFile(Convert.ToInt32(unitLectures.AttachmentID), path);
                             //删除附件表中的数据
                             BllAttachment.Delete(Convert.ToInt32(unitLectures.AttachmentID));//删除成功返回true
                         }
                     }
                 }
                 //删除单位讲学信息
                 BLLUL.Delete(UnitLecturesID);//删除成功返回true
             }
             Grid_Lectures.PageIndex           = 0;
             Grid_Lectures.PageSize            = 20;
             DropDownList_Agency.SelectedValue = "0";
             btnDelete.Enabled = false;
             BindData();
             btnSelect_All.Text = "全选";
             Alert.ShowInTop("删除数据成功!");
         }
         else
         {
             for (int i = 0; i < selections.Count(); i++)
             {
                 BLLUL.ChangePass(Convert.ToInt32(Grid_Lectures.DataKeys[selections[i]][0]), false);
                 operate.LoginName        = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                 operate.OperationTime    = DateTime.Now;
                 operate.LoginIP          = " ";
                 operate.OperationContent = "UnitLectures";
                 operate.OperationType    = "删除";
                 operate.OperationDataID  = Convert.ToInt32(Grid_Lectures.DataKeys[selections[i]][0]);
                 BLLOP.Insert(operate);
             }
             Grid_Lectures.PageIndex           = 0;
             Grid_Lectures.PageSize            = 20;
             DropDownList_Agency.SelectedValue = "0";
             btnDelete.Enabled = false;
             BindData();
             btnSelect_All.Text = "全选";
             Alert.ShowInTop("操作已经提交,请等待管理员确认!");
         }
     }
     catch (Exception ex)
     {
         BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
         pm.SaveError(ex, this.Request);
     }
 }
예제 #5
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtLecturesName.Text.Trim() == "")
                {
                    Alert.ShowInTop("姓名不能为空!");
                    txtLecturesName.Reset();
                    return;
                }
                if (txtWorkPlace.Text.Trim() == "")
                {
                    Alert.ShowInTop("工作单位不能为空!");
                    txtWorkPlace.Reset();
                    return;
                }
                //原单位讲学对象
                unitLectures = BLLUL.FindByUnitLecturesID(Convert.ToInt32(Session["UnitLecturesID"]));
                //单位讲学表对象
                NewUnitLectures.LecturesName   = txtLecturesName.Text;
                NewUnitLectures.AgencyID       = BLLAgency.SelectAgencyID(DropDownList_Agency.SelectedText);
                NewUnitLectures.UReportName    = txtUReportName.Text;
                NewUnitLectures.LecturesTime   = Convert.ToDateTime(DatePikerLecturesTime.Text);
                NewUnitLectures.WorkUnit       = txtWorkPlace.Text;
                NewUnitLectures.listenerNumber = Convert.ToInt32(txtlistenerNumber.Text);
                NewUnitLectures.SecrecyLevel   = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue);
                NewUnitLectures.LecturesPlace  = txtLecturesPlace.Text;
                NewUnitLectures.WorkTitle      = txtjobtitle.Text;
                NewUnitLectures.Identity       = txtIDCard.Text;
                NewUnitLectures.Telephone      = txtTel.Text;
                NewUnitLectures.Remark         = Remark.Text;
                NewUnitLectures.EntryPerson    = unitLectures.EntryPerson;
                //用户等级为5级可直接通过
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    NewUnitLectures.IsPass = true;
                }
                else
                {
                    NewUnitLectures.IsPass = false;
                }

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

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

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

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

                default:
                    NewUnitLectures.AttachmentID = AttachID;
                    break;
                }
                if (Convert.ToInt32(Session["SecrecyLevel"]) != 5)
                {
                    //操作日志表对象
                    Common.Entities.OperationLog operationLog = InsertOperationLog();
                    operationLog.OperationDataID = Convert.ToInt32(Session["UnitLecturesID"]);
                    NewUnitLectures.EntryPerson  = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    NewUnitLectures.IsPass       = false;
                    unitLectures.IsPass          = false;
                    BLLUL.Insert(NewUnitLectures); //向单位讲学表插入信息
                    operationLog.Remark = NewUnitLectures.UnitLecturesID.ToString();
                    BLLOL.Insert(operationLog);    //向操作日志表插入信息
                    Alert.ShowInTop("操数据已经提交,等待管理员确认!");
                }
                else
                {
                    NewUnitLectures.UnitLecturesID = Convert.ToInt32(Session["UnitLecturesID"]);
                    BLLUL.Update(NewUnitLectures);
                    Alert.ShowInTop("保存成功!");
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference());
            }
            catch (Exception ex)
            {
                //删除附件文件
                string path = BLLattachment.FindPath(Convert.ToInt32(unitLectures.AttachmentID));
                if (path != "")
                {
                    pm.DeleteFile(Convert.ToInt32(unitLectures.AttachmentID), path);
                    //删除附件表中的数据
                    BLLattachment.Delete(Convert.ToInt32(unitLectures.AttachmentID));//删除成功返回true
                }
                //BLCommon.PublicMethod pm = new BLCommon.PublicMethod();
                pm.SaveError(ex, this.Request);
            }
        }