示例#1
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            int index = gvProgramFileList.SelectedIndex;
            int strID = int.Parse(gvProgramFileList.DataKeys[index]["ID"].ToString());

            if (B_ProgramFileInfo.AllowDelProFile(strID))
            {
                IMessage ms = new WebFormMessage(Page, "该程序文件已在流程中,禁止删除。");
                ms.Show();
                return;
            }
            B_ProgramFileInfo enProFile = new B_ProgramFileInfo();

            enProFile.ID = strID;

            if (enProFile.Delete())
            {
                BindProgramFileList(false, 0, 0, "", "", "", "", "", "");
                ClearData();

                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_DEL_SUC);
                ms.Show();
            }
            else
            {
                IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString());
                ms.Show();
            }
        }
示例#2
0
        /// <summary>
        /// 绑定列表信息
        /// </summary>
        /// <param name="proTypeID"></param>
        /// <param name="proSubTypeID"></param>
        /// <param name="sort"></param>
        /// <param name="archiveState"></param>
        /// <param name="name"></param>
        /// <param name="code"></param>
        /// <param name="edition"></param>
        /// <param name="applyStyle"></param>
        private void BindProgramFileList(bool isSearch, int proTypeID, int proSubTypeID, string sort, string archiveState, string name, string code, string edition, string applyStyle)
        {
            B_ProgramFileInfo bllProFile = new B_ProgramFileInfo();

            int iStart = 0;
            int iEnd   = 0;
            int iCount = 0;

            if (isSearch)
            {
                this.gvProgramFileList.PageIndex = 0;
                iCount = bllProFile.GetCountUseExteriorPage(proTypeID, proSubTypeID, sort, archiveState, name, code, edition, applyStyle, 1, gvProgramFileList.PageSize, ref iStart, ref iEnd);
            }
            else
            {
                iCount = bllProFile.GetCountUseExteriorPage(proTypeID, proSubTypeID, sort, archiveState, name, code, edition, applyStyle, gvProgramFileList.PageIndex + 1, gvProgramFileList.PageSize, ref iStart, ref iEnd);
            }
            DataTable dtList = bllProFile.GetProgamFileUseExteriorPage(proTypeID, proSubTypeID, sort, archiveState, name, code, edition, applyStyle, iStart, iEnd);

            this.gvProgramFileList.RecordCount = iCount;
            //绑定数据
            this.gvProgramFileList.DataSource = dtList;

            this.gvProgramFileList.DataBind();
        }
示例#3
0
        /// <summary>
        /// 绑定升版、注销程序Gridview(外分页)
        /// </summary>
        /// <param name="isSearch"></param>
        /// <param name="proTypeID"></param>
        /// <param name="fileName"></param>
        /// <param name="code"></param>
        /// <param name="writerName"></param>
        /// <param name="authorized"></param>
        private void BindProgramFileListForUpdate(bool isSearch, int proTypeID, string fileName, string code, string writerName, string authorized)
        {
            B_ProgramFileInfo bllProFile = new B_ProgramFileInfo();

            int iStart = 0;
            int iEnd   = 0;
            int iCount = 0;

            if (isSearch)
            {
                iCount = bllProFile.GetFileCountExteriorPageForUpdate(proTypeID, fileName, code, writerName, authorized, 1, gvProgramFilesList.PageSize, ref iStart, ref iEnd);
            }
            else
            {
                iCount = bllProFile.GetFileCountExteriorPageForUpdate(proTypeID, fileName, code, writerName, authorized, gvProgramFilesList.PageIndex + 1, gvProgramFilesList.PageSize, ref iStart, ref iEnd);
            }
            DataTable dtList = bllProFile.GetFileExteriorPageForUpdate(proTypeID, fileName, code, writerName, authorized, iStart, iEnd);

            this.gvProgramFilesList.PageType    = PageType.ExteriorPage;
            this.gvProgramFilesList.RecordCount = iCount;
            gvProgramFilesList.ShowPagerRow     = true;

            //绑定数据
            if (iCount == 0)
            {
                this.gvProgramFilesList.Visible = false;
            }
            else
            {
                this.gvProgramFilesList.DataSource = dtList;
                this.gvProgramFilesList.DataBind();
            }
        }
示例#4
0
        /// <summary>
        /// 重新发起
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProgramFileList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string            id       = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString();
            B_ProgramFileInfo pfEntity = new B_ProgramFileInfo();

            pfEntity.ID = int.Parse(id);
            if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE)
            {
                if (pfEntity.Files.Length > 0)
                {
                    return;
                }          //存在附件
                pfEntity.ApplyStyle   = null;
                pfEntity.ArchiveState = null;
                pfEntity.Year         = null;
                pfEntity.Edition      = null;

                if (pfEntity.Save())
                {
                    GetSearchList(true);
                    IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC);
                    ms.Show();
                }
                else
                {
                    string strErr = string.Empty;
                    if (pfEntity.ErrMsgs.Count != 0)
                    {
                        foreach (string str in pfEntity.ErrMsgs)
                        {
                            strErr += str;
                        }
                    }
                    IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr);
                    ms.Show();
                }
            }//创建程序
            else
            {
                if (pfEntity.Delete())
                {
                    GetSearchList(true);
                    IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC);
                    ms.Show();
                }
                else
                {
                    string strErr = string.Empty;
                    if (pfEntity.ErrMsgs.Count != 0)
                    {
                        foreach (string str in pfEntity.ErrMsgs)
                        {
                            strErr += str;
                        }
                    }
                    IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr);
                    ms.Show();
                }
            }//升版、注销程序
        }
示例#5
0
        /// <summary>
        /// 绑定升版、注销程序Gridview
        /// </summary>
        /// <param name="proTypeID">类型ID</param>
        /// <param name="fileName">程序名称</param>
        /// <param name="code">程序代码</param>
        /// <param name="writerName">编写人</param>
        /// <param name="authorized">批准人</param>
        private void BindProgramFileListForUpdate(int proTypeID, string fileName, string code, string writerName, string authorized)
        {
            B_ProgramFileInfo bllProFile = new B_ProgramFileInfo();
            DataTable         dt         = bllProFile.GetProgamFileForUpdateProgram(proTypeID, fileName, code, writerName, authorized);

            if (dt != null)
            {
                gvProgramFilesList.PageType = PageType.InteriorPage;

                gvProgramFilesList.DataSource = dt;
                gvProgramFilesList.DataBind();
            }
        }
