/// <summary> /// 对相关文件进行FTP中的操作 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="fileID">文件ID</param> /// <param name="sortID">类别ID</param> /// <param name="error">错误信息</param> public void OperatorFTPSystemFile(DepotManagementDataContext ctx, int fileID, int sortID) { FileServiceSocket serverFTP = new FileServiceSocket(GlobalObject.GlobalParameter.FTPServerIP, GlobalObject.GlobalParameter.FTPServerAdvancedUser, GlobalObject.GlobalParameter.FTPServerAdvancedPassword); var varFile = from a in ctx.FM_FileList where a.FileID == fileID select a; FM_FileList lnqChangeFile = varFile.Single(); FM_FileSort lnqSort = SortInfo(sortID); if (lnqSort == null) { lnqChangeFile.DeleteFlag = true; } else { lnqChangeFile.SortID = sortID; } if (serverFTP.Errormessage.Length != 0) { throw new Exception(serverFTP.Errormessage); } }
/// <summary> /// 获得文件分类的文件路径 /// </summary> /// <param name="sortID">类别ID</param> /// <returns>返回文件路径</returns> public string SortPath(int sortID) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.FM_FileSort where a.SortID == sortID select a; if (varData.Count() == 1) { FM_FileSort lnqSort = varData.Single(); if (lnqSort.ParentID == 0) { return("/" + lnqSort.SortName); } else { return(SortPath((int)lnqSort.ParentID) + "/" + lnqSort.SortName); } } else { return(""); } }
/// <summary> /// 显示信息 /// </summary> void ShowInfo() { if (m_lnqInstitution != null) { txtSDBNo.Text = m_lnqInstitution.BillNo; txtFileName.Text = m_lnqInstitution.FileName; txtFileNo.Text = m_lnqInstitution.FileNo; FM_FileSort sort = m_serverFileBasic.SortInfo(m_lnqInstitution.SortID); txtFileSort.Text = sort.SortName; txtFileSort.Tag = sort.SortID; txtRemark.Text = m_lnqInstitution.Introductions; lbPropoer.Text = m_lnqInstitution.Propoer; lbPropoerTime.Text = m_lnqInstitution.PropoerTime.ToString(); lbSDBStatus.Text = m_lnqInstitution.BillStatus; llbFileDownLoad.Text = lbPropoer.Text + "的文件"; llbFileDownLoad.Tag = m_lnqInstitution.FileUnique; } else { lbSDBStatus.Text = InstitutionBillStatus.新建流程.ToString(); lbPropoer.Text = BasicInfo.LoginName; lbPropoerTime.Text = ServerTime.Time.ToString(); txtSDBNo.Text = m_billNoControl.GetNewBillNo(); llbFileDownLoad.Text = ""; } }
/// <summary> /// 获得数据 /// </summary> void GetInfo() { m_lnqFileSort = new FM_FileSort(); m_lnqFileSort.ParentID = txtParent.Tag.ToString() == "" ? 0 : Convert.ToInt32(txtParent.Tag); m_lnqFileSort.SortName = txtName.Text; m_lnqFileSort.SortID = txtName.Tag.ToString() == "" ? 0 : Convert.ToInt32(txtName.Tag); m_lnqFileSort.FileType = (int)CE_FileType.体系文件; }
/// <summary> /// 显示信息 /// </summary> void ShowInfo() { if (m_lnqInstitution != null) { txtSDBNo.Text = m_lnqInstitution.BillNo; txtFileName.Text = m_lnqInstitution.FileName; txtFileNo.Text = m_lnqInstitution.FileNo; txtReplaceFileNo.Tag = m_lnqInstitution.ReplaceFileID; if (txtReplaceFileNo.Tag != null) { FM_FileList fileInfo = m_serverFileBasic.GetFile((int)txtReplaceFileNo.Tag); txtReplaceFileNo.Text = fileInfo.FileNo; txtReplaceFileName.Text = fileInfo.FileName; txtRepalceVersion.Text = fileInfo.Version; } txtDepartment.Tag = m_lnqInstitution.Department; txtDepartment.Text = txtDepartment.Tag == null ? "" : UniversalFunction.GetDeptName(txtDepartment.Tag.ToString()); FM_FileSort sort = m_serverFileBasic.SortInfo(m_lnqInstitution.SortID); txtFileSort.Text = sort.SortName; txtFileSort.Tag = sort.SortID; txtRemark.Text = m_lnqInstitution.Introductions; lbPropoer.Text = m_lnqInstitution.Propoer; lbPropoerTime.Text = m_lnqInstitution.PropoerTime.ToString(); lbSDBStatus.Text = m_lnqInstitution.BillStatus; llbFileDownLoad.Text = lbPropoer.Text + "的文件"; llbFileDownLoad.Tag = m_lnqInstitution.FileUnique; if (m_lnqInstitution.OperationMode == radioButton1.Text) { radioButton1.Checked = true; radioButton2.Checked = false; } else { radioButton1.Checked = false; radioButton2.Checked = true; } } else { lbSDBStatus.Text = InstitutionBillStatus.新建流程.ToString(); lbPropoer.Text = BasicInfo.LoginName; lbPropoerTime.Text = ServerTime.Time.ToString(); txtSDBNo.Text = m_billNoControl.GetNewBillNo(); llbFileDownLoad.Text = ""; } }
/// <summary> /// 是否为第三层次文件 /// </summary> /// <param name="sortID">文件类别ID</param> /// <returns>是 返回True,否 返回False</returns> bool IsThreeTripFile(int sortID) { ISystemFileBasicInfo serverBasic = ServerModuleFactory.GetServerModule <ISystemFileBasicInfo>(); FM_FileSort sort = serverBasic.SortInfo(sortID); if (sort.FileType == (int)CE_FileType.制度文件) { if (sort.SortName.Contains("_规定、细则、规程、标准")) { return(true); } else { return(false); } } else { return(false); } }
/// <summary> /// 对体系文件类别进行操作 /// </summary> /// <param name="mode">操作类别</param> /// <param name="sort">LINQ数据集</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool Operator(CE_OperatorMode mode, FM_FileSort sort, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; FM_FileSort lnqTemp = new FM_FileSort(); var varData = from a in ctx.FM_FileSort select a; switch (mode) { case CE_OperatorMode.添加: varData = from a in ctx.FM_FileSort where a.ParentID == sort.ParentID && a.SortName == sort.SortName select a; if (varData.Count() > 0) { error = "数据重复"; return(false); } else { lnqTemp.SortName = sort.SortName; lnqTemp.ParentID = sort.ParentID; lnqTemp.FileType = sort.FileType; ctx.FM_FileSort.InsertOnSubmit(sort); } break; case CE_OperatorMode.修改: varData = from a in ctx.FM_FileSort where a.SortID == sort.SortID select a; if (varData.Count() != 1) { error = "数据错误"; return(false); } else { lnqTemp = varData.Single(); lnqTemp.SortName = sort.SortName; lnqTemp.ParentID = sort.ParentID; } break; case CE_OperatorMode.除: varData = from a in ctx.FM_FileSort where a.SortID == sort.SortID select a; ctx.FM_FileSort.DeleteAllOnSubmit(varData); break; default: break; } ctx.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }