/// <summary> /// /// </summary> /// <param name="workflowData"></param> /// <param name="record"></param> /// <returns></returns> public static string GetWorkTaskStatus(DataTable workflowData, LP_Record record) { if (workflowData.Rows[0]["TaskTypeId"].ToString() == "1") return "add"; string tmpStr = " where WorkTaskInsId='" + workflowData.Rows[0]["WorkTaskInsId"] + "' and( (OperStatus='1' and TaskTypeId!='2' ) or TaskTypeId='2'or TaskTypeId='6' )"; IList<WF_WorkTaskInstanceView> li = MainHelper.PlatformSqlMap.GetList<WF_WorkTaskInstanceView>( "SelectWF_WorkTaskInstanceViewList", tmpStr); if (li.Count == 0) { tmpStr = " where WorkTaskInsId='" + workflowData.Rows[0]["WorkTaskInsId"] + "' and( (OperStatus='0' and TaskTypeId!='2' ) or TaskTypeId='2'or TaskTypeId='6' )"; li = MainHelper.PlatformSqlMap.GetList<WF_WorkTaskInstanceView>( "SelectWF_WorkTaskInstanceViewList", tmpStr); } if (li.Count > 0) { tmpStr = " where WorkTaskInsId='" + li[0].PreviousTaskId + "' and( (OperStatus='1' and TaskTypeId!='2' ) or TaskTypeId='2'or TaskTypeId='6' )"; li = MainHelper.PlatformSqlMap.GetList<WF_WorkTaskInstanceView>( "SelectWF_WorkTaskInstanceViewList", tmpStr); if (li.Count > 0 && li[0].TaskTypeId == "1") { if (GetWorkTaskModle(li[0].WorkFlowId, li[0].WorkTaskId).ToString().IndexOf("Ebada.Scgl.Lcgl.WorkFlowLineSelectForm") > -1) return "add"; } } return "edit"; }
void btn_Submit_Click(object sender, EventArgs e) { Excel.Workbook wb; //Excel.Worksheet sheet; wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; if (activeSheetName != "") { sheet = wb.Application.Sheets[activeSheetName] as Excel.Worksheet; } else { sheet = wb.Application.Sheets[1] as Excel.Worksheet; } //activeSheetIndex = sheet.Index; if (filecontrol != null) { if (filecontrol.Isupfile) { MsgBox.ShowTipMessageBox("请稍后,正在上传文件"); return; } if (filecontrol.Isdownfile) { if (MsgBox.ShowAskMessageBox("正在下载文件,确认提交?") != DialogResult.OK) { return; } } } for (int i = 1; i <= wb.Application.Sheets.Count; i++) { if (i != activeSheetIndex) { Excel.Worksheet tmpSheet = (Excel.Worksheet)wb.Application.Sheets.get_Item(i); try { if (tmpSheet != null) tmpSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible; } catch { } } } unLockExcel(wb, sheet); for (int i = 1; sheet.Protection.AllowEditRanges.Count > 0; ) { Excel.AllowEditRange editRange = sheet.Protection.AllowEditRanges.get_Item(i); editRange.Delete(); } LockExcel(wb, sheet); byte[] bt = new byte[0]; string strmes = ""; WF_WorkTaskCommands wt; if (strNumber != "") currRecord.Number = strNumber; ArrayList akeys = new ArrayList(valuehs.Keys); List<object> list = new List<object>(); DateTime dt = DateTime.Now; Random rd = new Random(); int irpos = 5001; WF_TableFieldValue wfv = null; decimal dtemp = Convert.ToDecimal(dt.ToString("yyyyMMddHHmmssffffff")); for (int i = 0; i < akeys.Count; i++) { wfv = valuehs[akeys[i]] as WF_TableFieldValue; if (wfv.XExcelPos != -1 && wfv.YExcelPos != -1) wfv.ID = Convert.ToString((dtemp + wfv.YExcelPos + wfv.XExcelPos * 10000)); else { wfv.ID = Convert.ToString((dtemp + irpos + irpos * 10000)); irpos++; } wfv.RecordId = currRecord.ID; wfv.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); wfv.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); wfv.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); wfv.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); wfv.UserControlId = parentTemple.LPID; //MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv); //Thread.Sleep(new TimeSpan(100000));//0.1毫秒 wfv.ID = wfv.CreateID() + new Random().Next(10, 99); list.Add(wfv); MainHelper.PlatformSqlMap.DeleteByWhere<WF_TableFieldValue>(" where FieldId ='" + wfv.FieldId + "' and WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"); } //foreach (WF_TableFieldValue wfv in list) //{ // Console.Write(wfv.ID+"\r\n"); //} if (RecordWorkTask.CheckOnRiZhi(WorkFlowData)) { RecordWorkTask.CreatRiZhi(WorkFlowData, dsoFramerWordControl1, currRecord.ID, new object[] { currRecord }); } //RecordWorkTask.CreateJL(WorkFlowData, dsoFramerWordControl1, currRecord.ID, new object[] { currRecord }); if (strxiestatus == "add") { if (list.Count > 0) { Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(list, null, null); } } else { if (list.Count > 0) { foreach (WF_TableFieldValue wfv2 in list) { WF_TableFieldValue wtfvtemp = Client.ClientHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(" where UserControlId='" + parentTemple.LPID + "'" + " and WorkflowId='" + wfv2.WorkFlowId + "'" + " and RecordId='" + wfv2.RecordId + "'" + " and UserControlId='" + wfv2.UserControlId + "'" + " and WorkFlowInsId='" + wfv2.WorkFlowInsId + "'" + " and fieldname='" + wfv2.FieldName + "'" + " and FieldId='" + wfv2.FieldId + "'" + " and XExcelPos='" + wfv2.XExcelPos + "'" + " and YExcelPos='" + wfv2.YExcelPos + "'" + " and WorkTaskId='" + wfv2.WorkTaskId + "'" ); if (wtfvtemp != null) wfv2.ID = wtfvtemp.ID; else { wfv2.ID = wfv2.CreateID(); Client.ClientHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv2); } } Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, list, null); } } LP_Temple lp = MainHelper.PlatformSqlMap.GetOne<LP_Temple>(" where ParentID='" + parentTemple.LPID + "' and SortID=1"); if (lp != null) { if (wfv == null) { wfv = new WF_TableFieldValue(); wfv.ID = wfv.CreateID(); wfv.RecordId = currRecord.ID; wfv.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); wfv.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); wfv.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); wfv.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); wfv.UserControlId = parentTemple.LPID; wfv.ControlValue = ""; wfv.FieldId = lp.LPID; wfv.FieldName = lp.CellName; wfv.XExcelPos = GetCellPos(lp.CellPos)[0]; wfv.YExcelPos = GetCellPos(lp.CellPos)[1]; wfv.ExcelSheetName = activeSheetName; } wfv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(" where UserControlId='" + parentTemple.LPID + "'" + " and WorkflowId='" + wfv.WorkFlowId + "'" + " and RecordId='" + wfv.RecordId + "'" + " and UserControlId='" + wfv.UserControlId + "'" + " and WorkFlowInsId='" + wfv.WorkFlowInsId + "'" + " and fieldname='" + lp.CellName + "'" + " and FieldId='" + lp.LPID + "' and Bigdata is not null" ); dsoFramerWordControl1.FileSave(); currRecord.DocContent = dsoFramerWordControl1.FileDataGzip; if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; if (wfv == null) { wfv = new WF_TableFieldValue(); wfv.ID = wfv.CreateID(); wfv.RecordId = currRecord.ID; wfv.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); wfv.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); wfv.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); wfv.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); wfv.UserControlId = parentTemple.LPID; wfv.ControlValue = ""; wfv.FieldId = lp.LPID; wfv.FieldName = lp.CellName; wfv.XExcelPos = GetCellPos(lp.CellPos)[0]; wfv.YExcelPos = GetCellPos(lp.CellPos)[1]; wfv.ExcelSheetName = activeSheetName; wfv.Bigdata = currRecord.DocContent; MainHelper.PlatformSqlMap.Create<WF_TableFieldValue>(wfv); } else { wfv.Bigdata = currRecord.DocContent; MainHelper.PlatformSqlMap.Update<WF_TableFieldValue>(wfv); } } RunTaskUpdate(); RunTaskRecordUpdate(); switch (status) { case "add": //LP_Record newRecord = new LP_Record(); currRecord.Kind = kind; currRecord.Content = GetContent(); dsoFramerWordControl1.FileSave(); //dsoFramerWordControl1.FileClose(); if (ctrlNumber != null) currRecord.Number = ctrlNumber.Text; //currRecord.ImageAttachment = bt; //currRecord.SignImg = bt; currRecord.LastChangeTime = DateTime.Now.ToString(); //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID); wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"); if (wt != null) { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName); } else { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交"); } //strmes = strtemp[0]; //currRecord.Status = strtemp[1]; if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else MsgBox.ShowTipMessageBox(strmes); strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString()); if (strmes == "结束节点1") { currRecord.Status = "存档"; } else { currRecord.Status = strmes; } if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; MainHelper.PlatformSqlMap.Update("UpdateLP_Record", currRecord); rowData = null; if (hqyjcontrol != null) { PJ_lcspyj lcyj = new PJ_lcspyj(); lcyj.Charman = MainHelper.User.UserName; lcyj.ID = PJ_lcspyj.Newid(); lcyj.RecordID = currRecord.ID; lcyj.taskID = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); lcyj.Spyj = hqyjcontrol.nowMemoEdit.Text; lcyj.Creattime = DateTime.Now; if (hqyjcontrol.nowMemoEdit.Text != "") MainHelper.PlatformSqlMap.Create<PJ_lcspyj>(lcyj); } if (filecontrol != null) { for (int i = 0; i < filecontrol.FJtable.Rows.Count; i++) { PJ_lcfj lcfu = new PJ_lcfj(); lcfu.ID = lcfu.CreateID(); lcfu.Filename = Path.GetFileName(filecontrol.FJtable.Rows[i]["FilePath"].ToString()); lcfu.FileRelativePath = filecontrol.FJtable.Rows[i]["SaveFileName"].ToString(); lcfu.FileSize = Convert.ToInt64(filecontrol.FJtable.Rows[i]["FileSize"]); lcfu.RecordID = currRecord.ID; lcfu.Creattime = DateTime.Now; Thread.Sleep((new TimeSpan(100000)));//0.1毫秒 if (filecontrol.FJtable.Rows[i]["Kind"].ToString() != "已上传") MainHelper.PlatformSqlMap.Create<PJ_lcfj>(lcfu); } } //currRecord = newRecord; break; case "edit": currRecord.LastChangeTime = DateTime.Now.ToString(); // dsoFramerWordControl1.FileSave(); //currRecord.DocContent = this.dsoFramerWordControl1.FileDataGzip; //byte[] bt = new byte[0]; //currRecord.ImageAttachment = bt; //currRecord.SignImg = bt; currRecord.Content = GetContent(); dsoFramerWordControl1.FileSave(); //dsoFramerWordControl1.FileClose(); wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"); if (wt != null) { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName); } else { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交"); } string towho = strmes; strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString()); if (strmes.IndexOf("结束节点") > -1) { CurrRecord.Status = "存档"; } else { CurrRecord.Status = strmes; } if (towho.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else MsgBox.ShowTipMessageBox(towho); if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; MainHelper.PlatformSqlMap.Update("UpdateLP_Record", currRecord); if (hqyjcontrol != null) { PJ_lcspyj lcyj = new PJ_lcspyj(); lcyj.Charman = MainHelper.User.UserName; lcyj.ID = PJ_lcspyj.Newid(); lcyj.RecordID = currRecord.ID; lcyj.taskID = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); lcyj.Spyj = hqyjcontrol.nowMemoEdit.Text; lcyj.Creattime = DateTime.Now; if (hqyjcontrol.nowMemoEdit.Text != "") MainHelper.PlatformSqlMap.Create<PJ_lcspyj>(lcyj); } rowData = null; break; } this.DialogResult = DialogResult.OK; }
private void barReChange_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); LP_Record currRecord = new LP_Record(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } DataTable dt = RecordWorkTask.GetRecordWorkFlowData2(dr["ID"].ToString()); if (dt.Rows.Count > 0) { frmWFChange fw = new frmWFChange(); fw.Text = dt.Rows[0]["FlowInsCaption"].ToString() + "流程跳转"; fw.groupBox1.Text = dt.Rows[0]["FlowInsCaption"].ToString(); fw.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString(); if (fw.ShowDialog() != DialogResult.OK) return; //请求确认 if (MsgBox.ShowAskMessageBox("确认更改 【" + dr["Number"].ToString() + "】状态为" + fw.WorkTaskCaption + "?") != DialogResult.OK) { return; } string strmes = RecordWorkTask.RunGZPWorkFlowChange(MainHelper.User.UserID, currRecord, dt.Rows[0]["OperatorInsId"].ToString(), dt.Rows[0]["WorkTaskInsId"].ToString(), fw.WorkTaskCaption); if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else { InitData(strSQL); MsgBox.ShowTipMessageBox(strmes); } } else { MsgBox.ShowTipMessageBox("无当前用户可以操作此记录的流程信息,延期失败!"); } }
void gridViewOperation_AfterEdit(LP_Record obj) { }
private void barSus_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); //请求确认 if (MsgBox.ShowAskMessageBox("是否确认 【" + dr["Number"].ToString() + "】 延期?") != DialogResult.OK) { return; } LP_Record currRecord = new LP_Record(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } if (currRecord.Status != "确认") { MsgBox.ShowTipMessageBox("当前节点不能延期,延期失败!"); return; } DataTable dt = RecordWorkTask.GetRecordWorkFlowData(dr["ID"].ToString(), MainHelper.User.UserID); if (dt.Rows.Count > 0) { string strmes = RecordWorkTask.RunGZPWorkFlowChange(MainHelper.User.UserID, currRecord, dt.Rows[0]["OperatorInsId"].ToString(), dt.Rows[0]["WorkTaskInsId"].ToString(), "延期"); if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else { InitData(strSQL); MsgBox.ShowTipMessageBox(strmes); } } else { MsgBox.ShowTipMessageBox("无当前用户可以操作此记录的流程信息,延期失败!"); } }
private void btEditfrm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) { return; } DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); LP_Record currRecord = new LP_Record(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } DataTable dt = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID); if (!RecordWorkTask.HaveRunRecordRole(currRecord.ID, MainHelper.User.UserID)) return; object obj = RecordWorkTask.GetWorkTaskModle(dt); if (obj == null) { return; } if (obj is frmLP) { frmLP frm = new frmLP(); frm.Status = "edit"; frm.CurrRecord = currRecord; frm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(dt, currRecord); if (frm.ParentTemple == null) { MsgBox.ShowWarningMessageBox("出错,未找到该节点关联的表单,请检查模板设置!"); //return; } frm.Kind = strKind; frm.RecordWorkFlowData = dt; if (frm.ShowDialog() == DialogResult.OK) { InitData(strSQL); } } else { if (obj.GetType().GetProperty("IsWorkflowCall") != null) obj.GetType().GetProperty("IsWorkflowCall").SetValue(obj, true, null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj.GetType().GetProperty("CurrRecord") != null) obj.GetType().GetProperty("CurrRecord").SetValue(obj, currRecord, null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj.GetType().GetProperty("RecordWorkFlowData") != null) obj.GetType().GetProperty("RecordWorkFlowData").SetValue(obj, dt, null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj.GetType().GetProperty("ParentTemple") != null) obj.GetType().GetProperty("ParentTemple").SetValue(obj, RecordWorkTask.GetWorkTaskTemple(dt, currRecord), null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj is UserControl) { FormBase dlg = new FormBase(); dlg.Text = ((UserControl)obj).Name; dlg.MdiParent = MainHelper.MainForm; dlg.Controls.Add((UserControl)obj); ((UserControl)obj).Dock = DockStyle.Fill; dlg.Show(); } else if (obj is Form) { if (obj is frmyxfxWorkFlowEdit) { IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'" + " and WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc"); PJ_03yxfx yxfx = new PJ_03yxfx(); if (li.Count > 0) { yxfx = MainHelper.PlatformSqlMap.GetOneByKey<PJ_03yxfx>(li[0].ModleRecordID); } else { yxfx = new PJ_03yxfx(); yxfx.OrgCode = MainHelper.UserOrg.OrgCode; yxfx.OrgName = MainHelper.UserOrg.OrgName; if (parentObj.FlowCaption.IndexOf("定期分析") > 0) yxfx.type = "定期分析"; else if (parentObj.FlowCaption.IndexOf("专题分析") > 0) yxfx.type = "专题分析"; ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0; yxfx.rq = DateTime.Now; ((frmyxfxWorkFlowEdit)obj).RowData = yxfx; } switch (dt.Rows[0]["TaskInsCaption"].ToString()) { case "填写": ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0; break; case "领导检查": ((frmyxfxWorkFlowEdit)obj).RecordStatus = 1; break; case "检查人检查": ((frmyxfxWorkFlowEdit)obj).RecordStatus = 2; break; } yxfx.rq = DateTime.Now; ((frmyxfxWorkFlowEdit)obj).RowData = yxfx; } else if (obj is frmsbqxWorkFlowEdit) { IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'" + " and WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc"); PJ_qxfl qxfl = new PJ_qxfl(); if (li.Count > 0) { qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID); } else { qxfl = new PJ_qxfl(); qxfl.OrgCode = MainHelper.UserOrg.OrgCode; qxfl.OrgName = MainHelper.UserOrg.OrgName; } ((frmsbqxWorkFlowEdit)obj).RowData = qxfl; } ((Form)obj).ShowDialog(); } InitData(strSQL); } //获得编辑按钮的状态 this.btEditfrm.Caption = currRecord.Status; }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(LP_Record newobj) { }
public void InitData(string sql, string[] sqlColName, string[] comBoxItem, DSOFramerControl dsoFramerWordControl1, LP_Temple lp, LP_Record currRecord) { //foreach (DevExpress.XtraEditors.Repository.RepositoryItemComboBox combox in colctrllist) for (int i = 0; i < gridView1.Columns.Count; i++) { if (gridView1.Columns[i].ColumnEdit is RepositoryItemComboBox) { RepositoryItemComboBox combox = gridView1.Columns[i].ColumnEdit as RepositoryItemComboBox; combox.Items.Clear(); Regex r1 = new Regex(@"(?<=\[" + i + ":).*?(?=\\])"); string sqlSentence = ""; if (r1.Match(sql).Value != "") { sqlSentence = r1.Match(sql).Value; } if (sqlSentence != "") InitCtrlData(combox, i, lp, sqlSentence, dsoFramerWordControl1, currRecord); } else if (gridView1.Columns[i].ColumnEdit is RepositoryItemCheckedComboBoxEdit) { RepositoryItemCheckedComboBoxEdit combox = gridView1.Columns[i].ColumnEdit as RepositoryItemCheckedComboBoxEdit; combox.Items.Clear(); Regex r1 = new Regex(@"(?<=\[" + i + ":).*?(?=\\])"); string sqlSentence = ""; if (r1.Match(sql).Value != "") { sqlSentence = r1.Match(sql).Value; } if (sqlSentence != "") InitCtrlData2(combox, i, lp, sqlSentence, dsoFramerWordControl1, currRecord); } } }
void btn_Submit_Click(object sender, EventArgs e) { if (filecontrol != null) { if (filecontrol.Isupfile) { MsgBox.ShowTipMessageBox("请稍后,正在上传文件"); return; } if (filecontrol.Isdownfile) { if (MsgBox.ShowAskMessageBox("正在下载文件,确认提交?") != DialogResult.OK) { return; } } } dsoFramerWordControl1.FileSave(); currRecord.DocContent = dsoFramerWordControl1.FileDataGzip; parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; currRecord.Kind = kind; currRecord.Content = GetContent(); if (ctrlNumber != null) currRecord.Number = ctrlNumber.Text; //currRecord.ImageAttachment = bt; //currRecord.SignImg = bt; currRecord.LastChangeTime = DateTime.Now.ToString(); string strmes = ""; WF_WorkTaskCommands wt; if (RecordWorkTask.CheckOnRiZhi(WorkFlowData)) { RecordWorkTask.CreatRiZhi(WorkFlowData, dsoFramerWordControl1, currRecord.ID, new object[] { currRecord }); } //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID); wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"); if (wt != null) { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName); } else { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交"); } if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else MsgBox.ShowTipMessageBox(strmes); strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString()); if (strmes == "结束节点1") { currRecord.Status = "存档"; } else { currRecord.Status = strmes; } if (currRecord.DocContent == null) { currRecord.DocContent = new byte[0]; } if (currRecord.ImageAttachment== null) { currRecord.ImageAttachment = new byte[0]; } if (currRecord.SignImg == null) { currRecord.SignImg = new byte[0]; } currRecord.LastChangeTime = DateTime.Now.ToString(); if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; MainHelper.PlatformSqlMap.Update("UpdateLP_Record", currRecord); rowData = null; if (hqyjcontrol != null) { PJ_lcspyj lcyj = new PJ_lcspyj(); lcyj.Charman = MainHelper.User.UserName; lcyj.ID = PJ_lcspyj.Newid(); lcyj.RecordID = currRecord.ID; lcyj.taskID = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); lcyj.Spyj = hqyjcontrol.nowMemoEdit.Text; lcyj.Creattime = DateTime.Now; if (hqyjcontrol.nowMemoEdit.Text != "") MainHelper.PlatformSqlMap.Create<PJ_lcspyj>(lcyj); } if (filecontrol != null) { for (int i = 0; i < filecontrol.FJtable.Rows.Count; i++) { PJ_lcfj lcfu = new PJ_lcfj(); lcfu.ID = lcfu.CreateID(); lcfu.Filename = Path.GetFileName(filecontrol.FJtable.Rows[i]["FilePath"].ToString()); lcfu.FileRelativePath = filecontrol.FJtable.Rows[i]["SaveFileName"].ToString(); lcfu.FileSize = Convert.ToInt64(filecontrol.FJtable.Rows[i]["FileSize"]); lcfu.RecordID = currRecord.ID; lcfu.Creattime = DateTime.Now; Thread.Sleep((new TimeSpan(100000)));//0.1毫秒已上传 if ( filecontrol.FJtable.Rows[i]["Kind"].ToString() != "已上传") MainHelper.PlatformSqlMap.Create<PJ_lcfj>(lcfu); } } WF_ModleCheckTable mc = new WF_ModleCheckTable(); mc.RecordId = currRecord.ID; mc.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mc.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mc.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mc.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mc.DocContent = currRecord.DocContent; mc.Creattime = DateTime.Now; Thread.Sleep((new TimeSpan(100000)));//0.1毫秒 MainHelper.PlatformSqlMap.Create<WF_ModleCheckTable>(mc); this.DialogResult = DialogResult.OK; }
public void InitContorl() { int MaxWordWidth = 0; int currentPosY = 10; int currentPosX = 10; int index = 0; if (RecordWorkTask.HaveRunSPYJRole(kind)) { if (hqyjcontrol == null) hqyjcontrol = new SPYJControl(); hqyjcontrol.Size = new System.Drawing.Size(400, 200); hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10); currentPosY = currentPosY + hqyjcontrol.Size.Height; hqyjcontrol.RecordID = CurrRecord.ID; dockPanel1.Controls.Add(hqyjcontrol); } if (RecordWorkTask.HaveRunFuJianRole(kind)) { if (filecontrol == null) filecontrol = new DownFileControl(); string statusstemp = RecordWorkTask.GetWorkTaskStatus(WorkFlowData, currRecord); if (statusstemp == "add") filecontrol.FormType = "上传"; else if (statusstemp == "edit") { filecontrol.FormType = "下载"; } filecontrol.Size = new System.Drawing.Size(400, 300); filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10); currentPosY = currentPosY + filecontrol.Size.Height; filecontrol.UpfilePath = GetWorkFlowNmae(kind); if (currRecord == null) { currRecord = new LP_Record(); } filecontrol.RecordID = CurrRecord.ID; dockPanel1.Controls.Add(filecontrol); currentPosY += 20; } MaxWordWidth = CalcWidth(); dockPanel1.Width = MaxWordWidth + 10; switch (status) { case "add": case "edit": Button btn_Submit = new Button(); dockPanel1.Controls.Add(btn_Submit); btn_Submit.Location = new Point(currentPosX, currentPosY + 10); btn_Submit.Click += new EventHandler(btn_Submit_Click); btn_Submit.Text = "提交"; break; case "view": Button btn_View = new Button(); dockPanel1.Controls.Add(btn_View); btn_View.Location = new Point(currentPosX, currentPosY + 10); btn_View.Click += new EventHandler(btn_View_Click); btn_View.Text = "查看"; break; } if (dockPanel1.ControlContainer.Controls.Count > 0) dockPanel1.ControlContainer.Controls[0].Focus(); }
public void InitContorl() { int MaxWordWidth = CalcWidth(); int currentPosY = 10; int currentPosX = 10; int index = 0; if (MaxWordWidth < 300) MaxWordWidth = 300; try { if (parentTemple != null) { foreach (LP_Temple lp in templeList) { bool flag;//= (lp.Status == CurrRecord.Status); flag = lp.IsVisible == 0; Label label = new Label(); ComboBoxEdit btTip = null; CheckEdit ceTip = null; label.Text = lp.CellName; //string[] location = lp.CtrlLocation.Split(','); string[] size = lp.CtrlSize.Split(','); label.Location = new Point(currentPosX, currentPosY); label.Size = new Size(MaxWordWidth, 14); label.Visible = flag; if (flag) { currentPosY += 20; } IList<WF_WorkTastTrans> wttli = MainHelper.PlatformSqlMap.GetList<WF_WorkTastTrans>(" where tlcjdid='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "' and cdfs like '下拉%' and tlcjdzdid='" + lp.LPID + "'"); if (lp.CtrlType.Contains("MemoEdit") && flag && (lp.SqlSentence != "" || wttli.Count > 0)) { btTip = new ComboBoxEdit(); btTip.Name = "bt" + lp.LPID; btTip.Location = new Point(currentPosX, currentPosY); btTip.Size = new Size(300, 14); btTip.Tag = lp; ceTip = new CheckEdit(); ceTip.Name = "ce" + lp.LPID; ceTip.Location = new Point(currentPosX + btTip.Width + 10, currentPosY); ceTip.Size = new Size(80, 14); ceTip.Text = "累加"; ceTip.Checked = false; currentPosY += 30; } else if (lp.CtrlType.Contains("TextEdit") && flag && (lp.SqlSentence != "" || wttli.Count > 0)) { btTip = new ComboBoxEdit(); btTip.Name = "bt" + lp.LPID; btTip.Location = new Point(currentPosX, currentPosY); btTip.Size = new Size(300, 14); btTip.Tag = lp; ceTip = new CheckEdit(); ceTip.Name = "ce" + lp.LPID; ceTip.Location = new Point(currentPosX + btTip.Width + 10, currentPosY); ceTip.Size = new Size(80, 14); ceTip.Text = "累加"; ceTip.Checked = false; currentPosY += 30; } Control ctrl; if (lp.CtrlType.Contains("uc_gridcontrol")) { ctrl = new uc_gridcontrol(); ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged); ((uc_gridcontrol)ctrl).FocusedColumnChanged += new DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventHandler(gridView1_FocusedColumnChanged); } else ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType)); ctrl.Location = new Point(currentPosX, currentPosY); ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1])); if (flag) { currentPosY += int.Parse(size[1]) + 10; } ctrl.Enter += new EventHandler(ctrl_Enter); ctrl.Leave += new EventHandler(ctrl_Leave); ctrl.TextChanged += new EventHandler(ctrl_Leave); ctrl.Visible = flag; ctrl.Tag = lp; ctrl.TabIndex = index; if (btTip != null) { btTip.TabIndex = index; index++; btTip.TextChanged += new EventHandler(btTip_Click); } if (lp.CtrlType.Contains("uc_gridcontrol")) { label.Text = lp.CellName + "(Tab键可选下一格)"; (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar), lp); //if (RecordWorkTask.HaveRunPowerRole(WorkConst.WorkTask_BindTable, WorkFlowData.Rows[0]["WorkFlowId"].ToString(), WorkFlowData.Rows[0]["WorkTaskId"].ToString()) || currRecord.Status == "填票") { (ctrl as uc_gridcontrol).iniTableRecordData(currRecord.ID, lp, WorkFlowData.Rows[0]["WorkFlowId"].ToString(), WorkFlowData.Rows[0]["WorkFlowInsId"].ToString()); } } index++; ctrl.Name = lp.LPID; dockPanel1.Controls.Add(label); if (btTip != null) { dockPanel1.Controls.Add(btTip); dockPanel1.Controls.Add(ceTip); } dockPanel1.Controls.Add(ctrl); if (lp.CellName == "编号") { ctrlNumber = ctrl; } if (lp.CellName.Contains("编号2")) { ctrlNumber2 = ctrl; } if (lp.CtrlType.IndexOf("DateEdit") > -1) { if (lp.WordCount.ToLower().IndexOf("hh") > -1) { ((DateEdit)ctrl).Properties.VistaDisplayMode = DevExpress.Utils.DefaultBoolean.True; ((DateEdit)ctrl).Properties.VistaEditTime = DevExpress.Utils.DefaultBoolean.True; } } if (lp.CtrlType.Contains("SpinEdit") && lp.WordCount != "") { SpinEdit lue1 = (SpinEdit)ctrl; if (lp.WordCount.IndexOf("p") > -1) { lue1.Properties.Increment = (decimal)0.0001; lue1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; } else if (lp.WordCount.IndexOf(".") > -1) { Regex r2 = new Regex(@"(?<=\.).*"); lue1.Properties.Increment = (decimal)Math.Pow(0.1, r2.Match(lp.WordCount).Value.Length / 2); lue1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; } lue1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; lue1.Properties.EditFormat.FormatString = lp.WordCount; lue1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; lue1.Properties.DisplayFormat.FormatString = lp.WordCount; lue1.Properties.EditMask = lp.WordCount; } } } InitEvent(); InitData(); InitTaskData(); } catch { } try { if (RecordWorkTask.HaveRunSPYJRole(kind)) { if (hqyjcontrol == null) hqyjcontrol = new SPYJControl(); hqyjcontrol.Size = new System.Drawing.Size(400, 200); hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10); currentPosY = currentPosY + hqyjcontrol.Size.Height; hqyjcontrol.RecordID = CurrRecord.ID; hqyjcontrol.TabIndex = index; index++; dockPanel1.Controls.Add(hqyjcontrol); } if (RecordWorkTask.HaveRunFuJianRole(kind)) { if (filecontrol == null) filecontrol = new DownFileControl(); if (status == "add") filecontrol.FormType = "上传"; else if (status == "edit") { filecontrol.FormType = "下载"; } filecontrol.Size = new System.Drawing.Size(400, 200); filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10); currentPosY = currentPosY + filecontrol.Size.Height; filecontrol.UpfilePath = GetWorkFlowNmae(kind); filecontrol.TaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); if (currRecord == null) { currRecord = new LP_Record(); } filecontrol.RecordID = CurrRecord.ID; filecontrol.TabIndex = index; index++; dockPanel1.Controls.Add(filecontrol); currentPosY += 20; } if (RecordWorkTask.HaveWorkFlowBackRole(WorkFlowData.Rows[0]["WorkTaskId"].ToString(), WorkFlowData.Rows[0]["WorkFlowId"].ToString())) { Button btn_Back = new Button(); dockPanel1.Controls.Add(btn_Back); btn_Back.Click += new EventHandler(btn_Back_Click); btn_Back.Location = new Point(currentPosX + 80, currentPosY + 10); btn_Back.Text = "退回"; btn_Back = new Button(); dockPanel1.Controls.Add(btn_Back); btn_Back.Click += new EventHandler(btn_Save_Click); btn_Back.Location = new Point(currentPosX + 80 + btn_Back.Width, currentPosY + 10); btn_Back.Text = "保存"; } else { Button btn_Back = new Button(); dockPanel1.Controls.Add(btn_Back); btn_Back.Click += new EventHandler(btn_Save_Click); btn_Back.Location = new Point(currentPosX + 80, currentPosY + 10); btn_Back.Text = "保存"; } } catch { } Button btn_Submit = new Button(); dockPanel1.Controls.Add(btn_Submit); btn_Submit.Location = new Point(currentPosX, currentPosY + 10); btn_Submit.Text = "提交"; btn_Submit.Click += new EventHandler(btn_Submit_Click); if (dockPanel1.ControlContainer.Controls.Count > 0) dockPanel1.ControlContainer.Controls[0].Focus(); }
private void frmLP_FormClosed(object sender, FormClosedEventArgs e) { try { //base.Close(); //rowData = null; if (dsoFramerWordControl1 != null) { dockPanel1.ControlContainer.Controls.Clear(); templeList.Clear(); //string strfilename = dsoFramerWordControl1.fileName; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); dsoFramerWordControl1.Dispose(); //SelectorHelper.Execute("del /f/s/q \"" + strfilename+"\"", 500); dsoFramerWordControl1 = null; currRecord = null; } if (filecontrol != null) { if (filecontrol.upThread != null && filecontrol.upThread.ThreadState == ThreadState.Running) { filecontrol.upThread.IsBackground = true; filecontrol.upThread.Abort(); } if (filecontrol.Isdownfile) { if (filecontrol.webClient != null) filecontrol.webClient.CancelAsync(); } } } catch { } }
public static IList GetTaskCtrlData2(LP_Record record, LP_Temple lp, string sqlSentence, WF_WorkTastTrans wtt) { //LP_Temple lp =null ; string ctrltype = ""; //if (lp.CtrlType.IndexOf(',') == -1) // ctrltype = lp.CtrlType; //else // ctrltype = lp.CtrlType.Substring(0, lp.CtrlType.IndexOf(',')); /* * * SELECT cellname, SqlSentence,SqlColName FROM LP_Temple where SqlSentence !='' * * */ IList li = new ArrayList(); if (sqlSentence.IndexOf("Excel:") == 0) { //int index1 = sqlSentence.LastIndexOf(":"); //string tablename = sqlSentence.Substring(6, index1 - 6); //string cellpos = sqlSentence.Substring(index1 + 1); //string[] arrCellPos = cellpos.Split('|'); //arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|'); //string strcellvalue = ""; //Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; //ExcelAccess ea = new ExcelAccess(); //ea.MyWorkBook = wb; //ea.MyExcel = wb.Application; //Excel.Worksheet sheet; //sheet = wb.Application.Sheets[tablename] as Excel.Worksheet; //for (int i = 0; i < arrCellPos.Length; i++) { // Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标 // strcellvalue += range.Value2; //} //li.Add(strcellvalue); } else if (sqlSentence != "") { if (sqlSentence.IndexOf("{recordparentid}") > -1) { sqlSentence = sqlSentence.Replace("{recordparentid}", record.ParentID); } if (sqlSentence.IndexOf("{recordid}") > -1) { sqlSentence = sqlSentence.Replace("{recordid}", record.ID); } if (sqlSentence.IndexOf("{orgcode}") > -1) { sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode); } if (sqlSentence.IndexOf("{userid}") > -1) { sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID); } if (sqlSentence.IndexOf("{orgname}") > -1) { sqlSentence = sqlSentence.Replace("{orgname}", MainHelper.User.OrgName); } if (sqlSentence.IndexOf("{username}") > -1) { sqlSentence = sqlSentence.Replace("{username}", MainHelper.User.UserName); } Regex r1 = new Regex(@"(?<={)[0-9]+(?=})"); while (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { //Control ct = FindCtrl(listLPID[0].LPID); //if (ct != null) { // if (ct is DateEdit) { // ((DateEdit)ct).Properties.EditMask = listLPID[0].WordCount; // ((DateEdit)ct).Properties.DisplayFormat.FormatString = listLPID[0].WordCount; // } // sqlSentence = sqlSentence.Replace("{" + sortid + "}", ct.Text); //} else { string strSQL = "select ControlValue from WF_TableFieldValueView where" + " UserControlId='" + listLPID[0].ParentID + "' " + "and FieldId='" + listLPID[0].LPID + "' and ID='" + record.ID + "'"; li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", strSQL); if (li.Count > 0) { sqlSentence = sqlSentence.Replace("{" + sortid + "}", li[0].ToString()); } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } //} } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } //r1 = new Regex(@"(?<={编号规则一:)[0-9]+(?=})"); //if (r1.Match(sqlSentence).Value != "") { // string sortid = r1.Match(sqlSentence).Value; // IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); // if (listLPID.Count > 0) { // Control ct = FindCtrl(listLPID[0].LPID); // if (ct != null) { // IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("SelectmOrgList", // "where OrgName='" + ct.Text + "'"); // if (list.Count > 0) // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", RecordWorkTask.CreatWorkFolwNo(list[0], listLPID[0].ParentID, "编号规则一")); // else // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", ""); // } else { // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); // } // } else { // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); // } //} try { sqlSentence = sqlSentence.Replace("\r\n", " "); if (sqlSentence.IndexOf("where 9=9") > -1) { string strtemp = li[0].ToString(); li.Clear(); r1 = new Regex(@"[0-9]+\+[0-9]+"); if (r1.Match(strtemp).Value != "") { int istart = 1; int ilen = 10; r1 = new Regex(@"[0-9]+(?=\+)"); if (r1.Match(strtemp).Value != "") { istart = Convert.ToInt32(r1.Match(strtemp).Value); } r1 = new Regex(@"(?<=\+)[0-9]+"); if (r1.Match(strtemp).Value != "") { ilen = Convert.ToInt32(r1.Match(strtemp).Value); ; } for (int i = istart; i <= ilen; i++) { li.Add(string.Format("{0}", i)); } } else { string[] strli = SelectorHelper.ToDBC(strtemp).Split(','); foreach (string ss in strli) { li.Add(ss); } } } else { IList ht = Client.ClientHelper.PlatformSqlMap.GetList("Select", sqlSentence); if (ht.Count > 0) { DataTable dt = ConvertHelper.ToDataTable(ht); li.Add(dt.Rows[0][0]); } } } catch (Exception ex) { li.Add("出错:" + ex.Message); } } return li; }
public static Dictionary<string, object> ReadTaskData(DataTable workflowdata, LP_Temple temp, LP_Record record) { Dictionary<string, object> dic = new Dictionary<string, object>(); IList<WF_WorkTastTrans> wttli = MainHelper.PlatformSqlMap.GetList<WF_WorkTastTrans>(" where WorkFlowId='" + workflowdata.Rows[0]["WorkFlowId"].ToString() + "' AND tlcjdid='" + workflowdata.Rows[0]["WorkTaskId"].ToString() + "' and tlcjdzdlx = '模块'"); foreach (WF_WorkTastTrans wtt in wttli) { IList list = GetTaskCtrlData2(record, temp, wtt.sSQL, wtt); if (list.Count > 0) dic.Add(wtt.tlcjdzdid, list[0]); } return dic; }
public static void ReadTaskData(object des, DataTable workflowdata, LP_Temple temp, LP_Record record) { Type t = des.GetType(); t.GetProperties(); Dictionary<string, object> dic = ReadTaskData(workflowdata, temp, record); string key = ""; Dictionary<Type, string> dictypename = new Dictionary<Type, string>(); foreach (var p in t.GetProperties()) { key = t.Name + " " + p.Name; if (dic.ContainsKey(key)) { if (p.PropertyType == dic[key].GetType()) p.SetValue(des, dic[key], null); else { object value = dic[key]; switch (p.PropertyType.Name) { case "DateTime": value = Convert.ToDateTime(value); break; case "Int32": case "Int64": value = Convert.ToInt32(value); break; case "Decimal": value = Convert.ToDecimal(value); break; case "Double": value = Convert.ToDouble(value); break; } try { p.SetValue(des, value, null); } catch { } } } } }
void gridViewOperation_AfterAdd(PJ_18gysbpjmx obj) { //RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by id desc"); RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); if (isWorkflowCall) { WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ModleRecordID = obj.PJ_ID; mrwt.RecordID = currRecord.ID; mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mrwt.ModleTableName = obj.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord); PJ_qxfl qxfj = new PJ_qxfl(); qxfj.CreateDate = PSObj.CreateDate; qxfj.CreateMan = PSObj.CreateMan; qxfj.LineID = ""; qxfj.LineName = ""; qxfj.OrgCode = PSObj.OrgCode; qxfj.OrgName = PSObj.OrgName; qxfj.qxlb = obj.qxlb; qxfj.qxly = "高压配电设备评级表"; qxfj.qxnr = obj.qxnr; qxfj.xcqx = ""; qxfj.xcr = ""; qxfj.xlqd = ""; qxfj.xsr = ""; qxfj.xssj = new DateTime(1900, 1, 1); MainHelper.PlatformSqlMap.Create<PJ_qxfl>(qxfj); LP_Record lpr = new LP_Record(); lpr.ID = "N" + lpr.CreateID(); lpr.Kind = "设备缺陷管理流程"; lpr.CreateTime = DateTime.Now.ToString(); lpr.OrgName = qxfj.OrgName; string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, "设备缺陷管理流程", MainHelper.User.UserID, false); if (strtemp[0].IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } DataTable recordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID); if (recordWorkFlowData == null) { MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!"); } LP_Temple ParentTemple = RecordWorkTask.GetWorkTaskTemple(recordWorkFlowData, lpr); if (ParentTemple == null) lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, "设备缺陷管理流程"); else lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, ParentTemple.LPID); lpr.Status = recordWorkFlowData.Rows[0]["TaskCaption"].ToString(); MainHelper.PlatformSqlMap.Create<LP_Record>(lpr); currRecord = lpr; WorkFlowData = recordWorkFlowData; Thread.Sleep(new TimeSpan(100000));//0.1毫秒 mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ID = mrwt.CreateID(); mrwt.ModleRecordID = qxfj.ID; mrwt.RecordID = currRecord.ID; mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mrwt.ModleTableName = qxfj.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); } }
public void InitCtrlData2(RepositoryItemCheckedComboBoxEdit combox, int index, LP_Temple lp, string sqlSentence, DSOFramerControl dsoFramerWordControl1, LP_Record currRecord) { string ctrltype = ""; if (lp.CtrlType.IndexOf(',') == -1) ctrltype = lp.CtrlType; else ctrltype = lp.CtrlType.Substring(0, lp.CtrlType.IndexOf(',')); /* * * SELECT cellname, SqlSentence,SqlColName FROM LP_Temple where SqlSentence !='' * * */ IList li = new ArrayList(); if (sqlSentence.IndexOf("Excel:") == 0) { int index1 = sqlSentence.LastIndexOf(":"); string tablename = sqlSentence.Substring(6, index1 - 6); string cellpos = sqlSentence.Substring(index1 + 1); string[] arrCellPos = cellpos.Split('|'); arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|'); string strcellvalue = ""; Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; ExcelAccess ea = new ExcelAccess(); ea.MyWorkBook = wb; ea.MyExcel = wb.Application; Excel.Worksheet sheet; sheet = wb.Application.Sheets[tablename] as Excel.Worksheet; for (int i = 0; i < arrCellPos.Length; i++) { Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标 strcellvalue += range.Value2; } li.Add(strcellvalue); } else if (sqlSentence != "") { if (sqlSentence.IndexOf("{recordid}") > -1) { sqlSentence = sqlSentence.Replace("{recordid}", currRecord.ID); } if (sqlSentence.IndexOf("{orgcode}") > -1) { sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode); } if (sqlSentence.IndexOf("{userid}") > -1) { sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID); } Regex r1 = new Regex(@"(?<={)[0-9]+(?=})"); while (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { string strSQL = "select ControlValue from WF_TableFieldValueView where" + " UserControlId='" + listLPID[0].ParentID + "' " + "and FieldId='" + listLPID[0].LPID + "' and ID='" + currRecord.ID + "'"; li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", strSQL); if (li.Count > 0) { sqlSentence = sqlSentence.Replace("{" + sortid + "}", li[0].ToString()); } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } r1 = new Regex(@"(?<={编号规则一:)[0-9]+(?=})"); if (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); } else { sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); } } sqlSentence = sqlSentence.Replace("\r\n", ""); try { li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", sqlSentence); } catch (Exception ex) { li.Add(sqlSentence + "出错:" + ex.Message); } if (sqlSentence.IndexOf("where 9=9") == -1) { foreach (string strname in li) { combox.Items.Add(strname); } } else { switch (li[0].ToString()) { case "{年}": combox.Items.Clear(); for (int j = 0; j <= 20; j++) { combox.Items.Add(string.Format("{0}", j + DateTime.Now.Year)); } break; case "{月}": combox.Items.Clear(); for (int j = 1; j <= 12; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{日}": combox.Items.Clear(); for (int j = 1; j <= 31; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{时}": combox.Items.Clear(); for (int j = 1; j <= 24; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{分}": case "{秒}": combox.Items.Clear(); for (int j = 0; j <= 59; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; default: string strexpress = li[0].ToString(); r1 = new Regex(@"[0-9]+\+[0-9]+"); if (r1.Match(strexpress).Value != "") { int istart = 1; int ilen = 10; r1 = new Regex(@"[0-9]+(?=\+)"); if (r1.Match(strexpress).Value != "") { istart = Convert.ToInt32(r1.Match(strexpress).Value); } r1 = new Regex(@"(?<=\+)[0-9]+"); if (r1.Match(strexpress).Value != "") { ilen = Convert.ToInt32(r1.Match(strexpress).Value); ; } for (int i = istart; i <= ilen; i++) { combox.Items.Add(string.Format("{0}", i)); } } else { string[] strItem = SelectorHelper.ToDBC(strexpress).Split(','); for (int i = 0; i < strItem.Length; i++) { combox.Items.Add(strItem[i]); } } break; } } } }
private void btAddfrm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MainHelper.UserOrg == null) return; if (!RecordWorkTask.HaveRunNewGZPRole(ParentObj.Kind, MainHelper.User.UserID)) return; frmLP frm = new frmLP(); LP_Record lpr = new LP_Record(); frm.Status = "add"; frm.Kind = ParentObj.Kind; frm.ParentTemple = ParentObj; lpr.Status = RecordWorkTask.GetGZPRecordSartStatus(ParentObj.Kind, MainHelper.User.UserID); //lpr.Status = "填票"; //frm.RowData = lpr; frm.CurrRecord = lpr; if (frm.ShowDialog() == DialogResult.OK) { InitData(ParentObj.Kind); } }
public static void ExportExcelWorkFlow(ref LP_Record currRecord, PJ_03yxfx obj) { DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl(); string fname = Application.StartupPath + "\\00记录模板\\03运行分析记录.xls"; dsoFramerWordControl1.FileOpen(fname); if (currRecord == null) { currRecord = new LP_Record(); currRecord.Status = "文档生成"; } currRecord.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); dsoFramerWordControl1.FileDataGzip = currRecord.DocContent; ExcelAccess ex = new ExcelAccess(); Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; ex.MyWorkBook = wb; ex.MyExcel = wb.Application; //与会人员之间的间隔符号 string jksign = "@"; int row = 1; int col = 1; //每行显示文字长度 int zc = 60; //获得创建的工作表个数 // int pagemax = 1; string zt = Ecommon.Comparestring(obj.zt, "主题") ? "" : "主题:"; List<string> listztstring = Ecommon.ResultStrList(zt + obj.zt, zc); Ecommon.Resultstrbystartbd(ref listztstring); //if (pagemax < Ecommon.GetPagecount(listztstring.Count,2)) //{ // pagemax = Ecommon.GetPagecount(listztstring.Count, 2); //} string jy = Ecommon.Comparestring(obj.jy, "纪要") ? "" : "纪要:"; List<string> listjy = Ecommon.ResultStrList(jy + obj.jy, zc); Ecommon.Resultstrbystartbd(ref listjy); //if (pagemax < Ecommon.GetPagecount(listjy.Count, 7)) //{ // pagemax = Ecommon.GetPagecount(listjy.Count, 7); //} string jr = Ecommon.Comparestring(obj.jr, "结论及对策") ? "" : "结论及对策:"; List<string> listjldc = Ecommon.ResultStrList(jr + obj.jr, zc); Ecommon.Resultstrbystartbd(ref listjldc); //if (pagemax < Ecommon.GetPagecount(listjldc.Count, 6)) //{ // pagemax = Ecommon.GetPagecount(listjldc.Count, 6); //} List<string> listpy = Ecommon.ResultStrList("领导检查评语:" + obj.py, zc); Ecommon.Resultstrbystartbd(ref listpy); int[] strnumcol = { 0, listztstring.Count, listztstring.Count + listjy.Count, listztstring.Count + listjy.Count + listjldc.Count }; int[] statnum = { 3, 3, 6,7 }; List<string> strcol = new List<string>(); Ecommon.addstring(listztstring, ref strcol); Ecommon.addstring(listjy, ref strcol); Ecommon.addstring(listjldc, ref strcol); Ecommon.addstring(listpy, ref strcol); //Ecommon.CreatandWritesheet(ex, strcol, 15, 9, 1); Ecommon.CreatandWritesheet1(ex, strcol, 15, 9, 1, strnumcol, statnum); //进行加粗 ex.ActiveSheet(1); //时间 ex.SetCellValue(obj.rq.Year.ToString(), 4, 5); ex.SetCellValue(obj.rq.Month.ToString(), 4, 7); ex.SetCellValue(obj.rq.Day.ToString(), 4, 9); ////出席人员 string[] ary = obj.cjry.Split(';'); int n = ary.Length % 5; for (int i = 0; i < ary.Length; i++) { int tempcol = col + 1 + i % 5; if (i % 5 == 1 || i % 5 == 2 || i % 5 == 3) { tempcol = col + 1 + i % 5 + 1; } if (i % 5 == 4) { tempcol = col + 1 + i % 5 + 2; } ex.SetCellValue(ary[i], row + 4 + i / 5, tempcol); } //主持人 ex.SetCellValue(obj.zcr, 5, 11); //检查人签字 //ex.CopySheet(1, 2); //ex.ActiveSheet(2); //ex.SetCellValue("kakaka", 24, 4); //ex.ActiveSheet(1); ex.SetCellValue(obj.qz, 24, 4); //签字时间 // if (ComboBoxHelper.CompreDate(obj.qzrq)) // { // ex.SetCellValue(obj.qzrq.Year.ToString(), 24, 5); // ex.SetCellValue(obj.qzrq.Month.ToString(), 24, 9); // ex.SetCellValue(obj.qzrq.Day.ToString(), 24, 11); // } //将固定的写完再创建不固定的。 //添加变动内容 //for (int j = 1; j <= pagemax;j++ ) //{ // if (j>1) // { // ex.CopySheet(1, 1); // } //} //ex.ShowExcel(); //for (int j = 1; j <= pagemax;j++ ) //{ // ex.ActiveSheet(j); // //if (j>1) // //{ // // // ex.CopySheet(1, j); // // ex.ActiveSheet(j); // //} // //ex.ShowExcel(); // int prepageindex = j - 1; // //主题 // int starow = prepageindex * 2 + 1; // int endrow = j * 2; // if (listztstring.Count>endrow) // { // for (int i = 0; i < 2;i++ ) // { // ex.SetCellValue(listztstring[starow - 1 + i], 9 + i, 1); // } // } // else if (listztstring.Count<=endrow&&listztstring.Count>=starow) // { // for (int i = 0; i < listztstring.Count - starow + 1;i++ ) // { // ex.SetCellValue(listztstring[starow - 1 + i], 9 + i, 1); // } // } // //纪要 // starow = prepageindex * 7 + 1; // endrow = j * 7; // if (listjy.Count > endrow) // { // for (int i = 0; i < 7; i++) // { // ex.SetCellValue(listjy[starow - 1 + i], 11 + i, 1); // } // } // else if (listjy.Count <= endrow && listjy.Count >= starow) // { // for (int i = 0; i < listjy.Count - starow + 1; i++) // { // ex.SetCellValue(listjy[starow - 1 + i], 11+ i, 1); // } // } // //结论及对策 // starow = prepageindex * 6 + 1; // endrow = j * 6; // if (listjldc.Count > endrow) // { // for (int i = 0; i < 6; i++) // { // ex.SetCellValue(listjldc[starow - 1 + i], 18 + i, 1); // } // } // else if (listjldc.Count <= endrow && listjldc.Count >= starow) // { // for (int i = 0; i < listjldc.Count - starow + 1; i++) // { // ex.SetCellValue(listjldc[starow - 1 + i], 18 + i, 1); // } // } //} ////主题: //ex.SetCellValue("主题: " + obj.zt, 9, 1); ////纪要 //string jystr = "纪要:" + obj.jy; //for (int i = 0; i < 7; i++) //{ // string tempstr = ""; // int startnum = i * zc; // int endnum = (i + 1) * zc; // bool ISempty=false; // if (startnum>=jystr.Length) // { // ISempty=true; // } // else if (endnum >= jystr.Length) // { // endnum = jystr.Length; // } // if (!ISempty) // { // tempstr = jystr.Substring(startnum,endnum-startnum); // } // ex.SetCellValue(tempstr, 11 + i, 1); //} ////结论及对策: //string jlstr = "结论及对策:" + obj.jr; //for (int j = 0; j < 6; j++) //{ // string tempstr = ""; // int startnum = j * zc; // int endnum = (j + 1) * zc; // bool ISempty = false; // if (startnum >= jlstr.Length) // { // ISempty = true; // } // else if (endnum >= jlstr.Length) // { // endnum = jlstr.Length; // } // if (!ISempty) // { // tempstr = jlstr.Substring(startnum, endnum - startnum); // } // ex.SetCellValue(tempstr, 18 + j, 1); //} //ex.CopySheet(1,2); //ex.CopySheet(1, 3); //ex.CopySheet(2, 4); if (currRecord == null) { currRecord = new LP_Record(); currRecord.Status = "文档生成"; } dsoFramerWordControl1.FileSave(); currRecord.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); }
private void btEditfrm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle<0) { return; } frmLP frm = new frmLP(); frm.Status = "edit"; frm.ParentTemple = ParentObj; frm.Kind = ParentObj.Kind; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); LP_Record currRecord = new LP_Record(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } frm.CurrRecord = currRecord; if (currRecord.ID.IndexOf("N") > -1) { MsgBox.ShowWarningMessageBox("此记录由新模块创建,请使用新模块操作!"); return; } if (!RecordWorkTask.HaveRunRecordRole(currRecord.ID, MainHelper.User.UserID)) return; DataTable dt = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID); frm.RecordWorkFlowData = dt; if (frm.ShowDialog() == DialogResult.OK) { InitData(ParentObj.Kind); } }
private void btAddfrm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MainHelper.UserOrg == null) return; if (!RecordWorkTask.HaveRunNewGZPRole(strKind, MainHelper.User.UserID)) return; object obj = RecordWorkTask.GetNewWorkTaskModle(strKind, MainHelper.User.UserID); if (obj == null) { MsgBox.ShowWarningMessageBox("出错,未找到对应的模块,请检查模板设置!"); return; } LP_Record lpr = new LP_Record(); lpr.ID = "N" + lpr.CreateID(); lpr.Kind = strKind; lpr.CreateTime = DateTime.Now.ToString(); if (obj is frmLP) { frmLP frm = new frmLP(); frm.Status = "add"; frm.Kind = strKind; string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, strKind, MainHelper.User.UserID, false); //frm.ParentTemple = RecordWorkTask.GetNewWorkTaskTemple(strKind, MainHelper.User.UserID); //frm.RecordWorkFlowData = RecordWorkTask.GetGZPRecordSartWorkData(ParentObj.FlowCaption, MainHelper.User.UserID); frm.RecordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID); if (frm.RecordWorkFlowData == null) { MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!"); } frm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(frm.RecordWorkFlowData, lpr); if (frm.ParentTemple == null) { MsgBox.ShowWarningMessageBox("出错,未找到该节点关联的表单,请检查模板设置!"); } lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, frm.ParentTemple.LPID); lpr.Status = frm.RecordWorkFlowData.Rows[0]["TaskCaption"].ToString(); //lpr.Status = "填票"; //frm.RowData = lpr; frm.CurrRecord = lpr; MainHelper.PlatformSqlMap.Create<LP_Record>(lpr); if (frm.ShowDialog() == DialogResult.OK) { InitData(strSQL); } } else { string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, strKind, MainHelper.User.UserID, false); if (strtemp[0].IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } DataTable recordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID); if (recordWorkFlowData == null) { MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!"); } lpr.Status = recordWorkFlowData.Rows[0]["TaskCaption"].ToString(); MainHelper.PlatformSqlMap.Create<LP_Record>(lpr); if (obj.GetType().GetProperty("IsWorkflowCall") != null) obj.GetType().GetProperty("IsWorkflowCall").SetValue(obj, true, null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj.GetType().GetProperty("CurrRecord") != null) obj.GetType().GetProperty("CurrRecord").SetValue(obj, lpr, null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj.GetType().GetProperty("RecordWorkFlowData") != null) obj.GetType().GetProperty("RecordWorkFlowData").SetValue(obj, recordWorkFlowData, null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj.GetType().GetProperty("ParentTemple") != null) obj.GetType().GetProperty("ParentTemple").SetValue(obj, RecordWorkTask.GetWorkTaskTemple(recordWorkFlowData, lpr), null); else { MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!"); return; } if (obj is UserControl) { FormBase dlg = new FormBase(); dlg.Text = ((UserControl)obj).Name; dlg.MdiParent = MainHelper.MainForm; dlg.Controls.Add((UserControl)obj); ((UserControl)obj).Dock = DockStyle.Fill; dlg.Show(); } else if (obj is Form) { if (obj is frmyxfxWorkFlowEdit) { PJ_03yxfx yxfx = new PJ_03yxfx(); yxfx.OrgCode = MainHelper.UserOrg.OrgCode; yxfx.OrgName = MainHelper.UserOrg.OrgName; if (parentObj.FlowCaption.IndexOf("定期分析") > 0) yxfx.type = "定期分析"; else if (parentObj.FlowCaption.IndexOf("专题分析") > 0) yxfx.type = "专题分析"; ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0; yxfx.rq = DateTime.Now; ((frmyxfxWorkFlowEdit)obj).RowData = yxfx; } else if (obj is frmsbqxWorkFlowEdit) { PJ_qxfl qxfl = new PJ_qxfl(); qxfl.OrgCode = MainHelper.UserOrg.OrgCode; qxfl.OrgName = MainHelper.UserOrg.OrgName; ((frmsbqxWorkFlowEdit)obj).RowData = qxfl; } ((Form)obj).ShowDialog(); } InitData(strSQL); } //获得编辑按钮的状态 this.btEditfrm.Caption = lpr.Status; }
private void barReExport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); LP_Record currRecord = new LP_Record(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } if (currRecord.ID.IndexOf("N") > -1) { MsgBox.ShowTipMessageBox("此记录由新模块创建,请使用新模块操作!"); return; } if (currRecord.Status != "存档") { MsgBox.ShowTipMessageBox("安监未审核,不能导出!"); return; } SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = ""; saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { fname = saveFileDialog1.FileName; try { DSOFramerControl ds1 = new DSOFramerControl(); ds1.FileDataGzip = currRecord.DocContent ; //ds1.FileOpen(ds1.FileName); ds1.FileSave(fname,true); ds1.FileClose(); ExcelAccess ea = new ExcelAccess(); ea.Open(fname); char pchar = '|'; Excel.Workbook wb = ds1.AxFramerControl.ActiveDocument as Excel.Workbook; Excel.Worksheet xx = wb.Application.Sheets[1] as Excel.Worksheet; IList<LP_Temple> templeList = MainHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", "where ParentID ='" + ParentObj.LPID + "' and isExplorer='1' Order by SortID"); LockExcel(ea); unLockExcel(ea); foreach (LP_Temple lp in templeList) { string[] arrCellpos = lp.CellPos.Split(pchar); for (int i = 0; i < arrCellpos.Length && arrCellpos[i] != ""; i++) { ea.SetCellValue("", GetCellPos(arrCellpos[i])[0], GetCellPos(arrCellpos[i])[1]); } } ea.ShowExcel(); ds1.FileClose(); ds1.Dispose (); } catch(Exception ex) { Console.WriteLine(ex.Message ); MsgBox.ShowWarningMessageBox ("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。"); return; } } }
private void barBack_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); //请求确认 if (MsgBox.ShowAskMessageBox("是否确认退回 【" + dr["Number"].ToString() + "】?") != DialogResult.OK) { return; } LP_Record currRecord = new LP_Record(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } DataTable dt = RecordWorkTask.GetRecordWorkFlowData(dr["ID"].ToString(), MainHelper.User.UserID); if (dt.Rows.Count > 0) { if (!RecordWorkTask.HaveWorkFlowBackRole(dt.Rows[0]["WorkTaskId"].ToString(), dt.Rows[0]["WorkFlowId"].ToString())) { MsgBox.ShowWarningMessageBox("当前节点不能退回.设置里没有允许退回,退回失败!"); return; } if (RecordWorkTask.CheckOnRiZhi(dt)) { RecordWorkTask.CreatRiZhi(dt, null, currRecord.ID, new object[] { currRecord }); } string strmes = RecordWorkTask.RunWorkFlowBack(MainHelper.User.UserID, dt.Rows[0]["OperatorInsId"].ToString(), dt.Rows[0]["WorkTaskInsId"].ToString()); if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else { currRecord.LastChangeTime = DateTime.Now.ToString(); currRecord.Status = RecordWorkTask.GetWorkFlowTaskCaption(dt.Rows[0]["WorkTaskInsId"].ToString()); if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; MainHelper.PlatformSqlMap.Update("UpdateLP_Record", currRecord); InitData(strSQL); MsgBox.ShowTipMessageBox(strmes); } this.btEditfrm.Caption = currRecord.Status; } else { MsgBox.ShowTipMessageBox("无当前用户可以操作此记录的流程信息,退回失败!"); } }
private void barView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; frmTemplate fm = new frmTemplate(); LP_Record currRecord = new LP_Record(); DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); DataTable dt = RecordWorkTask.GetRecordWorkFlowData2(dr["ID"].ToString()); fm.RecordWorkFlowData = dt; foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } fm.ParentTemple = ParentObj; fm.pjobject = currRecord; fm.ShowDialog(); InitData(parentObj.Kind); }
private void barReExport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); LP_Record currRecord = new LP_Record(); int i = 0; //string exploreKind = ""; foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } DataTable dt = RecordWorkTask.GetRecordWorkFlowData(dr["ID"].ToString(), MainHelper.User.UserID); IList<WFP_RecordWorkTaskIns> wf = MainHelper.PlatformSqlMap.GetList<WFP_RecordWorkTaskIns>("SelectWFP_RecordWorkTaskInsList", "where RecordID='" + currRecord.ID + "'"); if (currRecord.Status != "存档") { if (dt.Rows.Count > 0) { if (!RecordWorkTask.HaveWorkFlowAllExploreRole(dt.Rows[0]["WorkTaskId"].ToString(), dt.Rows[0]["WorkFlowId"].ToString())) { if (!RecordWorkTask.HaveRunRecordRole(currRecord.ID, MainHelper.User.UserID)) { MsgBox.ShowWarningMessageBox("没有运行权限,导出失败!"); return; } if (!RecordWorkTask.HaveWorkFlowExploreRole(dt.Rows[0]["WorkTaskId"].ToString(), dt.Rows[0]["WorkFlowId"].ToString())) { MsgBox.ShowWarningMessageBox("没有导出权限,导出失败!"); return; } } } else { MsgBox.ShowTipMessageBox("无当前用户可以操作此记录的流程信息,导出失败!"); return; } }//流程没结束 else if (!RecordWorkTask.HaveFlowEndExploreRole(currRecord.Kind)) { MsgBox.ShowTipMessageBox("流程结束后不允许导出,导出失败!"); return; }//流程结束 if (currRecord.ID.IndexOf("N") == -1 || parentObj.FlowCaption.IndexOf("定期分析") > -1 || parentObj.FlowCaption.IndexOf("专题分析") > -1) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = ""; saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { fname = saveFileDialog1.FileName; try { DSOFramerControl ds1 = new DSOFramerControl(); ds1.FileDataGzip = currRecord.DocContent; ds1.FileSave(fname, true); ds1.FileClose(); if (MsgBox.ShowAskMessageBox("导出成功,是否打开该文档?") != DialogResult.OK) return; System.Diagnostics.Process.Start(fname); } catch (Exception ex) { Console.WriteLine(ex.Message); MsgBox.ShowWarningMessageBox("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。"); } } return; }//是旧记录 Hashtable templehs = RecordWorkTask.GetExploerLP_TempleList(dt, currRecord); if (templehs.Count > 1) { DataTable templedt = new DataTable(); templedt.Columns.Add("Checked", typeof(bool)); templedt.Columns.Add("Index", typeof(string)); templedt.Columns.Add("Name", typeof(string)); ArrayList akeys = new ArrayList(templehs.Keys); for (i = 0; i < akeys.Count; i++) { object obj = akeys[i]; DataRow templedr = templedt.NewRow(); if (obj is LP_Temple) { WF_WorkTask wt = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkTask>(templehs[akeys[i]]); if (wt != null) { templedr["Name"] = wt.TaskCaption + "-申报表单"; templedr["Checked"] = 1; templedr["Index"] = i; templedt.Rows.Add(templedr); } } else if (obj is string) { LP_Temple taskTemple = MainHelper.PlatformSqlMap.GetOneByKey<LP_Temple>(templehs[akeys[i]]); if (taskTemple != null) { templedr["Name"] = taskTemple.CellName; templedr["Checked"] = 1; templedr["Index"] = i; templedt.Rows.Add(templedr); } } } frmExploreSelect frmes = new frmExploreSelect(); frmes.SourceDt = templedt; if (frmes.ShowDialog() == DialogResult.OK && frmes.CheckIndehs.Count > 0) { string fname = ""; FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { fname = fbd.SelectedPath + "\\"; ArrayList checkkeys = new ArrayList(frmes.CheckIndehs.Keys); for (i = 0; i < checkkeys.Count; i++) { object obj = akeys[Convert.ToInt32(checkkeys[i])]; DSOFramerControl ds1 = new DSOFramerControl(); try { if (obj is LP_Temple) { ds1.FileDataGzip = ((LP_Temple)obj).DocContent; //ds1.FileOpen(ds1.FileName); ds1.FileSave(CheckFileName(fname + frmes.CheckIndehs[checkkeys[i]]), true); ds1.FileClose(); } else if (obj is string) { LP_Temple taskTemple = MainHelper.PlatformSqlMap.GetOneByKey<LP_Temple>(templehs[akeys[i]]); if (taskTemple != null) { RecordWorkTask.iniTableRecordData(ref taskTemple, currRecord, wf[0].WorkFlowId, wf[0].WorkFlowInsId, true); ds1.FileDataGzip = taskTemple.DocContent; //ds1.FileOpen(ds1.FileName); ds1.FileSave(CheckFileName(fname + taskTemple.CellName), true); ds1.FileClose(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); MsgBox.ShowWarningMessageBox("无法保存" + frmes.CheckIndehs[checkkeys[i]] + "。请用其他文件名保存文件,或将文件存至其他位置。"); } }//循环所有选择的表单 if (MsgBox.ShowAskMessageBox("导出成功,是否所在文件夹?") != DialogResult.OK) return; System.Diagnostics.Process.Start(fname); } } }//表单不止一个 else { ArrayList akeys = new ArrayList(templehs.Keys); SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = ""; saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { fname = saveFileDialog1.FileName; try { DSOFramerControl ds1 = new DSOFramerControl(); if (akeys[0] is LP_Temple) { ds1.FileDataGzip = ((LP_Temple)akeys[0]).DocContent; ds1.FileSave(fname, true); ds1.FileClose(); } else if (akeys[0] is string) { LP_Temple taskTemple = MainHelper.PlatformSqlMap.GetOneByKey<LP_Temple>(akeys[0]); if (taskTemple != null) { WF_WorkTaskControls wtc = MainHelper.PlatformSqlMap.GetOne<WF_WorkTaskControls>(" where WorkflowId='" + wf[0].WorkFlowId + "' and WorktaskId='" + wf[0].WorkTaskId + "'"); if (wtc != null) { } RecordWorkTask.iniTableRecordData(ref taskTemple, currRecord, wf[0].WorkFlowId, wf[0].WorkFlowInsId, true); ds1.FileDataGzip = taskTemple.DocContent; ds1.FileSave(fname, true); ds1.FileClose(); } } if (MsgBox.ShowAskMessageBox("导出成功,是否打开该文档?") != DialogResult.OK) return; System.Diagnostics.Process.Start(fname); } catch (Exception ex) { Console.WriteLine(ex.Message); MsgBox.ShowWarningMessageBox("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。"); return; } } } }
private void frmLP_FormClosed(object sender, FormClosedEventArgs e) { try { //base.Close(); currRecord = null; //rowData = null; dockPanel1.ControlContainer.Controls.Clear(); templeList.Clear(); if (filecontrol != null) { if (filecontrol.upThread != null && filecontrol.upThread.ThreadState == ThreadState.Running) { filecontrol.upThread.IsBackground = true; filecontrol.upThread.Abort(); } if (filecontrol.Isdownfile) { if (filecontrol.webClient!=null) filecontrol.webClient.CancelAsync(); } } } catch { } }
void gridViewOperation_AfterAdd(LP_Record obj) { }
public void InitContorl() { int MaxWordWidth = CalcWidth(); int currentPosY = 10; int currentPosX = 10; int index = 0; if (MaxWordWidth < 300) { MaxWordWidth = 300; } if (parentTemple != null && templeList!=null) { foreach (LP_Temple lp in templeList) { bool flag;//= (lp.Status == CurrRecord.Status); flag = true; Label label = new Label(); label.Text = lp.CellName; //string[] location = lp.CtrlLocation.Split(','); string[] size = lp.CtrlSize.Split(','); label.Location = new Point(currentPosX, currentPosY); label.Size = new Size(MaxWordWidth, 14); label.Visible = flag; if (flag) { currentPosY += 20; } Control ctrl; if (lp.CtrlType.Contains("uc_gridcontrol")) { ctrl = new uc_gridcontrol(); ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged); } else ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType)); ctrl.Location = new Point(currentPosX, currentPosY); ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1])); if (flag) { currentPosY += int.Parse(size[1]) + 10; } ctrl.TextChanged += new EventHandler(ctrl_Leave); ctrl.Enter += new EventHandler(ctrl_Enter); ctrl.Leave += new EventHandler(ctrl_Leave); ctrl.Visible = flag; ctrl.Tag = lp; ctrl.TabIndex = index; if (lp.CtrlType.Contains("uc_gridcontrol")) { (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar),lp); } index++; ctrl.Name = lp.LPID; dockPanel1.Controls.Add(label); dockPanel1.Controls.Add(ctrl); if (lp.CellName == "编号") { ctrlNumber = ctrl; } } } //InitEvent(); InitData(); if (RecordWorkTask.HaveRunSPYJRole(kind)) { if (hqyjcontrol == null) hqyjcontrol = new SPYJControl(); hqyjcontrol.Size = new System.Drawing.Size(400, 200); hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10); currentPosY = currentPosY + hqyjcontrol.Size.Height; hqyjcontrol.RecordID = CurrRecord.ID; dockPanel1.Controls.Add(hqyjcontrol); } if (RecordWorkTask.HaveRunFuJianRole(kind)) { if (filecontrol==null) filecontrol = new DownFileControl(); if(status=="add") filecontrol.FormType = "上传"; else if (status == "edit") { filecontrol.FormType = "下载"; } filecontrol.Size = new System.Drawing.Size(400, 200); filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10); currentPosY = currentPosY + filecontrol.Size.Height; filecontrol.UpfilePath = GetWorkFlowNmae(kind); if (currRecord==null) { currRecord = new LP_Record(); } filecontrol.RecordID = CurrRecord.ID; dockPanel1.Controls.Add(filecontrol); currentPosY += 20; } if (currRecord.Status!="存档"||(WorkFlowData!=null&& RecordWorkTask.HaveWorkFlowBackRole(WorkFlowData.Rows[0]["WorkTaskId"].ToString(), WorkFlowData.Rows[0]["WorkFlowId"].ToString()))) { Button btn_Back = new Button(); dockPanel1.Controls.Add(btn_Back); btn_Back.Click += new EventHandler(btn_Back_Click); btn_Back.Location = new Point(currentPosX + 80, currentPosY + 10); btn_Back.Text = "退回"; } Button btn_Submit = new Button(); dockPanel1.Controls.Add(btn_Submit); btn_Submit.Location = new Point(currentPosX, currentPosY + 10); btn_Submit.Text = "关闭"; btn_Submit.Click += new EventHandler(btn_Close); if (dockPanel1.ControlContainer.Controls.Count > 0) dockPanel1.ControlContainer.Controls[0].Focus(); }
private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e) { int ihand = gridView1.FocusedRowHandle; if (ihand < 0) return; PJ_tbsj currRecord = gridView1.GetFocusedRow() as PJ_tbsj; currRecord = MainHelper.PlatformSqlMap.GetOneByKey<PJ_tbsj>(currRecord.ID); if (currRecord != null) { string tempPath = Path.GetTempPath(); string tempfile = tempPath + "~" + Guid.NewGuid().ToString() + currRecord.S1; FileStream fs; fs = new FileStream(tempfile, FileMode.Create, FileAccess.Write); BinaryWriter bw = new BinaryWriter(fs); if (currRecord.picImage == null) currRecord.picImage = new byte[0]; bw.Write(currRecord.picImage); bw.Flush(); bw.Close(); fs.Close(); SelectorHelper.Execute("rundll32.exe %Systemroot%\\System32\\shimgvw.dll,ImageView_Fullscreen " + tempfile); } }
void btn_Submit_Click(object sender, EventArgs e) { Excel.Workbook wb; Excel.Worksheet sheet; wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; if (activeSheetName != "") { sheet = wb.Application.Sheets[activeSheetName] as Excel.Worksheet; } else { sheet = wb.Application.Sheets[1] as Excel.Worksheet; } activeSheetIndex = sheet.Index; if (filecontrol != null) { if (filecontrol.Isupfile) { MsgBox.ShowTipMessageBox("请稍后,正在上传文件"); return; } if (filecontrol.Isdownfile) { if (MsgBox.ShowAskMessageBox("正在下载文件,确认提交?") != DialogResult.OK) { return; } } } for (int i = 1; i <= wb.Application.Sheets.Count; i++) { if (i != activeSheetIndex) { Excel.Worksheet tmpSheet = (Excel.Worksheet)wb.Application.Sheets.get_Item(i); try { if (tmpSheet != null) tmpSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible ; } catch { } } } unLockExcel(wb,sheet); for (int i = 1; sheet.Protection.AllowEditRanges.Count > 0; ) { Excel.AllowEditRange editRange = sheet.Protection.AllowEditRanges.get_Item(i); editRange.Delete(); } LockExcel(wb, sheet); byte[] bt = new byte[0]; string strmes = ""; WF_WorkTaskCommands wt; switch (status) { case "add": //LP_Record newRecord = new LP_Record(); dsoFramerWordControl1.FileSave(); currRecord.DocContent = dsoFramerWordControl1.FileDataGzip; currRecord.Kind = kind; currRecord.Content = GetContent(); if (ctrlNumber!=null) currRecord.Number = ctrlNumber.Text; //currRecord.ImageAttachment = bt; //currRecord.SignImg = bt; currRecord.LastChangeTime= DateTime.Now.ToString(); //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID); wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"); if (wt != null) { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName); } else { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交"); } //strmes = strtemp[0]; //currRecord.Status = strtemp[1]; if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else MsgBox.ShowTipMessageBox(strmes); strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString()); if (strmes == "结束节点1") { currRecord.Status = "存档"; } else { currRecord.Status = strmes; } currRecord.LastChangeTime = DateTime.Now.ToString(); if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; MainHelper.PlatformSqlMap.Update("UpdateLP_Record", currRecord); rowData = null; if (hqyjcontrol != null) { PJ_lcspyj lcyj = new PJ_lcspyj(); lcyj.Charman = MainHelper.User.UserName; lcyj.ID = PJ_lcspyj.Newid(); lcyj.RecordID = currRecord.ID; lcyj.taskID = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); lcyj.Spyj = hqyjcontrol.nowMemoEdit.Text; lcyj.Creattime = DateTime.Now; if (hqyjcontrol.nowMemoEdit.Text != "") MainHelper.PlatformSqlMap.Create<PJ_lcspyj>(lcyj); } if (filecontrol != null) { for (int i = 0; i < filecontrol.FJtable.Rows.Count; i++) { PJ_lcfj lcfu = new PJ_lcfj(); lcfu.ID = lcfu.CreateID(); lcfu.Filename = Path.GetFileName(filecontrol.FJtable.Rows[i]["FilePath"].ToString()); lcfu.FileRelativePath = filecontrol.FJtable.Rows[i]["SaveFileName"].ToString(); lcfu.FileSize = Convert.ToInt64(filecontrol.FJtable.Rows[i]["FileSize"]); lcfu.RecordID = currRecord.ID; lcfu.Creattime = DateTime.Now; Thread.Sleep((new TimeSpan(100000)));//0.1毫秒 if (filecontrol.FJtable.Rows[i]["Kind"].ToString() != "已上传") MainHelper.PlatformSqlMap.Create<PJ_lcfj>(lcfu); } } //currRecord = newRecord; break; case "edit": currRecord.LastChangeTime = DateTime.Now.ToString(); dsoFramerWordControl1.FileSave(); currRecord.DocContent = this.dsoFramerWordControl1.FileDataGzip; //byte[] bt = new byte[0]; //currRecord.ImageAttachment = bt; //currRecord.SignImg = bt; currRecord.Content = GetContent(); wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"); if (wt != null) { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName); } else { strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交"); } if (strmes.IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } else MsgBox.ShowTipMessageBox(strmes); strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString()); if (strmes == "结束节点1") { CurrRecord.Status = "存档"; } else { CurrRecord.Status = strmes; } if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0]; if (currRecord.SignImg == null) currRecord.SignImg = new byte[0]; MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord); if (hqyjcontrol != null) { PJ_lcspyj lcyj = new PJ_lcspyj(); lcyj.Charman = MainHelper.User.UserName; lcyj.ID = PJ_lcspyj.Newid(); lcyj.RecordID = currRecord.ID; lcyj.taskID = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); lcyj.Spyj = hqyjcontrol.nowMemoEdit.Text; lcyj.Creattime = DateTime.Now; if (hqyjcontrol.nowMemoEdit.Text != "") MainHelper.PlatformSqlMap.Create<PJ_lcspyj>(lcyj); } if (filecontrol != null) { for (int i = 0; i < filecontrol.FJtable.Rows.Count; i++) { PJ_lcfj lcfu = new PJ_lcfj(); lcfu.ID = lcfu.CreateID(); lcfu.Filename = Path.GetFileName(filecontrol.FJtable.Rows[i]["FilePath"].ToString()); lcfu.FileRelativePath = filecontrol.UpfilePath + "/" + filecontrol.FJtable.Rows[i]["SaveFileName"].ToString(); lcfu.FileSize = Convert.ToInt64(filecontrol.FJtable.Rows[i]["FileSize"]); lcfu.RecordID = currRecord.ID; lcfu.Creattime = DateTime.Now; if (filecontrol.FJtable.Rows[i]["Kind"].ToString() != "已上传") MainHelper.PlatformSqlMap.Create<PJ_lcfj>(lcfu); } } rowData = null; break; } ArrayList akeys=new ArrayList(valuehs.Keys); List<object> list = new List<object>(); for (int i = 0; i < akeys.Count;i++ ) { WF_TableFieldValue wfv = valuehs[akeys[i]] as WF_TableFieldValue; wfv.ID = wfv.CreateID(); wfv.RecordId = currRecord.ID; wfv.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); wfv.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); wfv.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); wfv.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); wfv.UserControlId = parentTemple.LPID; Thread.Sleep(new TimeSpan(100000));//0.1毫秒 list.Add(wfv); } if (list.Count > 0) { Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(list, null, null); } dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); this.DialogResult = DialogResult.OK; }