示例#6
0
        /// <summary>
        /// 提交(创建程序)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            if (ddlDept.SelectedIndex == -1)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE);
                ms.Show();
                return;
            }
            if (string.IsNullOrEmpty(ddlDept.SelectedValue) && ddlDept.SelectedIndex == 0)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED);
                ms.Show();
                return;
            }
            GridViewRow row = this.gvProgramFileList.SelectedRow;

            B_ProgramFileInfo bProFile = new B_ProgramFileInfo();

            bProFile.ID           = int.Parse(row.Cells[PF_ID].Text.ToString());//ID
            bProFile.Name         = txtName.Text.ToString().Trim();
            bProFile.Edition      = lblEdition.Text.ToString().Trim();
            bProFile.Code         = txtCode.Text.ToString().Trim();
            bProFile.Sort         = row.Cells[SORT].Text.ToString().Trim();
            bProFile.ProTypId     = int.Parse(row.Cells[TYPE_ID].Text.ToString().Trim());
            bProFile.ProTypSubId  = int.Parse(row.Cells[SUBTYPE_ID].Text.ToString().Trim());
            bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//据ArchiveState is null判断需要发起的程序文件
            B_DocumentNo_A docNo_A = new B_DocumentNo_A();

            bProFile.SerialID   = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号
            bProFile.Year       = DateTime.Now.Year.ToString();
            bProFile.ApplyStyle = ConstString.ProgramFile.PROGRAM_CREATE;

            if (bProFile.Save())
            {
                RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle,
                            this.hfSort.Value, ddlDept.SelectedValue, bProFile.SerialID);
            }
            else
            {
                IMessage im = new WebFormMessage(Page, "提交失败。");
                im.Show();
            }
        }
示例#7
0
        private void BindProgramFileListForCreate(int proTypeID, int proSubTypeID, string sort)
        {
            B_ProgramTypeSub  bProTypeSub = new B_ProgramTypeSub();
            B_ProgramFileInfo bPf         = new B_ProgramFileInfo();

            DataTable dt = bPf.GetProgamFileForCreateProgram(proTypeID, proSubTypeID, sort);

            if (dt != null)
            {
                if (dt.Rows.Count == 0)
                {
                    gvProgramFileList.Visible = false;
                }
                else
                {
                    gvProgramFileList.DataSource = dt;
                    gvProgramFileList.DataBind();
                }
            }
        }
