protected void Application_Start(object sender, EventArgs e) { String l_strDataSource = OAConfig.GetConfig("数据库", "DataSource"); String l_strDatabase = OAConfig.GetConfig("数据库", "DataBase"); String l_strUserId = OAConfig.GetConfig("数据库", "uid"); String l_strPassword = OAConfig.GetConfig("数据库", "pwd"); //初始化数据库连接 if (!Entity.InitDB(ConstString.Miscellaneous.DATA_BASE_TYPE, l_strDataSource, l_strDatabase, l_strUserId, l_strPassword, 30)) { throw new Exception("数据库连接错误"); } SQLHelper.InitDB1(OAConfig.GetConfig("数据库", "ADIMSqlServer")); SQLHelper.InitDB2(OAConfig.GetConfig("数据库", "AgilePointSqlServer")); //自动阅知 AutoRead.Instance.TimerStart(); //自动迁移旧数据 AutoBackup.Instance.TimerStart(); //把XML文件加载到缓存中 string strPath = AppDomain.CurrentDomain.BaseDirectory + @"Config\SelectGroup.xml"; if (!string.IsNullOrEmpty(strPath)) { XmlDocument doc = new XmlDocument(); doc.Load(strPath); DataCache cache = new DataCache(); cache.ExpireTime = 1440; cache.CacheName = "SelectGroup"; cache.CacheItemName = "SelectGroupItem"; cache.SetCache(doc); } }
//绑定所有下拉选框 private void DPDataBind() { DataTable dt = proBll.Sel(); proDP.DataSource = dt; proDP.DataTextField = "ProcedureName"; proDP.DataValueField = "ID"; proDP.DataBind(); proDP.Items.Insert(0, new ListItem("自由流程", "0")); //机密等下拉选框绑定 Secret.DataSource = OAConfig.StrToDic(OAConfig.Secret); Secret.DataValueField = "Key"; Secret.DataTextField = "Value"; Secret.DataBind(); Urgency.DataSource = OAConfig.StrToDic(OAConfig.Urgency); Urgency.DataValueField = "Key"; Urgency.DataTextField = "Value"; Urgency.DataBind(); Importance.DataSource = OAConfig.StrToDic(OAConfig.Importance); Importance.DataValueField = "Key"; Importance.DataTextField = "Value"; Importance.DataBind(); }
//函件收发归档 iNum第几个附件 public static string[] GetUploadFileInfoOld(string UCProcessType, string filePath, string documentNo, int iNum) { string[] ret = new string[4]; if (UCProcessType == "函件发文" || UCProcessType == "新版函件发文") { UCProcessType = OAConfig.GetConfig("旧版函件归档", "函件发文归档库"); } else { UCProcessType = OAConfig.GetConfig("旧版函件归档", "函件收文归档库"); } ret[0] = OAConfig.GetConfig("旧版函件归档", "ServerWeb"); if (UCProcessType == "") { ret[1] = "Temp"; } else { ret[1] = UCProcessType; } ret[2] = ""; //旧版没文件夹 if (iNum == 0) { ret[3] = documentNo + System.IO.Path.GetExtension(filePath); //文件名 } else { ret[3] = documentNo + "[" + iNum.ToString() + "]" + System.IO.Path.GetExtension(filePath); //文件名 } return(ret); }
/// <summary> /// 绑定数据 /// </summary> private void LoadTaskList() { //当前登录用户账号 String l_strUserName = CurrentUserInfo.UserName; //得到检索条件 M_CompleteFile l_entityTask = GetSearchCondition(); B_CompletedTaskFile l_busTaskList = new B_CompletedTaskFile(); l_entityTask.Start = gvTaskList.PageIndex * gvTaskList.PageSize; l_entityTask.End = gvTaskList.PageIndex * gvTaskList.PageSize + gvTaskList.PageSize; l_entityTask.Sort = SortExpression; if (!chkIsCurrentWare.Checked && !chkIsHistoryWare.Checked) { this.gvTaskList.RecordCount = 0; this.gvTaskList.DataSource = new DataTable(); this.gvTaskList.DataBind(); return; } //得到已办文件任务列表 DataTable l_dtbDataTable = l_busTaskList.GetAllCompleteHandled(l_entityTask); //流程代理添加(流程代理开启,显示代理人项) this.gvTaskList.Columns[10].Visible = OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" ? true : false; //绑定数据 this.gvTaskList.RecordCount = l_entityTask.RowCount; this.gvTaskList.DataSource = l_dtbDataTable; this.gvTaskList.DataBind(); }
private void GetNodes() { OAConfig.ReInstance(); DataTable dt = JsonHelper.JsonToDT(OAConfig.NodeMap); RPT.DataSource = dt; RPT.DataBind(); }
///// <summary>chen ///// 流程类型选择事件 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //protected void ddlProcessTemplate_SelectedIndexChanged(object sender, EventArgs e) //{ // if (this.ddlProcessTemplate.SelectedIndex == 0) // { // this.ddlStepName.Enabled = false; // this.ddlStepName.Items.Clear(); // } // else // { // this.ddlStepName.Enabled = true; // //得到流程类型对应的流程步骤 // TemplateAdmin TAdmin = new TemplateAdmin(); // String l_strTemplateName = this.ddlProcessTemplate.SelectedValue; // DataTable l_dtbDataTable = TAdmin.Templates.GetTemplate(l_strTemplateName).GetVersion(1).GetViewList(); // //加入空选择行 // DataRow l_dtrDataRow = l_dtbDataTable.NewRow(); // l_dtrDataRow[0] = DBNull.Value; // l_dtrDataRow[1] = ""; // l_dtrDataRow[2] = DBNull.Value; // l_dtbDataTable.Rows.InsertAt(l_dtrDataRow, 0); // //绑定数据 // this.ddlStepName.DataSource = l_dtbDataTable; // this.ddlStepName.DataBind(); // } // LoadTaskList(); //} protected void gvTaskList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) { return; } DataRowView l_drvRowView = e.Row.DataItem as DataRowView; if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && e.Row.RowType == DataControlRowType.DataRow) { (e.Row.FindControl("lblAgentUserName") as Label).Text = l_drvRowView["AgentUserName"].ToString(); } DistinctUrgentDegree(l_drvRowView["UrgentDegree"], e.Row.Cells[0]); String l_strCategory = l_drvRowView["Category"].ToString(); String l_strReceiveUserID = l_drvRowView["ReceiveUserID"].ToString(); string strStatus = l_drvRowView["D_StepStatus"].ToString(); HyperLink l_hlkView = e.Row.FindControl("hlkView") as HyperLink; l_hlkView.NavigateUrl = String.Format("../../Container.aspx?TemplateName={0}&ProcessID={1}&WorkItemID={2}&StepName={3}&TBID={4}&IsHistory=1", l_drvRowView["DEF_NAME"].ToString(), l_drvRowView["ProcessID"].ToString(), l_drvRowView["WorkItemID"].ToString(), l_drvRowView["StepName"].ToString(), l_drvRowView["ID"].ToString()); e.Row.Cells[1].Controls.Add(l_hlkView); switch (l_strCategory) { case "已阅": e.Row.Cells[2].Text = "<font style='color:#0080FF'>已阅</font>"; l_hlkView.NavigateUrl = String.Format("../../Container.aspx?ClassName=FS.ADIM.OA.WebUI.WorkFlow.Circulate.PG_Circulate&TemplateName={0}&ProcessID={1}&WorkItemID={2}&TBID={3}&CirculateID={4}&IsRead=True&RDT={5:yyyy/MM/dd hh时mm分ss秒}&IsHistory=1&MS=3&ID={4}", l_drvRowView["DEF_NAME"].ToString(), l_drvRowView["ProcessID"].ToString(), l_drvRowView["WorkItemID"].ToString(), l_drvRowView["ID"].ToString(), l_drvRowView["CirculateID"].ToString(), l_drvRowView["SendDateTime"].ToString()); break; case "已办": e.Row.Cells[2].Text = "<font style='color:#FF00FF'>已办</font>"; break; case "公办": if (strStatus == "Completed") { e.Row.Cells[2].Text = "<font style='color:#2633DE'>自己公办</font>"; } else { e.Row.Cells[2].Text = "<font style='color:green'>他人公办</font>"; } break; default: break; } //添加关联函件 if (l_drvRowView["DEF_NAME"].ToString().Contains("函件收文") || l_drvRowView["DEF_NAME"].ToString().Contains("函件发文")) { System.Web.UI.HtmlControls.HtmlAnchor l_htmlAnchor = new System.Web.UI.HtmlControls.HtmlAnchor(); l_htmlAnchor.InnerText = "查看"; l_htmlAnchor.Target = "_blank"; l_htmlAnchor.HRef = @"../Process/PG_ProcessRelation.aspx?ProcessType=" + l_drvRowView["DEF_NAME"].ToString() + "&ProcessID=" + l_drvRowView["ProcessID"].ToString(); e.Row.Cells[14].Controls.Add(l_htmlAnchor); } }
//以下为处理历史附件 public List <CFuJian> GetNewListFuJian(string UCProcessType, string workItemID, List <CFuJian> list) { try { if (workItemID == "") //第一次 草稿箱 { return(list); } string serverWeb = OAConfig.GetConfig("MOSS认证", "ServerWeb"); bool isNewList = false; for (int i = 0; i < list.Count; i++) { if (list[i].WorkItemID != workItemID) { string[] ret = new string[4]; ret[0] = serverWeb; ret[1] = list[i].ProcessType; ret[2] = list[i].FolderName; //文件夹 ret[3] = list[i].FileName; //文件名 string newFileName = GetFileName() + System.IO.Path.GetExtension(list[i].FileName); string[] newRet = null; if (OAConfig.GetConfig("MOSS认证", "是否启用DLL") == "1") { newRet = DocumentManager.CopyTo(ret, newFileName, true); } else { newRet = GetMOSSAPI().CopyTo(ret, newFileName, true); } list[i].Title = newFileName; list[i].FileName = newFileName; //新文件名 list[i].fullURL = newRet[0]; list[i].URL = newRet[1]; list[i].Edition = list[i].Edition + 1; list[i].WorkItemID = workItemID; isNewList = true; } } int ret2 = 0; if (isNewList) { ret2 = SaveNewList(UCProcessType, workItemID, list); } return(list); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 将附件下载为 字节流 /// </summary> /// <param name="UCProcessType"></param> /// <param name="URL"></param> /// <returns></returns> public static Byte[] DownLoad(string UCProcessType, string URL) { Byte[] fileByte = null; if (OAConfig.GetConfig("MOSS认证", "是否启用DLL") == "1") { fileByte = DocumentManager.Download(MossObject.GetDownLoadFileInfo(UCProcessType, URL)); } else { fileByte = MossObject.GetMOSSAPI().Download(MossObject.GetDownLoadFileInfo(UCProcessType, URL)); } return(fileByte); }
protected void saveBtn_Click(object sender, EventArgs e) { OAConfig.ModelID = Convert.ToInt32(bindModel.Text); OAConfig.UNameConfig = UNameConfigR.SelectedValue; OAConfig.AllowMsg = allowMsgR.Checked ? "1" : "0"; OAConfig.AllowUI = allowUIR.Checked ? "1" : "0"; OAConfig.OATitle = oaTitleT.Text; OAConfig.OALogo = logoT.Text; OAConfig.MailSize = Convert.ToInt32(MailSize_T.Text.Trim()); OAConfig.LeaderSignTemplate = Leader_T.Text; OAConfig.ParterSignTemplate = Parter_T.Text; OAConfig.Update(); function.WriteSuccessMsg("保存成功"); }
/// <summary> /// MOSS附件大小 /// </summary> /// <param name="UCProcessType"></param> /// <param name="URL"></param> /// <returns></returns> public static long FileLength(string UCProcessType, string URL) { long fileLength; if (OAConfig.GetConfig("MOSS认证", "是否启用DLL") == "1") { fileLength = DocumentManager.FileLength(MossObject.GetDownLoadFileInfo(UCProcessType, URL)); } else { fileLength = MossObject.GetMOSSAPI().FileLength(MossObject.GetDownLoadFileInfo(UCProcessType, URL)); } return(fileLength); }
protected void NodeSavBtn_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("NodeName"); dt.Columns.Add("NodeID"); for (int i = 0; i < RPT.Items.Count; i++) { string[] tempstr = new string[] { ((HiddenField)RPT.Items[i].FindControl("ID_Hid")).Value, ((TextBox)RPT.Items[i].FindControl("tbNodeName")).Text, ((TextBox)RPT.Items[i].FindControl("tbNodeID")).Text }; dt.Rows.Add(tempstr); } OAConfig.NodeMap = JsonHelper.JsonSerialDataTable(dt); OAConfig.Update(); }
public static string[] GetUploadFileInfo(string UCProcessType, string filePath) { string[] ret = new string[4]; ret[0] = OAConfig.GetConfig("MOSS认证", "ServerWeb"); if (UCProcessType == "") { ret[1] = "Temp"; } else { ret[1] = UCProcessType; } ret[2] = MossObject.GetFolderName(); //文件夹 ret[3] = MossObject.GetFileName() + System.IO.Path.GetExtension(filePath); //文件名 return(ret); }
/// <summary> /// 将附件下载 写入文件 /// </summary> /// <param name="UCProcessType"></param> /// <param name="URL"></param> /// <returns></returns> public static string DownLoad_New(string UCProcessType, string URL) { string filePath = null; string strTempFileName = "Download_OA_" + Current.UserName + "_"; if (OAConfig.GetConfig("MOSS认证", "是否启用DLL") == "1") { filePath = DocumentManager.Download_New(MossObject.GetDownLoadFileInfo(UCProcessType, URL), strTempFileName); } else { filePath = MossObject.GetMOSSAPI().Download_New(MossObject.GetDownLoadFileInfo(UCProcessType, URL), strTempFileName); } return(filePath); }
protected void Page_Load(object sender, EventArgs e) { String l_strCirculateTime = null; //加载流程表单 LoadProcessForm(); if (!IsPostBack) { this.ucCirculateList.UCProcessID = base.ProcessID; this.ucCirculateList.UCTemplateName = base.TemplateName; this.ucCirculateList.SetButtonVisible(); this.ucGoOnCirculate.UCProcessID = base.ProcessID; this.ucGoOnCirculate.UCProcessType = base.TemplateName; this.ucGoOnCirculate.UCWorkItemID = base.WorkItemID; this.ucGoOnCirculate.UCShowComment = true; //显示传阅意见 this.ucGoOnCirculate.LoadComment(); //加载传阅意见 //公司收文传阅超过30天,意见框不显示 if (base.TemplateName == ProcessConstString.TemplateName.COMPANY_RECEIVE) { l_strCirculateTime = Request.QueryString["RDT"]; if (!String.IsNullOrEmpty(l_strCirculateTime)) { DateTime l_datCirculateTime = DateTime.Parse(l_strCirculateTime); String l_strValidDays = OAConfig.GetConfig("传阅有效期", "天数"); int l_intDefaultDays = 7; if (!String.IsNullOrEmpty(l_strValidDays)) { l_intDefaultDays = SysConvert.ToInt32(l_strValidDays); } DateTime l_datMergeTimes = l_datCirculateTime.AddDays(l_intDefaultDays); ucGoOnCirculate.IsVisible = l_datMergeTimes >= System.DateTime.Now ? true : false; } } if (Request.QueryString["IsRead"] == "True") { this.btnRead.Visible = false; //this.ucGoOnCirculate.UCIsRead = true; } ucGoOnCirculate.InitLoad(); this.btnGoOnCirculate.Visible = ucGoOnCirculate.UCIsGoOnCirculate; } }
protected void ddlProc_SelectedIndexChanged(object sender, EventArgs e) { this.ddlStep.Items.Clear(); DataTable dt = OAConfig.GetDevolveRoleConfig(ddlProc.Text /*this.ddlProc.SelectedItem.Text*/); if (dt == null) { return; } for (int i = 0; i < dt.Rows.Count; i++) { this.ddlStep.Items.Add(dt.Rows[i]["StepName"].ToString()); } /* * switch (ddlProc.Text) * { * case "公司发文": * InitListItems(GF_Step); * break; * case "公司收文": * InitListItems(GS_Step); * break; * case "新版函件发文": * InitListItems(HF_Step); * break; * case "新版函件收文": * InitListItems(HS_Step); * break; * case "请示报告": * InitListItems(RR_Step); * break; * case "工作联系单": * InitListItems(WR_Step); * break; * case "程序文件": * InitListItems(PF_Step); * break; * //case "党政工团发文": * // InitListItems(MF_Step); * // break; * //case "党政工团收文": * // InitListItems(MS_Step); * // break; * }*/ }
/// <summary> /// 私有的构造函数 /// </summary> private AutoRead() { string strSpan = OAConfig.GetConfig("自动传阅期限", "定时执行"); this.m_timer = new System.Timers.Timer(); //this.m_timer.Enabled = false; //this.m_timer.Interval = 12 * 60 * 60 * 1000; //默认12个小时执行一次 if (strSpan == "") { this.m_timer.Interval = 3600000;//1小时 } else { strSpan = strSpan + "000"; this.m_timer.Interval = Convert.ToInt32(strSpan); } this.m_timer.Elapsed += new System.Timers.ElapsedEventHandler(m_timer_Elapsed); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlSubSys.Items.Add("OA"); string strDataSource = OAConfig.GetConfig("数据库", "DataSource"); string strAGUrl = OAConfig.GetConfig("AgilePoint认证", "ServerUrl"); string strOUDataSource = OAConfig.GetConfig("数据库", "ADIMOUSqlServer"); //ViewBase vb =FS.ADIM.OU.OutBLL.OADept.GetAllDeptIDAndName(); //string a = vb.GetFieldVals("ID",";"); //Label1.Text = "数据库:" + strDataSource + "<br/>" + "AgilePoint服务器:" + strAGUrl + "<br/>" + "OU数据库" + strOUDataSource; } }
/// <summary> /// 私有的构造函数 /// </summary> private AutoBackup() { string strSpan = OAConfig.GetConfig("自动迁移旧数据", "定时执行"); this.m_timer = new System.Timers.Timer(); //this.m_timer.Enabled = false; //this.m_timer.Interval = 24 * 60 * 60 * 1000; //默认24个小时执行一次 if (strSpan == "") { this.m_timer.Interval = 86400000;//24小时 //this.m_timer.Interval = 180000; } else { strSpan = strSpan + "0000"; this.m_timer.Interval = Convert.ToInt32(strSpan); } this.m_timer.Elapsed += new System.Timers.ElapsedEventHandler(m_timer_Elapsed); }
public static string[] GetDownLoadFileInfo(string UCProcessType, string filePath) { string[] ret = new string[4]; ret[0] = OAConfig.GetConfig("MOSS认证", "ServerWeb"); if (UCProcessType == "") { ret[1] = "Temp"; } else { ret[1] = UCProcessType; } int index = filePath.LastIndexOf('/'); ret[2] = filePath.Substring(0, index); ret[3] = filePath.Substring(index + 1, filePath.Length - index - 1); return(ret); }
public static OA_DocumentService GetMOSSOldAPI() { string user = OAConfig.GetConfig("旧版函件归档", "Credential_User"); string pwd = OAConfig.GetConfig("旧版函件归档", "Credential_Pwd"); string domain = OAConfig.GetConfig("旧版函件归档", "Credential_Domain"); string url = OAConfig.GetConfig("旧版函件归档", "MossServiceUrl"); OA_DocumentService api = new OA_DocumentService(); api.Credentials = new System.Net.NetworkCredential(user, pwd, domain); api.Url = url; try { int ret = api.Test(); } catch { api.Credentials = System.Net.CredentialCache.DefaultCredentials; } return(api); }
public string GetImport(string importance) { return(OAConfig.StrToDic(OAConfig.Importance)[importance]); }
public string GetUrgency(string Urgency) { return(OAConfig.StrToDic(OAConfig.Urgency)[Urgency]); }
protected void imgbtnLogin_Click(object sender, EventArgs e) { String strFile = "D:\\HNPCADIM\\FS.ADIM.OA\\FS.ADIM.OA.WebUI\\template\\Singer\\孟辉.png"; //this.TextBoxFile.Text; String strName = "孟辉"; // this.TextBoxName.Text; String sPath = strFile; String sTableName = "T_OU_User"; MemoryStream ms = new MemoryStream(); System.Drawing.Image image = System.Drawing.Image.FromFile(sPath); string sSQL = "update " + sTableName + " set [Image] = " + image + " where Name = '" + strName + "'"; System.Data.DataTable dtImgData = FounderSoftware.Framework.Business.Entity.RunQuery(sSQL, "Sql", OAConfig.GetConfig("数据库", "DataSource"), OAConfig.GetConfig("数据库", "DataBase"), OAConfig.GetConfig("数据库", "uid"), OAConfig.GetConfig("数据库", "pwd")); //Bitmap newbitmap = new Bitmap(image.Width, image.Height); //Graphics g = Graphics.FromImage(newbitmap); //g.DrawImageUnscaled(image, 0, 0); //newbitmap.Save(sPath, ImageFormat.Png); //System.Drawing.Image.FromStream(ms)..Save(sPath); //g.Dispose(); //newbitmap.Dispose(); //image.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { DataSet l_dstDataSet = null; if (!Page.IsPostBack) { this.ucSendUnit.UCNameControl = this.txtReceiveUnit.ClientID; this.CompanyUC2.UCNameControl = this.txtQueryRecUnit.ClientID; this.TemplateName = Request.QueryString[ConstString.QueryString.TEMPLATE_NAME]; if (String.IsNullOrEmpty(this.TemplateName)) { JScript.ShowMsgBox(this.Page, MsgType.VbCritical, "没有指定收文流程模版!", "Container.aspx?ClassName=FS.ADIM.OA.WebUI.WorkflowMenu.ToDoTask.PG_WaitHandle"); return; } l_dstDataSet = OAConfig.GetRankConfig(); DataTable l_dtbDataTable = l_dstDataSet.Tables[this.TemplateName == ProcessConstString.TemplateName.COMPANY_RECEIVE ? this.TemplateName : ProcessConstString.TemplateName.MERGED_RECEIVE];//renjinquan+ String[] l_strAryRoleName = l_dtbDataTable.Rows[0]["角色"].ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (l_strAryRoleName.Length == 0) { JScript.RedirectPage(this.Page, "未配置收文登记权限", this.TemplateName, "1"); return; } String[] l_strAryUserRoleNames = CurrentUserInfo.RoleName.ToArray(); IEnumerable <String> l_enumRole = l_strAryUserRoleNames.Intersect(l_strAryRoleName); if (l_enumRole.Count() == 0) { JScript.RedirectPage(this.Page, string.Format("只有[{0}] {1} 可以访问该表单!", l_strAryRoleName[0], OAUser.GetUserByRole(l_strAryRoleName[0]).GetFieldVals("Name", ",")), TemplateName, "1"); return; } if (TemplateName != ProcessConstString.TemplateName.COMPANY_RECEIVE) { trProcessTemplate.Visible = true; this.ddlProcessTemplate.SelectedValue = this.TemplateName; } else { SubTemplateName = TemplateName; } //设置客户端只读 txtReceiveUnit.Attributes.Add("readOnly", "true"); ////////////////////////////////////////////////////20110124 扬子江 //if (!(TemplateName.Equals("党纪工团收文"))) //{ txtDocumentNo.Attributes.Add("readonly", "true"); //} this.ucFileList.UCTemplateName = TemplateName; //收文年份默认加载前后十年,并且默认选择当前年份 int l_intYear = DateTime.Now.Year; for (int i = l_intYear - 10; i < l_intYear + 10; i++) { ddlReceiveYear.Items.Add(i.ToString()); ddlQueryRecYear.Items.Add(i.ToString()); } ddlReceiveYear.Text = l_intYear.ToString(); txtReceiveDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); LoadRegisterList(); if (!String.IsNullOrEmpty(FormID)) { SetFormByID(FormID); } if (this.TemplateName != ProcessConstString.TemplateName.COMPANY_RECEIVE && this.ddlProcessTemplate.SelectedIndex >= 0) { ddlProcessTemplate_SelectedIndexChanged(null, null); } } }
public void AddContentToNode(M_OA_Document oaDoc, int NodeID, int ModelID) { DataTable table = new DataTable(); table.Columns.Add(new DataColumn("FieldName", typeof(string))); table.Columns.Add(new DataColumn("FieldType", typeof(string))); table.Columns.Add(new DataColumn("FieldValue", typeof(string))); //手动完成赋值 string[] fieldArr = { "Secret", "Urgency", "Importance", "Attach", "UserGroupT", "content" }; for (int i = 0; i < fieldArr.Length; i++) { DataRow dr = table.NewRow(); dr["FieldName"] = fieldArr[i]; dr["FieldType"] = "TextType"; table.Rows.Add(dr); } table.Rows[0]["FieldValue"] = OAConfig.StrToDic(OAConfig.Secret)[oaDoc.Secret.ToString()]; table.Rows[1]["FieldValue"] = OAConfig.StrToDic(OAConfig.Urgency)[oaDoc.Urgency.ToString()]; table.Rows[2]["FieldValue"] = OAConfig.StrToDic(OAConfig.Importance)[oaDoc.Importance.ToString()]; table.Rows[3]["FieldValue"] = oaDoc.PublicAttach; table.Rows[4]["FieldValue"] = groupBll.GetByID(buser.GetLogin().GroupID).GroupName; table.Rows[5]["FieldType"] = "MultipleHtmlType"; table.Rows[5]["FieldValue"] = oaDoc.Content; //将无法获取的值,手动写入table中 M_CommonData CData = new M_CommonData(); CData.NodeID = NodeID; CData.ModelID = ModelID; CData.TableName = bmode.GetModelById(ModelID).TableName; CData.Title = oaDoc.Title; //判断是否使用文件流程 if (SiteConfig.SiteOption.ContentConfig == 1) { CData.Status = 0; } else { CData.Status = 99; } CData.Inputer = buser.GetLogin().UserName; CData.EliteLevel = 0; CData.InfoID = ""; CData.SpecialID = ""; CData.Hits = 0; CData.UpDateType = 2; CData.UpDateTime = DateTime.Now; //string Keyword = this.TxtTagKey.Text.Trim().Replace(" ", "|"); CData.TagKey = oaDoc.Keywords; CData.Status = 99;//状态,如果需要审核后才能看到,这里做下逻辑 CData.Titlecolor = ""; CData.Template = ""; CData.CreateTime = DateTime.Now; CData.ProWeek = 0; CData.Pronum = 0; CData.BidType = 0; CData.IsBid = (CData.BidType > 0) ? 1 : 0; CData.BidMoney = DataConverter.CDouble(0); CData.DefaultSkins = 0; CData.FirstNodeID = 0; //GetNo(NodeID) CData.TitleStyle = ""; CData.ParentTree = conBll.GetParentTree(NodeID); //父级别树 CData.TopImg = ""; //首页图片 CData.PdfLink = ""; CData.Subtitle = ""; CData.PYtitle = ""; int newID = conBll.AddContent(table, CData); }
protected void Page_Load(object sender, EventArgs e) { try { //进度条 inlineProgressBar.AddTrigger(btnUpload); //首次加载 if (!IsPostBack) { //Response.Expires = -1; //Response.ExpiresAbsolute = DateTime.Now; //Response.CacheControl = "no-cache"; //设置控件状态 if (UCIsAgain == "") { if (!UCIsEditable) { tbUpload.Visible = false; divUpload.Visible = false; btnOL.Visible = false; } } #region 接收值 //初始化赋值 if (Session["附件ListTemp"] != null) //从用户控件接收过来 { UCDataList = MossObject.Xml2FuJianList((String)Session["附件ListTemp"]); txtFJXML.Value = Session["附件ListTemp"].ToString(); Session.Remove("附件ListTemp"); //移除Session } #endregion multiFile.StorageConfig["tempDirectory"] = Path.Combine("App_Data", "file1temp"); //zhouli 处理历史附件 if (UCDataList.Count > 0 && UCWorkItemID != "" && UCIsEditable) { MossObject mossObject = new MossObject(); UCDataList = mossObject.GetNewListFuJian(UCProcessType, UCWorkItemID, UCDataList); } RepeaterFiles.DataSource = UCDataList; RepeaterFiles.DataBind(); #region 在线编辑设置 //在线编辑设置 //第一个是webservice地址 第二个是本地路径地址 第三个moss server web地址 第四个当前用户名 txtServicePath.Value = OAConfig.GetConfig("MOSS认证", "MossServiceUrl") + @",C:\\LocalTemp," + OAConfig.GetConfig("MOSS认证", "ServerWeb") + "," + CurrentUserInfo.DisplayName + ","; if (!UCIsEditable) { Panel1.Visible = false; } else { btnOL.Attributes.Add("onClick", String.Format("AttachmentWork('{0}','{1}');", UCControlID, txtServicePath.ClientID)); } #endregion RunScript(); } } catch (Exception ex) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, ex.Message); } }
/// <summary> /// 上传附件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpload_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(UCProcessType)) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, "文档库设置不能为空!"); return; } if (multiFile.Files.Length <= 0) { return; } foreach (UploadedFile file in multiFile.Files) { if (file.FileName.Contains("#") || file.FileName.Contains("'")) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, file.FileName + "含有特殊字符,请替换后再上传"); JScript.ResponseScript(this, "javascript:__doPostBack('LinkButton1','')"); return; } } foreach (UploadedFile file in multiFile.Files) { if (file.ContentLength <= MossObject.maxFileSize * 1024 * 1024) { MossObject attach = new MossObject(); attach.ServerWeb = OAConfig.GetConfig("MOSS认证", "ServerWeb"); attach.OldFileName = file.FileName; attach.DocumentName = UCProcessType; #region 更新栏位 List <DictionaryEntry> lst = new List <DictionaryEntry>(); DictionaryEntry de = new DictionaryEntry(); de.Key = "流程实例"; de.Value = UCProcessID; lst.Add(de); de = new DictionaryEntry(); de.Key = "别名"; de.Value = file.FileName; lst.Add(de); de = new DictionaryEntry(); de.Key = "上次修改者"; de.Value = CurrentUserInfo.DisplayName; lst.Add(de); #endregion DictionaryEntry[] result = attach.ConvertToDE(lst.ToArray()); attach.DocumentEntry = result; //文件扩展名 string fileType = System.IO.Path.GetExtension(file.FileName); if (fileType.IndexOf('.') == 0) { fileType = fileType.Substring(1); } bool IsSuccess = false; if ("exe,dll".Contains(fileType.ToLower())) { IMessage im = new WebFormMessage(Page, "不可上传exe或dll文件!"); im.Show(); IsSuccess = false; } else { attach.UploadFilesStream = file.InputStream; //上传附件并更新栏位 IsSuccess = attach.Upload(); } if (IsSuccess) { CFuJian ff = new CFuJian(); ff.Type = System.IO.Path.GetExtension(attach.FileName); if (ff.Type.IndexOf('.') == 0) { ff.Type = ff.Type.Substring(1); } ff.Title = attach.FileName; ff.Alias = System.IO.Path.GetFileNameWithoutExtension(attach.OldFileName); ff.FolderName = attach.FolderName; ff.FileName = attach.FileName; ff.Size = attach.ToFileSize_new(file.ContentLength); //文件大小 ff.ProcessType = UCProcessType; ff.WorkItemID = UCWorkItemID; ff.fullURL = attach.UploadFullName; //全路径 ff.URL = attach.UploadURL; //文件夹+/文件名 UCDataList.Add(ff); } //CFuJian l_objAttachment = MossObject.Upload(file, UCProcessType, UCProcessID, UCWorkItemID); //UCDataList.Add(l_objAttachment); } else { JScript.ShowMsgBox(Page, MsgType.VbExclamation, file.FileName + "大小超过" + MossObject.maxFileSize + "M"); } } RepeaterFiles.DataSource = UCDataList; RepeaterFiles.DataBind(); RunScript(); } catch (Exception ex) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, ex.Message); } }
/// <summary> /// 得到检索条件数据实体 /// </summary> /// <returns>检索条件数据实体</returns> private M_ProcessSearch GetSearchCondition() { B_ProcessInstance l_busProcessList = new B_ProcessInstance(); M_ProcessSearch l_entQueryCondition = new M_ProcessSearch(); String l_strValue = String.Empty; String[] l_strAryUserRoleNames = CurrentUserInfo.RoleName.ToArray(); String[] l_strAryUserPositions = null; String[] l_strAryUserSingles = new String[] { CurrentUserInfo.DisplayName }; DataTable l_dtbPosition = CurrentUserInfo.DeptPost; DataSet l_dstDataSet = OAConfig.GetRankConfig(); String l_strAllSubDeptID = String.Empty; l_entQueryCondition.PositionName = "普通员工"; l_entQueryCondition.PositionValue = CurrentUserInfo.UserName; if (l_dtbPosition != null && l_dtbPosition.Rows.Count > 0) { l_strAryUserPositions = new String[l_dtbPosition.Rows.Count]; for (int i = 0; i < l_dtbPosition.Rows.Count; i++) { l_strAryUserPositions[i] = l_dtbPosition.Rows[i]["PostName"].ToString(); l_strValue += l_dtbPosition.Rows[i]["FK_DeptID"].ToString() + ","; } } foreach (DataTable l_dtbDataTable in l_dstDataSet.Tables) { if (l_dtbDataTable.TableName == "公司收文" || l_dtbDataTable.TableName == "函件收文" || l_dtbDataTable.TableName == "党纪工团收文") { continue; } String[] l_strAryRoleName = l_dtbDataTable.Rows[0]["角色"].ToString().Split(new char[] { ';' }); String[] l_strAryPositionName = l_dtbDataTable.Rows[0]["职位"].ToString().Split(new char[] { ';' }); String[] l_strArySingle = l_dtbDataTable.Rows[0]["人员"].ToString().Split(new char[] { ';' }); if (l_dtbDataTable.TableName == "处室权限" || l_dtbDataTable.TableName == "科室权限") { if (!String.IsNullOrEmpty(l_strValue)) { DataTable l_dtbSubDept = l_busProcessList.GetAllSubDeptID(l_strValue.Substring(0, l_strValue.Length - 1)); l_strAllSubDeptID = String.Empty; if (l_dtbSubDept.Rows.Count != 0) { l_strAllSubDeptID = l_dtbSubDept.Rows[0][0].ToString().Replace("<U ID=\"", "").Replace("\"/>", ","); if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } } } } if (l_strAryUserRoleNames != null && l_strAryUserRoleNames.Count() > 0) { IEnumerable <String> l_enumRole = l_strAryUserRoleNames.Intersect(l_strAryRoleName); if (l_enumRole.Count() > 0) { if (l_dtbDataTable.TableName == "领导权限") { l_entQueryCondition.PositionName = ConstString.RoleName.COMPANY_LEADER; l_entQueryCondition.PositionValue = null; break; } else if (l_dtbDataTable.TableName == "处室权限") { if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionName = "处长"; l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } break; } else if (l_dtbDataTable.TableName == "科室权限") { if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionName = "科长"; l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } } } } if (l_strAryUserPositions != null && l_strAryUserPositions.Count() > 0) { IEnumerable <String> l_enumPosition = l_strAryUserPositions.Intersect(l_strAryPositionName); if (l_enumPosition.Count() > 0) { if (l_dtbDataTable.TableName == "领导权限") { l_entQueryCondition.PositionName = ConstString.RoleName.COMPANY_LEADER; l_entQueryCondition.PositionValue = null; break; } else if (l_dtbDataTable.TableName == "处室权限") { if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionName = "处长"; l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } break; } else if (l_dtbDataTable.TableName == "科室权限") { if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionName = "科长"; l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } } } } IEnumerable <String> l_enumSingle = l_strAryUserSingles.Intersect(l_strArySingle); if (l_enumSingle.Count() > 0) { if (l_dtbDataTable.TableName == "领导权限") { l_entQueryCondition.PositionName = ConstString.RoleName.COMPANY_LEADER; l_entQueryCondition.PositionValue = null; break; } else if (l_dtbDataTable.TableName == "处室权限") { if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionName = "处长"; l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } break; } else if (l_dtbDataTable.TableName == "科室权限") { if (!String.IsNullOrEmpty(l_strAllSubDeptID)) { l_entQueryCondition.PositionName = "科长"; l_entQueryCondition.PositionValue = l_strAllSubDeptID.Substring(0, l_strAllSubDeptID.Length - 1); } } } } //是否备份查询 l_entQueryCondition.IsHistorySearch = this.chbHistorySearch.Checked; //流程模版名称 l_entQueryCondition.TemplateName = ddlProcessTemplate.SelectedValue; //流程实例名 l_entQueryCondition.ProcInstName = FormsMethod.Filter(txtProcInstName.Text); ////当前步骤 //l_entQueryCondition.StepName = ddlStepName.SelectedValue; //文号 l_entQueryCondition.DocumentNo = FormsMethod.Filter(txtDocumentNo.Text); //文件标题 l_entQueryCondition.DocumentTitle = FormsMethod.Filter(txtDocumentTitle.Text); //发起人 l_entQueryCondition.Initiator = FormsMethod.Filter(txtSponsor.Text); //发起日期-开始 l_entQueryCondition.StartTime = txtStartDate.ValDate; //发起日期-结束 l_entQueryCondition.EndTime = txtEndDate.ValDate; //状态 l_entQueryCondition.Status = ddlProcessStatus.SelectedValue; //接受人 l_entQueryCondition.ReceiveUser = FormsMethod.Filter(this.txtChuLiRen.Text); switch (this.ddlProcessTemplate.SelectedValue) { //公司发文 case ProcessConstString.TemplateName.COMPANY_SEND: case ProcessConstString.TemplateName.DJGT_Send: //renjinquan+ l_entQueryCondition.GFHostDept = drpGFDept.SelectedValue; l_entQueryCondition.GFHostDeptName = drpGFDept.SelectedItem.Text; l_entQueryCondition.GFMainSenders = FormsMethod.Filter(txtGFZhuSongDanWei.Text); break; //公司收文 case ProcessConstString.TemplateName.COMPANY_RECEIVE: case ProcessConstString.TemplateName.MERGED_RECEIVE: //renjinquan+ l_entQueryCondition.GSReceiveUnit = FormsMethod.Filter(txtGSReceiveUnit.Text); break; //函件收文 case ProcessConstString.TemplateName.LETTER_RECEIVE: l_entQueryCondition.HSLetterType = ddlHSLetterType.SelectedValue; if (this.ddlHSLetterType.SelectedItem != null) { l_entQueryCondition.HSLetterTypeName = this.ddlHSLetterType.SelectedItem.Text; } l_entQueryCondition.HSReceiveUnit = FormsMethod.Filter(txtHSReceiveUnit.Text); l_entQueryCondition.HSFileEncoding = FormsMethod.Filter(txtHSFileEncoding.Text); break; //函件发文 case ProcessConstString.TemplateName.LETTER_SEND: l_entQueryCondition.HFCompany = FormsMethod.Filter(txtHFCompany.Text); l_entQueryCondition.HFHanJianID = ddlHFLetterType.SelectedValue; l_entQueryCondition.HFSendDept = FormsMethod.Filter(ddlHFDept.SelectedValue); if (this.ddlHFLetterType.SelectedItem != null) { l_entQueryCondition.HFHanJianType = this.ddlHFLetterType.SelectedItem.Text; } if (this.ddlHFDept.SelectedItem != null) { l_entQueryCondition.HFSendDeptName = this.ddlHFDept.SelectedItem.Text; } break; //程序文件 case ProcessConstString.TemplateName.PROGRAM_FILE: l_entQueryCondition.PFHostDept = FormsMethod.Filter(this.ddlPFDept.SelectedValue); break; //工作联系单 case ProcessConstString.TemplateName.AFFILIATION: //编制部门 if (this.ddlWRHostDept.SelectedItem != null) { l_entQueryCondition.WRHostDept = FormsMethod.Filter(this.ddlWRHostDept.SelectedItem.Text); } //主送部门 if (this.ddlWRMainSendDept.SelectedItem != null) { l_entQueryCondition.WRMainSend = FormsMethod.Filter(this.ddlWRMainSendDept.SelectedItem.Text); } break; //请示报告 case ProcessConstString.TemplateName.INSTUCTION_REPORT: //主送领导 if (this.ddlMainSendleader.SelectedItem != null) { l_entQueryCondition.RRMainLeader = this.ddlMainSendleader.SelectedItem.Text; } //承办处室 l_entQueryCondition.RRUnderTakeDept = FormsMethod.Filter(this.ddlUnderTakeDept.SelectedValue); //承办处室name if (this.ddlUnderTakeDept.SelectedItem != null) { l_entQueryCondition.RRUnderTakeDeptName = this.ddlUnderTakeDept.SelectedItem.Text; } //编制部门 if (this.ddlHostDept.SelectedItem != null) { l_entQueryCondition.RRHostDept = this.ddlHostDept.SelectedItem.Text; } break; } return(l_entQueryCondition); }
public string GetSecret(string Secret) { return(OAConfig.StrToDic(OAConfig.Secret)[Secret]); }
public static CFuJian Upload(UploadedFile file, string UCProcessType, string UCProcessID, string UCWorkItemID) { CFuJian cFuJian = new CFuJian(); OA_DocumentService api = MossObject.GetMOSSAPI(); string[] fileInfo = GetUploadFileInfo(UCProcessType, file.FileName); cFuJian.Type = System.IO.Path.GetExtension(file.FileName); //文件类型 扩展名 if (cFuJian.Type.IndexOf('.') > -1) { cFuJian.Type = cFuJian.Type.Substring(1); } cFuJian.Alias = file.FileName.Substring(0, file.FileName.Length - cFuJian.Type.Length - 1); //别名 //ff.Title = ff.Alias + "." + ff.Type; cFuJian.Title = fileInfo[3]; if (cFuJian.Type.Length == 0)//没有扩展名 { cFuJian.Alias = file.FileName; } cFuJian.Alias = cFuJian.Alias.Replace(" ", ""); cFuJian.FolderName = fileInfo[2]; cFuJian.FileName = fileInfo[3]; cFuJian.Size = MossObject.ToFileSize(file.ContentLength); //文件大小 cFuJian.ProcessType = UCProcessType; cFuJian.WorkItemID = UCWorkItemID; string[] saveUrl; #region DLL if (OAConfig.GetConfig("MOSS认证", "是否启用DLL") == "1") { #region 更新栏位 List <System.Collections.DictionaryEntry> lst = new List <System.Collections.DictionaryEntry>(); System.Collections.DictionaryEntry de = new System.Collections.DictionaryEntry(); de.Key = "流程实例"; de.Value = UCProcessID; lst.Add(de); de = new System.Collections.DictionaryEntry(); de.Key = "别名"; de.Value = cFuJian.Alias; lst.Add(de); de = new System.Collections.DictionaryEntry(); de.Key = "上次修改者"; de.Value = CurrentUserInfo.DisplayName; lst.Add(de); #endregion System.Collections.DictionaryEntry[] result = DocumentManager.ConvertToDE(lst.ToArray()); if (file.ContentLength <= MossObject.middleFileSize * 1024 * 1024) { saveUrl = DocumentManager.Upload(fileInfo, MossObject.StreamToBytes(file.InputStream), result, false); } else { string strFileTemp = "D:\\FileTemp\\"; if (System.IO.Directory.Exists(strFileTemp) == false) { System.IO.Directory.CreateDirectory(strFileTemp); } string fileTemp = strFileTemp + "OA" + Current.UserName + Path.GetFileNameWithoutExtension(file.TmpFile.Name); string filePath = fileTemp + file.FileName; p1: if (System.IO.File.Exists(filePath)) { filePath = fileTemp + new Random(1).Next(100).ToString() + file.FileName; goto p1; } else { file.TmpFile.MoveTo(filePath); } saveUrl = DocumentManager.Upload(fileInfo, filePath, result, false); File.Delete(filePath); } ////int ret = api.CopyTo(fileInfo, "322.doc", true); //file.TmpFile.Delete(); //删除临时文件 //cFuJian.fullURL = saveUrl[0]; //全路径 //cFuJian.URL = saveUrl[1];//文件夹+/文件名 //cFuJian.Encode = "";//文件编码 //return cFuJian; } #endregion #region webservice else { #region 更新栏位 List <DictionaryEntry> lst = new List <DictionaryEntry>(); DictionaryEntry de = new DictionaryEntry(); de.Key = "流程实例"; de.Value = UCProcessID; lst.Add(de); de = new DictionaryEntry(); de.Key = "别名"; de.Value = cFuJian.Alias; lst.Add(de); de = new DictionaryEntry(); de.Key = "上次修改者"; de.Value = CurrentUserInfo.DisplayName; lst.Add(de); #endregion DictionaryEntry[] result = api.ConvertToDE(lst.ToArray()); if (file.ContentLength <= MossObject.middleFileSize * 1024 * 1024) { //上传到文档库 saveUrl = api.Upload(fileInfo, MossObject.StreamToBytes(file.InputStream), result, false); } else { string strFileTemp = "D:\\FileTemp\\"; if (System.IO.Directory.Exists(strFileTemp) == false) { System.IO.Directory.CreateDirectory(strFileTemp); } string fileTemp = strFileTemp + "OA" + Current.UserName + Path.GetFileNameWithoutExtension(file.TmpFile.Name); string filePath = fileTemp + file.FileName; p1: if (System.IO.File.Exists(filePath)) { filePath = fileTemp + new Random(1).Next(100).ToString() + file.FileName; goto p1; } else { file.TmpFile.MoveTo(filePath); } saveUrl = api.Upload_New(fileInfo, filePath, result, false); File.Delete(filePath); } } #endregion file.TmpFile.Delete(); //删除临时文件 cFuJian.fullURL = saveUrl[0]; //全路径 cFuJian.URL = saveUrl[1]; //文件夹+/文件名 cFuJian.Encode = ""; //文件编码 return(cFuJian); }