示例#8
0
        /// <summary>
        /// 新增按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (FormsMethod.CheckRole(ConstString.RoleName.QUALITY_MEMBER) == false)
            {
                IMessage ms = new WebFormMessage(Page, "只有质保人员" + OAUser.GetUserByRoleName(ConstString.RoleName.QUALITY_MEMBER)[1].ToString() + "可以添加程序文件。");
                ms.Show();
                return;
            }
            if (txtName.Text.ToString().Contains("#") || txtName.Text.ToString().Contains("'"))
            {
                IMessage ms = new WebFormMessage(Page, "含有特殊字符,请替换后再上传");
                ms.Show();
                return;
            }
            B_ProgramFileInfo enProFile = new B_ProgramFileInfo();

            enProFile.Name = txtName.Text.ToString().Trim();
            //bProFile.Edition = "1";//txtEdition.Text.ToString().Trim();
            enProFile.Code        = txtCode.Text.ToString().Trim();
            enProFile.Sort        = ddlSort.SelectedItem.Text.ToString().Trim();
            enProFile.ProTypId    = int.Parse(ddlProgramType.SelectedItem.Value.ToString().Trim());
            enProFile.ProTypSubId = int.Parse(ddlProgramSubType.SelectedItem.Value.ToString().Trim());

            enProFile.ActivationDate = DateTime.Now;

            if (enProFile.Save())
            {
                BindProgramFileList(false, 0, 0, "", "", "", "", "", "");
                ClearData();
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC);
                ms.Show();
            }
            else
            {
                IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString());
                ms.Show();
            }
        }
        /// <summary>
        /// 撤销流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProgramFileList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string strID = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString();
            bool bFlag = false;
            foreach (string strRole in CurrentUserInfo.RoleName)
            {
                if (strRole == "OA系统管理员" || strRole == "OU系统管理员" || strRole.Contains("管理员") || strRole == ConstString.RoleName.QUALITY_MEMBER)
                {
                    bFlag = true;
                }
            }
            if (!bFlag)
            {
                IMessage ms = new WebFormMessage(Page, "只有\'OA系统管理员\'、\'OU系统管理员\'、\'管理员\'、\'质保人员\'可以撤销流程。");
                ms.Show();
                return;
            }
            try
            {
                B_ProgramFileInfo pfEntity = new B_ProgramFileInfo();
                pfEntity.ID = int.Parse(strID);
                string strProcessID = pfEntity.ProcessID;
                //if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE)
                //{
                //    pfEntity.ProcessID = null;
                //    pfEntity.Year = null;
                //    //pfEntity.ApplyStyle = null;
                //    //pfEntity.ArchiveState = null;
                //    //pfEntity.Edition = null;

                //    if (pfEntity.Save() == false)
                //    {
                //        IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                //        ms.Show();
                //        return;
                //    }

                //}//创建
                //else
                //{
                //    if (pfEntity.Delete() == false)
                //    {
                //        IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                //        ms.Show();
                //        return;
                //    }

                //}//升版、注销

                if (pfEntity.Delete() == false)
                {
                    IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                    ms.Show();
                    return;
                }
                GetSearchList(true);
                //取消流程
                AgilePointWF ag = new AgilePointWF();
                WorkflowService api = ag.GetAPI();
                api.CancelProcInst(strProcessID);
                IMessage msg = new WebFormMessage(Page, "撤销成功。");
                msg.Show();
            }
            catch (Exception ex)
            {
                IMessage ms = new WebFormMessage(Page, ex.Message.Length > 300 ? ex.Message.Substring(0, 300) : ex.Message);
                ms.Show();
            }
        }
        /// <summary>
        /// 升版程序提交按钮事件(升版、注销)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirms_Click(object sender, EventArgs e)
        {
            if (ddlDept2.SelectedIndex == -1)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE);
                ms.Show();
                return;
            }
            if (string.IsNullOrEmpty(ddlDept2.SelectedValue) && ddlDept2.SelectedIndex == 0)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED);
                ms.Show();
                return;
            }
            bool isUsed = false;
            bool isRelUsed = false;
            if (rdolstStyle.SelectedIndex == 0)
            {
                isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_UPDATE);
                int iEdition = int.Parse(lblEdition.Text) - 1;
                isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_DELETE);
            }//升版
            else
            {
                isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_DELETE);
                int iEdition = int.Parse(lblEdition.Text) + 1;
                isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_UPDATE);
            }//注销
            if (isUsed)
            {
                IMessage ms = new WebFormMessage(Page, txtNames.Text + "第" + lblEditions.Text + "版,已在流程流转中。");
                ms.Show();
                return;
            }//所选程序文件已占用
            if (isRelUsed)
            {
                string strPrompt = string.Empty;
                strPrompt = rdolstStyle.SelectedIndex == 0 ? "正在注销流转中,不能升版。" : "正在升版流转中,不能注销。";
                IMessage ms = new WebFormMessage(Page, txtNames.Text + strPrompt);
                ms.Show();
                return;
            }

            GridViewRow row = this.gvProgramFilesList.SelectedRow;

            B_ProgramFileInfo bProFile = new B_ProgramFileInfo();
            bProFile.Name = txtNames.Text.ToString().Trim();
            bProFile.Edition = lblEditions.Text.ToString().Trim();
            bProFile.Code = txtCodes.Text.ToString().Trim();
            bProFile.Sort = row.Cells[SORTS].Text.ToString().Trim();
            bProFile.ProTypId = int.Parse(row.Cells[TYPES_ID].Text.ToString().Trim());
            bProFile.ProTypSubId = int.Parse(row.Cells[SUBTYPES_ID].Text.ToString().Trim());
            bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//未完成
            B_DocumentNo_A docNo_A = new B_DocumentNo_A();
            bProFile.SerialID = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号
            bProFile.Year = DateTime.Now.Year.ToString();
            bProFile.ApplyStyle = rdolstStyle.SelectedIndex == 0 ? ConstString.ProgramFile.PROGRAM_UPDATE : ConstString.ProgramFile.PROGRAM_DELETE;
            string deptID = ddlDept2.SelectedValue;
            //string serialID = txtSerialID2.Text.Trim();

            //if (rdolstStyle.SelectedIndex == 0)
            //{
            if (bProFile.Save())
            {
                RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle,
                    this.hfSorts.Value, ddlDept2.SelectedValue, bProFile.SerialID);
            }
            else
            {
                IMessage im = new WebFormMessage(Page, "提交失败。");
                im.Show();
            }
            //}//升版
            //else
            //{
            //    RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, deptID);
            //}//注销
        }
        /// <summary>
        /// 绑定升版、注销程序Gridview(外分页)
        /// </summary>
        /// <param name="isSearch"></param>
        /// <param name="proTypeID"></param>
        /// <param name="fileName"></param>
        /// <param name="code"></param>
        /// <param name="writerName"></param>
        /// <param name="authorized"></param>
        private void BindProgramFileListForUpdate(bool isSearch, int proTypeID, string fileName, string code, string writerName, string authorized)
        {
            B_ProgramFileInfo bllProFile = new B_ProgramFileInfo();

            int iStart = 0;
            int iEnd = 0;
            int iCount = 0;
            if (isSearch)
            {
                iCount = bllProFile.GetFileCountExteriorPageForUpdate(proTypeID, fileName, code, writerName, authorized, 1, gvProgramFilesList.PageSize, ref iStart, ref iEnd);
            }
            else
            {
                iCount = bllProFile.GetFileCountExteriorPageForUpdate(proTypeID, fileName, code, writerName, authorized, gvProgramFilesList.PageIndex + 1, gvProgramFilesList.PageSize, ref iStart, ref iEnd);
            }
            DataTable dtList = bllProFile.GetFileExteriorPageForUpdate(proTypeID, fileName, code, writerName, authorized, iStart, iEnd);
            this.gvProgramFilesList.PageType = PageType.ExteriorPage;
            this.gvProgramFilesList.RecordCount = iCount;
            gvProgramFilesList.ShowPagerRow = true;

            //绑定数据
            if (iCount == 0)
            {
                this.gvProgramFilesList.Visible = false;
            }
            else
            {
                this.gvProgramFilesList.DataSource = dtList;
                this.gvProgramFilesList.DataBind();
            }
        }
        /// <summary>
        /// 绑定升版、注销程序Gridview
        /// </summary>
        /// <param name="proTypeID">类型ID</param>
        /// <param name="fileName">程序名称</param>
        /// <param name="code">程序代码</param>
        /// <param name="writerName">编写人</param>
        /// <param name="authorized">批准人</param>
        private void BindProgramFileListForUpdate(int proTypeID, string fileName, string code, string writerName, string authorized)
        {
            B_ProgramFileInfo bllProFile = new B_ProgramFileInfo();
            DataTable dt = bllProFile.GetProgamFileForUpdateProgram(proTypeID, fileName, code, writerName, authorized);
            if (dt != null)
            {
                gvProgramFilesList.PageType = PageType.InteriorPage;

                gvProgramFilesList.DataSource = dt;
                gvProgramFilesList.DataBind();
            }
        }
        private void BindProgramFileListForCreate(int proTypeID, int proSubTypeID, string sort)
        {
            B_ProgramTypeSub bProTypeSub = new B_ProgramTypeSub();
            B_ProgramFileInfo bPf = new B_ProgramFileInfo();

            DataTable dt = bPf.GetProgamFileForCreateProgram(proTypeID, proSubTypeID, sort);
            if (dt != null)
            {
                if (dt.Rows.Count == 0)
                { gvProgramFileList.Visible = false; }
                else
                {
                    gvProgramFileList.DataSource = dt;
                    gvProgramFileList.DataBind();
                }
            }
        }
        /// <summary>
        /// 提交(创建程序)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            if (ddlDept.SelectedIndex == -1)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE);
                ms.Show();
                return;
            }
            if (string.IsNullOrEmpty(ddlDept.SelectedValue) && ddlDept.SelectedIndex == 0)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED);
                ms.Show();
                return;
            }
            GridViewRow row = this.gvProgramFileList.SelectedRow;

            B_ProgramFileInfo bProFile = new B_ProgramFileInfo();
            bProFile.ID = int.Parse(row.Cells[PF_ID].Text.ToString());//ID
            bProFile.Name = txtName.Text.ToString().Trim();
            bProFile.Edition = lblEdition.Text.ToString().Trim();
            bProFile.Code = txtCode.Text.ToString().Trim();
            bProFile.Sort = row.Cells[SORT].Text.ToString().Trim();
            bProFile.ProTypId = int.Parse(row.Cells[TYPE_ID].Text.ToString().Trim());
            bProFile.ProTypSubId = int.Parse(row.Cells[SUBTYPE_ID].Text.ToString().Trim());
            bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//据ArchiveState is null判断需要发起的程序文件
            B_DocumentNo_A docNo_A = new B_DocumentNo_A();
            bProFile.SerialID = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号
            bProFile.Year = DateTime.Now.Year.ToString();
            bProFile.ApplyStyle = ConstString.ProgramFile.PROGRAM_CREATE;

            if (bProFile.Save())
            {
                RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle,
                    this.hfSort.Value, ddlDept.SelectedValue, bProFile.SerialID);
            }
            else
            {
                IMessage im = new WebFormMessage(Page, "提交失败。");
                im.Show();
            }
        }
        /// <summary>
        /// 新增按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (FormsMethod.CheckRole(ConstString.RoleName.QUALITY_MEMBER) == false)
            {
                IMessage ms = new WebFormMessage(Page, "只有质保人员" + OAUser.GetUserByRoleName(ConstString.RoleName.QUALITY_MEMBER)[1].ToString() + "可以添加程序文件。");
                ms.Show();
                return;
            }
            if (txtName.Text.ToString().Contains("#") || txtName.Text.ToString().Contains("'"))
            {
                IMessage ms = new WebFormMessage(Page, "含有特殊字符,请替换后再上传");
                ms.Show();
                return;
            }
            B_ProgramFileInfo enProFile = new B_ProgramFileInfo();
            enProFile.Name = txtName.Text.ToString().Trim();
            //bProFile.Edition = "1";//txtEdition.Text.ToString().Trim();
            enProFile.Code = txtCode.Text.ToString().Trim();
            enProFile.Sort = ddlSort.SelectedItem.Text.ToString().Trim();
            enProFile.ProTypId = int.Parse(ddlProgramType.SelectedItem.Value.ToString().Trim());
            enProFile.ProTypSubId = int.Parse(ddlProgramSubType.SelectedItem.Value.ToString().Trim());

            enProFile.ActivationDate = DateTime.Now;

            if (enProFile.Save())
            {
                BindProgramFileList(false, 0, 0, "", "", "", "", "", "");
                ClearData();
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC);
                ms.Show();
            }
            else
            {
                IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString());
                ms.Show();
            }
        }
        private string Devolve2DC(HN_OA2DC oaDev, B_PF enProFile, string strDraftDept, string dealUser, string sProcessName)
        {
            string sXml = "";

            FounderSoftware.ADIM.OA.OA2DC.HNDC_CArchiveNode ar = new HNDC_CArchiveNode();
            FounderSoftware.ADIM.OA.OA2DC.HNDC_CFileNode    fl = new HNDC_CFileNode();

            #region 开始生成Archive节点
            ar.System = "OA_" + base.IdentityID.ToString();
            string ObjPlatForm = oaDev.GetCfgNodeValues("/Devolve/Process[@Name='" + sProcessName + "']/Object");
            switch (ObjPlatForm)
            {
            case "DC":
                ar.SysFlag = "1";
                break;

            case "FC":
                ar.SysFlag = "2";
                break;

            default:
                ar.SysFlag = "1";
                break;
            }


            // 文件编码-程序编码
            ar.Code = enProFile.ProgramCode;
            // 编制单位-主办部门
            ar.FormationDept = strDraftDept;
            // 题名-程序名称
            ar.Title = enProFile.DocumentTitle;
            // 功能领域-程序子类
            ar.FunctionField = B_ProgramFileInfo.GetProSubTypeName(enProFile.ProgramFileID);
            // 版本-版次
            ar.Revision = enProFile.Edition;
            // 页数-总页数
            ar.DocPages = enProFile.TextPageSum;
            // 批准者-批准操作人
            ar.Authorizer = enProFile.ApproveName;
            // 生效日期-批准日期
            ar.AuthorizeTime = CheckDateTime(enProFile.ApproveDate.ToString());
            // 审核者-审核操作人
            ar.Auditby = enProFile.AuditName;
            // 审核日期-审核日期
            ar.AuditDate = CheckDateTime(enProFile.AuditDate.ToString());
            // 校核者-校核操作人
            ar.Checkthose = enProFile.CheckName;
            // 校核日期-校核日期
            ar.CheckDate = CheckDateTime(enProFile.CheckDate.ToString());
            // 编制人-编制操作人
            ar.Author = enProFile.WriteName;
            // 编制日期-编制日期
            ar.FormationTime = CheckDateTime(enProFile.WriteDate.ToString());


            //ar.FK_CategoryID = "903";
            // 公共常量
            //ar.GatherLevel = "件";
            //ar.D_StorageCarrierType = "纸质";
            //ar.Amount = "1";
            //ar.D_Language = "中文";
            ar.ElectronicDocumentCount = enProFile.FileList.Count.ToString();
            #endregion
            sXml = oaDev.GenOAArchiveNode(ar, sProcessName);

            /****开始生成File节点************************************************************************/
            #region 开始生成File节点
            fl.AuthorizeTime   = ar.AuthorizeTime;
            fl.Code            = ar.Code;
            fl.Code19          = ar.Code19;
            fl.D_FileStatus    = ar.D_FileStatus;
            fl.DocCodesExplain = "";
            fl.DocPages        = ar.DocPages;
            fl.ElectronicDocumentTransceiverTime = ar.ElectronicDocumentTransceiverTime;
            fl.Ext_1         = ar.Ext_1;
            fl.Ext_2         = ar.Ext_2;
            fl.Ext_3         = ar.Ext_3;
            fl.Ext_4         = ar.Ext_4;
            fl.Ext_5         = ar.Ext_5;
            fl.Title         = ar.Title;
            fl.FK_ArchiveID  = ar.FK_Archive;
            fl.FK_CategoryID = ar.FK_CategoryID;
            fl.FormationDept = ar.FormationDept;
            fl.FormationTime = ar.FormationTime;
            fl.Importer      = ar.Importer;
            fl.ImporterTime  = ar.ImporterTime;
            fl.OriginalID    = ar.OriginalID;
            fl.OtherTitle    = ar.OtherTitle;
            fl.PaperDocumentTransceiverTime = ar.PaperDocumentTransceiverTime;
            fl.RelatedCode = ar.RelatedCode;
            fl.Revision    = ar.Revision;
            #endregion
            sXml = oaDev.GenOAFileNode(fl);
            /****完成生成File节点************************************************************************/

            #region 始生成Attachment节点
            /****开始生成Attachment节点******************************************************************/
            string sServerWeb = oaDev.GetCfgNodeValues("/Devolve/Other/ServerWeb");
            //"http://172.29.128.239";
            //string sDocumentName = oaDev.GetCfgNodeValues("/Devolve/Other/DocumentName");
            for (int i = 0; i < enProFile.FileList.Count; i++)
            {
                HNDC_CAttachmentNode at = new HNDC_CAttachmentNode();
                CFuJian file            = enProFile.FileList[i];

                at.DocumentName  = ProcessConstString.TemplateName.PROGRAM_FILE; //file.FileName;
                at.FK_FileID     = "";
                at.MakeDate      = "";
                at.MakeUnit      = "";
                at.PublishedTime = "";
                at.Remark        = "";

                at.ServerWeb = sServerWeb;
                Double iSize = 0;
                string sSize = file.Size.ToUpper();
                if (sSize.Contains("K"))
                {
                    sSize = sSize.Replace("K", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024;
                }
                if (sSize.Contains("M"))
                {
                    sSize = sSize.Replace("M", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024 * 1024;
                }
                at.Size     = ((int)iSize).ToString();
                at.TimeSize = "";
                at.Title    = file.Alias;
                at.Type     = file.Type;
                at.Url      = file.URL;

                sXml = oaDev.GenOAAttachmentNode(fl.FK_ArchiveID, at);
            }
            #endregion
            /****完成生成Attachment节点******************************************************************/

            return(sXml);
        }
        /// <summary>
        /// 提交按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            try
            {
                //提交动作
                string strActionName = ((Button)sender).Text.Trim();
                base.SubAction = strActionName;

                string strErrMsg = string.Empty;
                string strMessage = string.Empty;
                string strErrMessage = string.Empty;

                #region 传阅
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_CIRCULATE)
                {
                    if (string.IsNullOrEmpty(hfCirculateUserID.Value) && string.IsNullOrEmpty(hfCirculateDeptID.Value))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_CIRCULATE, true);
                        return;
                    }
                    try
                    {
                        base.Circulate(hfCirculateDeptID.Value, "0", string.Empty, hfCirculateUserID.Value, "1", true, string.Empty, false);

                        string strDay = OAConfig.GetConfig("传阅有效期", "天数");
                        int day = string.IsNullOrEmpty(strDay) ? -1 : int.Parse(strDay);
                        wfCirculateDate.Text = DateTime.Now.AddDays(day).ToString();
                        if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
                        {
                            QualityCheck();
                        }//质保审查
                        else if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_AUDIT)
                        {
                            AuditCheck();
                        }//审核
                        JScript.Alert(ConstString.PromptInfo.ACTION_CIRCULATE_SUC, true);
                        return;
                    }
                    catch (Exception ex)
                    {
                        JScript.Alert(ex.ToString(), true);
                        return;
                    }
                }
                #endregion

                #region 添加多条意见
                //添加意见按钮事件
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_ADD_COMMENT)
                {
                    this.pnlComment.Visible = true;
                    this.btnCancel.Visible = true;
                    this.btnConfirm.Visible = true;
                    this.btnAdd.Visible = false;
                    return;
                }
                //确定按钮事件
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_CONFIRM)
                {
                    if (string.IsNullOrEmpty(txtInfo2.Text.Trim()))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_ADD_COMMENT, true);
                        return;
                    }
                    if (txtInfo2.Text.Trim().Length > 500)
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_CONTENT_LEN500, true);
                        return;
                    }
                    if (string.IsNullOrEmpty(hfEditIndex.Value))
                    {
                        CYiJian objYj = new CYiJian();

                        objYj.Content = SysString.InputText(txtInfo2.Text.Trim());
                        objYj.FinishTime = DateTime.Now.ToString();
                        objYj.ID = base.IdentityID.ToString();
                        objYj.ViewName = base.StepName;

                        /*开始    流程代理         */
                        if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                        {
                            objYj.UserName = wfReceiveUserName.Text;
                            objYj.UserID = wfReceiveUserID.Text;
                        }
                        else
                        {
                            objYj.UserName = CurrentUserInfo.DisplayName;
                            objYj.UserID = CurrentUserInfo.UserName;
                        }
                        /*结束              */
                        objYj.DeptID = base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN ? B_PF.GetDeptIDByUserID(ucBuMenHuiQian.UCGetHQList(), objYj.UserID) : string.Empty;

                        YiJianInfoList.Add(objYj);
                        txtInfo2.Text = string.Empty;
                        trYiJianHead.Visible = YiJianInfoList.Count > 0 ? true : false; ;

                        rptComment.DataSource = YiJianInfoList;
                        rptComment.DataBind();
                    }//添加意见
                    else
                    {
                        int index = int.Parse(hfEditIndex.Value);
                        Label lblContent = rptComment.Items[index].FindControl("lblContent") as Label;
                        lblContent.Text = SysString.InputText(txtInfo2.Text);
                        YiJianInfoList[index].Content = lblContent.Text;

                        this.pnlComment.Visible = false;
                        this.btnCancel.Visible = false;
                        btnConfirm.Visible = false;
                        this.btnAdd.Visible = true;
                        txtInfo2.Text = string.Empty;
                        hfEditIndex.Value = string.Empty;
                    }//修改意见
                    return;
                }
                //取消按钮事件
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_CANCLE)
                {
                    this.pnlComment.Visible = false;
                    this.btnCancel.Visible = false;
                    this.btnConfirm.Visible = false;
                    this.btnAdd.Visible = true;
                    txtInfo2.Text = string.Empty;
                    hfEditIndex.Value = string.Empty;
                    return;
                }
                #endregion

                #region 处理落实情况
                //编写节点 处理 质保、部门会签、领导会签、批准意见
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE && pnlDealSign.Visible == true)
                {
                    B_PF bllProFile = new B_PF();

                    List<M_ProgramFile.DeptSign> deptSignList = B_PF.GetDeptSignList(rptDept, ucBuMenHuiQian.UCGetHQList());//部门会签意见
                    List<M_ProgramFile.LeaderSign> leaderSignList = B_PF.GetLeaderSignList(rptLeader, ucLDHuiQian.UCGetHQList());//领导会签
                    List<M_ProgramFile.QualityCheck> qualityCheckList = B_PF.GetQualityCheckList(rptQG);//质保审查
                    List<M_ProgramFile.PiZhun> piZhunList = B_PF.GetPiZhunList(rptPiZhun);//批准意见
                    List<B_PF> entityList = B_PF.GetpfEntityList(deptSignList, leaderSignList, qualityCheckList, piZhunList);
                    if (!bllProFile.EnTransSave(entityList))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_SUBMIT_DEAL_FAIL, true);
                        return;
                    }//更新当前提交的意见落实情况

                }
                //质保审查节点 处理批准意见
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
                {
                    List<M_ProgramFile.PiZhun> piZhunList = B_PF.GetPiZhunList(rptPiZhun);//批准意见
                    if (piZhunList.Count > 0)
                    {
                        B_PF.UpdateApproveDealCondition(piZhunList);
                    }
                }

                #endregion

                //保存
                if (strActionName == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    B_PF bllProFile = ControlToEntity(true) as B_PF;

                    //用于提示信息
                    bllProFile.IsFormSave = true;

                    bllProFile.SubmitAction = strActionName;
                    if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_ASSIST_SIGN)
                    {
                        ReturnInfo l_objReturnInfo = FormSubmitForProFile(true, strActionName, string.Empty, FSWFStatus.Assigned.ToString(), bllProFile as EntityBase);
                        if (!l_objReturnInfo.IsSucess)
                        {
                            return;
                        }
                        JScript.Alert(ConstString.PromptInfo.ACTION_SAVE_SUC, true);
                    }
                    else
                    {
                        base.FormSubmit(true, strActionName, null, bllProFile as EntityBase);
                    }
                }
                else
                {
                    B_PF bllProFile = ControlToEntity(false) as B_PF;
                    bllProFile.IsFormSave = false;
                    bllProFile.SubmitAction = strActionName;
                    //撤销
                    if (strActionName == ProcessConstString.SubmitAction.ACTION_CANCEL)
                    {
                        base.FormCancel(bllProFile as EntityBase);
                    }
                    else
                    {
                        //验证及提示
                        bllProFile.GetSubmitMessage(base.StepName, strActionName, bllProFile, ref strErrMessage, ref strMessage);
                        if (!string.IsNullOrEmpty(strErrMessage))
                        {
                            JScript.Alert(strErrMessage, true);
                            return;
                        }

                        //表单验证
                        strErrMsg = bllProFile.SeverCheck(StepName, bllProFile);

                        if (!string.IsNullOrEmpty(strErrMsg))
                        {
                            JScript.Alert(strErrMsg, true);
                            return;
                        }
                        else
                        {
                            #region 分发节点 点击分发完成按钮 执行分发
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND &&
                                base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_SEND_COMPLETE)
                            {
                                if (string.IsNullOrEmpty(hfSendDeptID.Value) && string.IsNullOrEmpty(hfSendUserID.Value))
                                {
                                    JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_SEND, true);
                                    return;
                                }
                                try
                                {
                                    base.Circulate(hfSendDeptID.Value, "0", string.Empty, hfSendUserID.Value, "1", true, string.Empty, false);
                                }
                                catch (Exception ex)
                                {
                                    JScript.Alert(ex.ToString(), true);
                                    return;
                                }
                            }
                            #endregion

                            #region 分发节点 点击归档按钮 执行归档
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND &&
                               base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_ARCHIVE)
                            {
                                bllProFile.ProgramType1 = B_ProgramFileInfo.GetProTypeName(bllProFile.ProgramFileID);
                                bllProFile.ProgramType2 = B_ProgramFileInfo.GetProSubTypeName(bllProFile.ProgramFileID);
                                string strDeptName = OADept.GetDeptByDeptID(bllProFile.SendDeptID).Name;
                                string strRes = string.Empty;
                                try//renjinquan改
                                {
                                    string strArchiveResult = Devolve(bllProFile, strDeptName, CurrentUserInfo.DisplayName, out strRes);
                                    base.Devolved(base.ProcessID, base.TemplateName);
                                    JScript.Alert("归档成功!\\n流水号:" + strRes, true);
                                }
                                catch (Exception ex)
                                {
                                    base.WriteLog(ex.Message);
                                    JScript.Alert("归档失败!请查看配置是否正确!", true);
                                }
                                //Regex.IsMatch(strArchiveResult, @"^\d+$") ? ConstString.PromptInfo.ACTION_ARCHIVE_SUC : strArchiveResult, true);
                                return;
                            }
                            #endregion

                            #region 程序发起、分发节点 更新程序文件信息
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE)
                            {
                                ReturnInfo retInfo = B_ProgramFileInfo.GetUpdateMsg(bllProFile, ConstString.ProgramFile.PROGRAM_UNFINISHED);
                                if (retInfo.IsSucess == false)
                                {
                                    JScript.Alert(retInfo.ErrMessage, true);
                                    return;
                                }

                            }
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND &&
                                base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_SEND_COMPLETE)
                            {
                                ReturnInfo retInfo = new ReturnInfo();
                                if (bllProFile.ApplyStyle == ConstString.ProgramFile.PROGRAM_DELETE)
                                {
                                    B_ProgramFileInfo bllFileInfo = new B_ProgramFileInfo();
                                    retInfo = bllFileInfo.IsLogout(bllProFile, ConstString.ProgramFile.PROGRAM_LOGOUT);
                                }//已注销
                                else
                                {
                                    retInfo = B_ProgramFileInfo.GetUpdateMsg(bllProFile, ConstString.ProgramFile.PROGRAM_ARCHIVED);
                                }//已归档
                                if (retInfo.IsSucess == false)
                                {
                                    JScript.Alert(retInfo.ErrMessage, true);
                                    return;
                                }
                            }

                            #endregion

                            Hashtable nValues = new Hashtable();

                            #region 协助会签
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN)
                            {
                                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_ASSIGN)
                                {
                                    nValues = bllProFile.GetProcNameValue(base.StepName, strActionName, bllProFile);
                                    string strSubProcInstID = GetCreateSubProcessID(ProcessConstString.TemplateName.PROGRAM_FILE_ASSIGN_SIGN, nValues);
                                    bllProFile.ChildProcessID = strSubProcInstID;
                                    ReturnInfo l_objReturnInfo = FormSubmitForProFile(false, strActionName, string.Empty, FSWFStatus.Assigned.ToString(), bllProFile as EntityBase);
                                    if (!l_objReturnInfo.IsSucess)
                                    {
                                        return;
                                    }
                                    this.ShowMsgBox(this.Page, MsgType.VbInformation, strMessage, base.EntryAction);
                                    return;
                                }//交办
                                if (!string.IsNullOrEmpty(bllProFile.ChildProcessID) && strActionName == ProcessConstString.SubmitAction.ACTION_SUBMIT)
                                {
                                    AgilePointWF ag = new AgilePointWF();
                                    WorkflowService api = ag.GetAPI();
                                    WFEvent wfEvnet = api.CancelProcInst(bllProFile.ChildProcessID);
                                    if (wfEvnet.Error != null)
                                    {
                                        JScript.Alert(wfEvnet.Error, true);
                                        return;
                                    }
                                    bllProFile.ChildProcessID = string.Empty;
                                }//存在交办子流程 继续提交 撤销子流程
                            }
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_ASSIST_SIGN)
                            {
                                if (strActionName == ProcessConstString.SubmitAction.ACTION_COMPLETE)
                                {
                                    ReturnInfo l_objReturnInfo = FormSubmitForProFile(false, strActionName, bllProFile.ParentTBID, FSWFStatus.Completed.ToString(), bllProFile as EntityBase);
                                    if (!l_objReturnInfo.IsSucess)
                                    {
                                        return;
                                    }
                                }
                                this.ShowMsgBox(this.Page, MsgType.VbInformation, strMessage, base.EntryAction);
                                return;
                            }

                            #endregion

                            //调用工作流
                            nValues = bllProFile.GetProcNameValue(base.StepName, strActionName, bllProFile);
                            base.FormSubmit(false, strActionName, nValues, bllProFile as EntityBase);
                        }
                    }
                }

                //流程节点结束提示
                if (!string.IsNullOrEmpty(strMessage))
                {
                    JScript.Alert(strMessage, true);
                }
            }
            catch (Exception ex)
            {
                JScript.Alert(ex.Message, true);
            }
        }
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            int index = gvProgramFileList.SelectedIndex;
            int strID = int.Parse(gvProgramFileList.DataKeys[index]["ID"].ToString());
            if (B_ProgramFileInfo.AllowDelProFile(strID))
            {
                IMessage ms = new WebFormMessage(Page, "该程序文件已在流程中,禁止删除。");
                ms.Show();
                return;
            }
            B_ProgramFileInfo enProFile = new B_ProgramFileInfo();

            enProFile.ID = strID;

            if (enProFile.Delete())
            {
                BindProgramFileList(false, 0, 0, "", "", "", "", "", "");
                ClearData();

                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_DEL_SUC);
                ms.Show();
            }
            else
            {
                IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString());
                ms.Show();

            }
        }
示例#19
0
        /// <summary>
        /// 撤销流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProgramFileList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string strID = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString();
            bool   bFlag = false;

            foreach (string strRole in CurrentUserInfo.RoleName)
            {
                if (strRole == "OA系统管理员" || strRole == "OU系统管理员" || strRole.Contains("管理员") || strRole == ConstString.RoleName.QUALITY_MEMBER)
                {
                    bFlag = true;
                }
            }
            if (!bFlag)
            {
                IMessage ms = new WebFormMessage(Page, "只有\'OA系统管理员\'、\'OU系统管理员\'、\'管理员\'、\'质保人员\'可以撤销流程。");
                ms.Show();
                return;
            }
            try
            {
                B_ProgramFileInfo pfEntity = new B_ProgramFileInfo();
                pfEntity.ID = int.Parse(strID);
                string strProcessID = pfEntity.ProcessID;
                //if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE)
                //{
                //    pfEntity.ProcessID = null;
                //    pfEntity.Year = null;
                //    //pfEntity.ApplyStyle = null;
                //    //pfEntity.ArchiveState = null;
                //    //pfEntity.Edition = null;

                //    if (pfEntity.Save() == false)
                //    {
                //        IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                //        ms.Show();
                //        return;
                //    }

                //}//创建
                //else
                //{
                //    if (pfEntity.Delete() == false)
                //    {
                //        IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                //        ms.Show();
                //        return;
                //    }

                //}//升版、注销

                if (pfEntity.Delete() == false)
                {
                    IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                    ms.Show();
                    return;
                }
                GetSearchList(true);
                //取消流程
                AgilePointWF    ag  = new AgilePointWF();
                WorkflowService api = ag.GetAPI();
                api.CancelProcInst(strProcessID);
                IMessage msg = new WebFormMessage(Page, "撤销成功。");
                msg.Show();
            }
            catch (Exception ex)
            {
                IMessage ms = new WebFormMessage(Page, ex.Message.Length > 300 ? ex.Message.Substring(0, 300) : ex.Message);
                ms.Show();
            }
        }
        /// <summary>
        /// 重新发起
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProgramFileList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string id = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString();
            B_ProgramFileInfo pfEntity = new B_ProgramFileInfo();
            pfEntity.ID = int.Parse(id);
            if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE)
            {
                if (pfEntity.Files.Length > 0)
                { return; }//存在附件
                pfEntity.ApplyStyle = null;
                pfEntity.ArchiveState = null;
                pfEntity.Year = null;
                pfEntity.Edition = null;

                if (pfEntity.Save())
                {
                    GetSearchList(true);
                    IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC);
                    ms.Show();
                }
                else
                {
                    string strErr = string.Empty;
                    if (pfEntity.ErrMsgs.Count != 0)
                    {
                        foreach (string str in pfEntity.ErrMsgs)
                        {
                            strErr += str;
                        }
                    }
                    IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr);
                    ms.Show();
                }
            }//创建程序
            else
            {
                if (pfEntity.Delete())
                {
                    GetSearchList(true);
                    IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC);
                    ms.Show();
                }
                else
                {
                    string strErr = string.Empty;
                    if (pfEntity.ErrMsgs.Count != 0)
                    {
                        foreach (string str in pfEntity.ErrMsgs)
                        {
                            strErr += str;
                        }
                    }
                    IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr);
                    ms.Show();
                }
            }//升版、注销程序
        }
        /// <summary>
        /// 绑定列表信息
        /// </summary>
        /// <param name="proTypeID"></param>
        /// <param name="proSubTypeID"></param>
        /// <param name="sort"></param>
        /// <param name="archiveState"></param>
        /// <param name="name"></param>
        /// <param name="code"></param>
        /// <param name="edition"></param>
        /// <param name="applyStyle"></param>
        private void BindProgramFileList(bool isSearch, int proTypeID, int proSubTypeID, string sort, string archiveState, string name, string code, string edition, string applyStyle)
        {
            B_ProgramFileInfo bllProFile = new B_ProgramFileInfo();

            int iStart = 0;
            int iEnd = 0;
            int iCount = 0;
            if (isSearch)
            {
                this.gvProgramFileList.PageIndex = 0;
                iCount = bllProFile.GetCountUseExteriorPage(proTypeID, proSubTypeID, sort, archiveState, name, code, edition, applyStyle, 1, gvProgramFileList.PageSize, ref iStart, ref iEnd);
            }
            else
            {
                iCount = bllProFile.GetCountUseExteriorPage(proTypeID, proSubTypeID, sort, archiveState, name, code, edition, applyStyle, gvProgramFileList.PageIndex + 1, gvProgramFileList.PageSize, ref iStart, ref iEnd);
            }
            DataTable dtList = bllProFile.GetProgamFileUseExteriorPage(proTypeID, proSubTypeID, sort, archiveState, name, code, edition, applyStyle, iStart, iEnd);

            this.gvProgramFileList.RecordCount = iCount;
            //绑定数据
            this.gvProgramFileList.DataSource = dtList;

            this.gvProgramFileList.DataBind();
        }
示例#22
0
        /// <summary>
        /// 升版程序提交按钮事件(升版、注销)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirms_Click(object sender, EventArgs e)
        {
            if (ddlDept2.SelectedIndex == -1)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE);
                ms.Show();
                return;
            }
            if (string.IsNullOrEmpty(ddlDept2.SelectedValue) && ddlDept2.SelectedIndex == 0)
            {
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED);
                ms.Show();
                return;
            }
            bool isUsed    = false;
            bool isRelUsed = false;

            if (rdolstStyle.SelectedIndex == 0)
            {
                isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_UPDATE);
                int iEdition = int.Parse(lblEdition.Text) - 1;
                isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_DELETE);
            }//升版
            else
            {
                isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_DELETE);
                int iEdition = int.Parse(lblEdition.Text) + 1;
                isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_UPDATE);
            }//注销
            if (isUsed)
            {
                IMessage ms = new WebFormMessage(Page, txtNames.Text + "第" + lblEditions.Text + "版,已在流程流转中。");
                ms.Show();
                return;
            }//所选程序文件已占用
            if (isRelUsed)
            {
                string strPrompt = string.Empty;
                strPrompt = rdolstStyle.SelectedIndex == 0 ? "正在注销流转中,不能升版。" : "正在升版流转中,不能注销。";
                IMessage ms = new WebFormMessage(Page, txtNames.Text + strPrompt);
                ms.Show();
                return;
            }

            GridViewRow row = this.gvProgramFilesList.SelectedRow;

            B_ProgramFileInfo bProFile = new B_ProgramFileInfo();

            bProFile.Name         = txtNames.Text.ToString().Trim();
            bProFile.Edition      = lblEditions.Text.ToString().Trim();
            bProFile.Code         = txtCodes.Text.ToString().Trim();
            bProFile.Sort         = row.Cells[SORTS].Text.ToString().Trim();
            bProFile.ProTypId     = int.Parse(row.Cells[TYPES_ID].Text.ToString().Trim());
            bProFile.ProTypSubId  = int.Parse(row.Cells[SUBTYPES_ID].Text.ToString().Trim());
            bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//未完成
            B_DocumentNo_A docNo_A = new B_DocumentNo_A();

            bProFile.SerialID   = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号
            bProFile.Year       = DateTime.Now.Year.ToString();
            bProFile.ApplyStyle = rdolstStyle.SelectedIndex == 0 ? ConstString.ProgramFile.PROGRAM_UPDATE : ConstString.ProgramFile.PROGRAM_DELETE;
            string deptID = ddlDept2.SelectedValue;

            //string serialID = txtSerialID2.Text.Trim();

            //if (rdolstStyle.SelectedIndex == 0)
            //{
            if (bProFile.Save())
            {
                RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle,
                            this.hfSorts.Value, ddlDept2.SelectedValue, bProFile.SerialID);
            }
            else
            {
                IMessage im = new WebFormMessage(Page, "提交失败。");
                im.Show();
            }
            //}//升版
            //else
            //{
            //    RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, deptID);
            //}//注销
        }
        private string Devolve2DC2(HN_OA2DC oaDev, B_PF enProFile, string strDraftDept, string dealUser, string sProcessName)
        {
            string sXml = "";

            List <FounderSoftware.ADIM.OA.OA2DC.DevKVItem> ls = oaDev.MapFunction("DC", sProcessName);

            FounderSoftware.ADIM.OA.OA2DC.HNDC_CArchiveNode ar = new HNDC_CArchiveNode();
            FounderSoftware.ADIM.OA.OA2DC.HNDC_CFileNode    fl = new HNDC_CFileNode();

            #region 开始生成Archive节点
            ar.System = "OA_" + base.IdentityID.ToString();
            string ObjPlatForm = oaDev.GetCfgNodeValues("/Devolve/Process[@Name='" + sProcessName + "']/Object");
            switch (ObjPlatForm)
            {
            case "DC":
                ar.SysFlag = "1";
                break;

            case "FC":
                ar.SysFlag = "2";
                break;

            default:
                ar.SysFlag = "1";
                break;
            }

            #region 根据DevolveConfig.xml配置参数设置Archive归档节点
            for (int i = 0; i < ls.Count; i++)
            {
                string skey  = (ls[i] as FounderSoftware.ADIM.OA.OA2DC.DevKVItem).sKey;
                string sName = (ls[i] as FounderSoftware.ADIM.OA.OA2DC.DevKVItem).sValue;
                string sType = (ls[i] as FounderSoftware.ADIM.OA.OA2DC.DevKVItem).sType;
                ar.SetAttribute(skey, oaDev.PreHandel(enProFile, sName, sType) /*(entity.GetVal(sName) as string)*/);
            }
            ar.SetOAArchiveNode();
            // 其他节点处理应放置在SetOAArchiveNode方法之后
            // 编制单位-主办部门
            ar.FormationDept = strDraftDept;
            // 功能领域-程序子类
            ar.FunctionField = B_ProgramFileInfo.GetProSubTypeName(enProFile.ProgramFileID);

            //return Devolve2DP(oaDev, sDPID, ar);
            #endregion 根据DevolveConfig.xml配置参数设置Archive归档节点

            ar.ElectronicDocumentCount = enProFile.FileList.Count.ToString();
            #endregion
            sXml = oaDev.GenOAArchiveNode(ar, sProcessName);

            /****开始生成File节点************************************************************************/
            #region 开始生成File节点
            fl.AuthorizeTime   = ar.AuthorizeTime;
            fl.Code            = ar.Code;
            fl.Code19          = ar.Code19;
            fl.D_FileStatus    = ar.D_FileStatus;
            fl.DocCodesExplain = "";
            fl.DocPages        = ar.DocPages;
            fl.ElectronicDocumentTransceiverTime = ar.ElectronicDocumentTransceiverTime;
            fl.Ext_1         = ar.Ext_1;
            fl.Ext_2         = ar.Ext_2;
            fl.Ext_3         = ar.Ext_3;
            fl.Ext_4         = ar.Ext_4;
            fl.Ext_5         = ar.Ext_5;
            fl.Title         = ar.Title;
            fl.FK_ArchiveID  = ar.FK_Archive;
            fl.FK_CategoryID = ar.FK_CategoryID;
            fl.FormationDept = ar.FormationDept;
            fl.FormationTime = ar.FormationTime;
            fl.Importer      = ar.Importer;
            fl.ImporterTime  = ar.ImporterTime;
            fl.OriginalID    = ar.OriginalID;
            fl.OtherTitle    = ar.OtherTitle;
            fl.PaperDocumentTransceiverTime = ar.PaperDocumentTransceiverTime;
            fl.RelatedCode = ar.RelatedCode;
            fl.Revision    = ar.Revision;
            #endregion
            sXml = oaDev.GenOAFileNode(fl);
            /****完成生成File节点************************************************************************/

            #region 始生成Attachment节点
            /****开始生成Attachment节点******************************************************************/
            string sServerWeb = oaDev.GetCfgNodeValues("/Devolve/Other/ServerWeb");
            //"http://172.29.128.239";
            //string sDocumentName = oaDev.GetCfgNodeValues("/Devolve/Other/DocumentName");
            for (int i = 0; i < enProFile.FileList.Count; i++)
            {
                HNDC_CAttachmentNode at = new HNDC_CAttachmentNode();
                CFuJian file            = enProFile.FileList[i];

                at.DocumentName  = ProcessConstString.TemplateName.PROGRAM_FILE; //file.FileName;
                at.FK_FileID     = "";
                at.MakeDate      = "";
                at.MakeUnit      = "";
                at.PublishedTime = "";
                at.Remark        = "";

                at.ServerWeb = sServerWeb;
                Double iSize = 0;
                string sSize = file.Size.ToUpper();
                if (sSize.Contains("K"))
                {
                    sSize = sSize.Replace("K", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024;
                }
                if (sSize.Contains("M"))
                {
                    sSize = sSize.Replace("M", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024 * 1024;
                }
                at.Size     = ((int)iSize).ToString();
                at.TimeSize = "";
                at.Title    = file.Alias;
                at.Type     = file.Type;
                at.Url      = file.URL;

                sXml = oaDev.GenOAAttachmentNode(fl.FK_ArchiveID, at);
            }
            #endregion
            /****完成生成Attachment节点******************************************************************/

            return(sXml);
        }