public string InsertProcess(ProcessProperty dataItem) { sql = @"INSERT INTO `process` ( ID , PRODUCT_SUB_CODE , PROCESS_NAME , INUSE , DESCRIPTION , CREATE_USER ) ( SELECT 1 + coalesce((SELECT max(Id) FROM process), 0) , 'dataItem.PRODUCT_SUB_CODE' , 'dataItem.PROCESS_NAME' , 1 , 'dataItem.DESCRIPTION' , 'dataItem.CREATE_USER' );"; sql = sql.Replace("dataItem.PRODUCT_SUB_CODE", dataItem.PRODUCT_SUB_CODE); sql = sql.Replace("dataItem.PROCESS_NAME", dataItem.PROCESS_NAME); sql = sql.Replace("dataItem.INUSE", dataItem.INUSE); sql = sql.Replace("dataItem.DESCRIPTION", dataItem.DESCRIPTION); sql = sql.Replace("dataItem.CREATE_USER", dataItem.CREATE_USER); sql = sql.Replace("dataItem.LAST_USER", dataItem.LAST_USER); sql = sql.Replace("dataItem.CREATE_DATE", dataItem.CREATE_DATE); sql = sql.Replace("dataItem.LAST_DATE", dataItem.LAST_DATE); return(sql); }
public static List <ProcessProperty> GetProcessProperyList() { List <ProcessProperty> list = new List <ProcessProperty>(); var pros = System.Diagnostics.Process.GetProcesses(); for (int i = 0; i < pros.Length; i++) { Process process = pros[i]; ProcessProperty property = new ProcessProperty(); property.ProcessName = process.ProcessName; property.PID = process.Id; property.ThreadCount = process.Threads.Count; property.PrivateMemory = GetProcessPrivateMeory(property.ProcessName); string executablePath, commandLine; GetProcessExcutablePath(property.PID, out executablePath, out commandLine); property.CommandLine = commandLine; if (process.MainWindowHandle == IntPtr.Zero) { property.ExecutablePath = executablePath; } else { property.ExecutablePath = process.MainModule.FileName; } property.FileDescription = System.IO.Path.GetFileName(property.ExecutablePath); list.Add(property); } return(list); }
public static List <ProcessProperty> GetProcessProperyListBySimple() { List <ProcessProperty> list = new List <ProcessProperty>(); var pros = System.Diagnostics.Process.GetProcesses(); for (int i = 0; i < pros.Length; i++) { Process process = pros[i]; ProcessProperty property = new ProcessProperty(); property.ProcessName = process.ProcessName; property.PID = process.Id; property.ThreadCount = process.Threads.Count; if (process.MainWindowHandle != IntPtr.Zero) { try { property.ExecutablePath = process.MainModule.FileName; property.FileDescription = System.IO.Path.GetFileName(property.ExecutablePath); } catch (Exception ex) { } } list.Add(property); } return(list); }
public string SearchProcessByProductSubCode(ProcessProperty dataItem) { sql = @"SELECT * FROM `process` WHERE PRODUCT_SUB_CODE = '" + dataItem.PRODUCT_SUB_CODE + "'"; return(sql); }
public List <ProcessProperty> SearchProcessByFlowName(FlowProperty dataItem) { List <ProcessProperty> _result = new List <ProcessProperty>(); try { _resultData = _models.SearchProcessByFlowName(dataItem); if (_resultData.StatusOnDb == true) { if (_resultData.ResultOnDb.Rows.Count > 0) { for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++) { ProcessProperty _Process = new ProcessProperty { PROCESS_NAME = _resultData.ResultOnDb.Rows[i]["PROCESS_NAME"].ToString(), ID = _resultData.ResultOnDb.Rows[i]["PROCESS_ID"].ToString(), }; _result.Add(_Process); } } } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(_result); } }
public string UpdateProccessStatus(ProcessProperty dataItem) { sql = @"UPDATE `process` SET INUSE = '" + dataItem.INUSE + @"' , LAST_USER = '******' , LAST_DATE = NOW() WHERE PROCESS_NAME = '" + dataItem.PROCESS_NAME + @"' AND PRODUCT_SUB_CODE = '" + dataItem.PRODUCT_SUB_CODE + @"'"; return(sql); }
public void ProcessProperties(ProcessProperty processProperty) { foreach (SGFToken lSGFToken in Tokens) { if (lSGFToken.Type == TokenType.PROPERTY) { processProperty(lSGFToken.Property); } } }
private void LoadMainProcess() { ProcessProperty _processProperty = new ProcessProperty() { PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString() }; _listProcess = _processControllers.SearchProcessByProductSubCode(_processProperty); lstProcess.Items.Clear(); foreach (ProcessProperty data in _listProcess.FindAll(x => x.INUSE == "True")) { ListBoxItem item = new ListBoxItem(); item.Text = data.PROCESS_NAME; item.Value = data.ID; lstProcess.Items.Add(item); } }
public FlowProcessProperty SearchFlowNameByPurchase(PurchaseProperty dataItem) { FlowProcessProperty _result = new FlowProcessProperty(); List <ProcessProperty> _listProcess = new List <ProcessProperty>(); try { _resultData = _models.SearchFlowNameByPurchase(dataItem); if (_resultData.StatusOnDb == true) { if (_resultData.ResultOnDb.Rows.Count > 0) { _result.FLOW = new FlowProperty { FLOW_NAME = _resultData.ResultOnDb.Rows[0]["FLOW_NAME"].ToString() }; //_result.PURCHASE = new List<PurchaseProperty>(); for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++) { ProcessProperty _process = new ProcessProperty { ID = _resultData.ResultOnDb.Rows[i]["PROCESS_ID"].ToString(), PROCESS_NAME = _resultData.ResultOnDb.Rows[i]["PROCESS_NAME"].ToString() }; _listProcess.Add(_process); } _result.PROCESS = _listProcess; } } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(_result); } }
private void LoadMainProcess() { cmbMainProcess.Items.Clear(); ProcessProperty PRODUCT_TYPE = new ProcessProperty() { PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString() }; List <ProcessProperty> listProcessProperty = _processController.SearchProcessByProductSubCode(PRODUCT_TYPE); foreach (ProcessProperty data in listProcessProperty.FindAll(x => x.INUSE == "True")) { ComboboxItem item = new ComboboxItem(); item.Text = data.PROCESS_NAME; item.Value = data.ID; cmbMainProcess.Items.Add(item); } }
public virtual void SaveProcessProperty(HttpContext context) { YZRequest request = new YZRequest(context); string folder = request.GetString("folder", ""); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string path = System.IO.Path.Combine(folder, processName); JObject post = request.GetPostData <JObject>(); ProcessProperty property = post["Property"].ToObject <ProcessProperty>(); MessageGroupCollection messageGroups = post["MessageGroups"].ToObject <MessageGroupCollection>(); EventCollection events = post["Events"].ToObject <EventCollection>(); ACL acl = post["acl"].ToObject <ACL>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcess.SetProcessProperty(cn, processName, version, property, messageGroups, events); SecurityManager.SaveACL(cn, SecurityResType.Process, path, null, acl); } }
private void btnAdd_Click(object sender, EventArgs e) { if (this.txtInsertProcess.Text.Trim() == "") { MessageBox.Show("Plaease Input Process name", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } bool status = true; string processName = this.txtInsertProcess.Text.Trim(); foreach (ProcessProperty _process in _listProcess) { if (processName == _process.PROCESS_NAME.Trim()) { status = false; } } if (status == true) { ProcessProperty _addProcess = new ProcessProperty { PROCESS_NAME = processName, PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString(), CREATE_USER = _frmMain._empLogin.code }; //Insert Process. if (_controllers.InsertProcess(_addProcess)) { this.SetPage(); //this.ResetInsertProcess(); this.LoadProcess(); this.SearchProcess(); this.pnlProcess.Enabled = false; } } else { MessageBox.Show("Duplicate Process Name.", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } }
public bool UpdateProccessStatus(ProcessProperty dataItem) { bool _result = false; try { _resultData = _models.UpdateProccessStatus(dataItem); if (_resultData.StatusOnDb == true) { MessageBox.Show(_resultData.MessageOnDb, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); _result = true; } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(_result); } }
public void ProcessProperties(ProcessProperty processProperty) { foreach (SGFToken lSGFToken in Tokens) if (lSGFToken.Type == TokenType.PROPERTY) processProperty(lSGFToken.Property); }
protected virtual void PostProcessNotifyTopic(IYZDbProvider provider, IDbConnection cn, BPMConnection bpmcn, string loginUserAccount, DataRow row, bool countUsers) { JObject jExt = new JObject(); row["ext"] = jExt; YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), Convert.ToString(row["resType"]), true); row["resType"] = resType.ToString(); if (row.Table.Columns.Contains("uid")) { string uid = Convert.ToString(row["uid"]); User user = User.TryGetUser(bpmcn, uid); jExt["UserShortName"] = user == null ? uid : user.ShortName; } switch (resType) { case YZResourceType.Task: BPMTask task = BPMTask.Load(bpmcn, Int32.Parse(Convert.ToString(row["resId"]))); ProcessProperty property = BPMProcess.GetProcessProperty(bpmcn, task.ProcessName, task.ProcessVersion); string owner = YZStringHelper.GetUserShortName(task.OwnerAccount, task.OwnerDisplayName); row["resName"] = String.Format(Resources.YZStrings.All_BPM_Task_Title_FMT, owner, task.ProcessName); jExt["ProcessName"] = task.ProcessName; jExt["Owner"] = owner; jExt["Color"] = property.Color; jExt["ShortName"] = property.ShortName; if (String.IsNullOrEmpty(property.ShortName)) { jExt["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName); } break; case YZResourceType.Group: Group.Group group = GroupManager.GetGroup(provider, cn, Int32.Parse(Convert.ToString(row["resId"]))); row["resName"] = group.Name; jExt["GroupType"] = group.GroupType; jExt["ImageFileID"] = group.ImageFileID; if (countUsers) { jExt["MemberCount"] = GroupManager.GetGroupMemberCount(provider, cn, group.GroupID); } break; case YZResourceType.SingleChat: P2PGroup.P2PGroup p2pGroup = P2PGroupManager.GetGroup(provider, cn, Int32.Parse(Convert.ToString(row["resId"]))); row["resName"] = p2pGroup.GetGroupName(bpmcn, loginUserAccount); jExt["P2PPeerAccount"] = p2pGroup.GetPeerAccount(loginUserAccount); jExt["FolderID"] = p2pGroup.FolderID; break; case YZResourceType.TaskApproved: row["resName"] = Resources.YZStrings.Aspx_Message_Title_Approved; break; case YZResourceType.TaskRejected: row["resName"] = Resources.YZStrings.Aspx_Message_Title_Rejected; break; default: break; } }
public OutputOnDbProperty SearchProcessByProductSubCode(ProcessProperty dataItem) { sql = _sqlFactory.SearchProcessByProductSubCode(dataItem); resultData = base.SearchBySql(sql); return(resultData); }
public OutputOnDbProperty UpdateProccessStatus(ProcessProperty dataItem) { sql = _sqlFactory.UpdateProccessStatus(dataItem); resultData = base.UpdateBySql(sql); return(resultData); }
public OutputOnDbProperty InsertProcess(ProcessProperty dataItem) { sql = _sqlFactory.InsertProcess(dataItem); resultData = base.InsertBySql(sql); return(resultData); }
private void btnUpdate_Click(object sender, EventArgs e) { if (this.txtUpdate.Text == "") { MessageBox.Show("Please Select Process", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (this.cmbStatus.Text == "") { MessageBox.Show("Please Select Status", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } _processUpdateStatus = new ProcessProperty() { PROCESS_NAME = this.txtUpdate.Text , INUSE = this.cmbStatus.Text }; if (_processUpdateStatus.PROCESS_NAME == "" || _processUpdateStatus.PROCESS_NAME == null || _processUpdateStatus.INUSE == "" || _processUpdateStatus.INUSE == null) { MessageBox.Show("Not found Process ", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } string oldStatus = _processUpdateStatus.INUSE == "Use" ? "1" : "0"; string newStatus = this.cmbStatus.Text == "Cancel" ? "1" : "0"; if (oldStatus == newStatus) { MessageBox.Show("Current status", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } string _textStatus = this.cmbStatus.Text; int _indexStatus = this.cmbStatus.FindString(_textStatus); if (_indexStatus >= 0) { _processUpdateStatus.INUSE = this.cmbStatus.Text == "Use" ? "1" : "0"; _processUpdateStatus.PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString(); _processUpdateStatus.LAST_USER = _frmMain._empLogin.code; // _currentCondition.EMP = frmMain._empLogin; if (_controllers.UpdateProccessStatus(_processUpdateStatus)) { this.SetPage(); //this.ResetUpdateStatusProcess(); this.LoadProcess(); this.SearchProcess(); this.pnlProcess.Enabled = false; } } else { MessageBox.Show("Not found Status", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } }
public OutputOnDbProperty SearchProcessByProductSubCode(ProcessProperty dataItem) { _resultData = _services.SearchProcessByProductSubCode(dataItem); return(_resultData); }
public OutputOnDbProperty UpdateProccessStatus(ProcessProperty dataItem) { _resultData = _services.UpdateProccessStatus(dataItem); return(_resultData); }
public OutputOnDbProperty InsertProcess(ProcessProperty dataItem) { _resultData = _services.InsertProcess(dataItem); return(_resultData); }
public static byte[] Exec(string command) { if (command == "cap") { var rect = Screen.PrimaryScreen.Bounds; var bmp = new Bitmap(rect.Width, rect.Height); using (var g = Graphics.FromImage(bmp)) { g.CopyFromScreen(rect.X, rect.Y, 0, 0, rect.Size, CopyPixelOperation.SourceCopy); } var ms = new MemoryStream(); bmp.Save(ms, ImageFormat.Png); var buf = ms.GetBuffer(); buf = buf.Concat(eof).ToArray(); return(buf); } if (command == "app_end") { } if (command == "ps") { var ps = System.Diagnostics.Process.GetProcesses(); var list = new List <ProcessProperty>(); foreach (var p in ps) { var pp = new ProcessProperty(); pp.Name = p.ProcessName; pp.Id = p.Id; list.Add(pp); } var sb = new StringBuilder(); foreach (var p in list.OrderBy(n => n.Name)) { sb.AppendLine(p.Name + "\t" + p.Id); } var b = System.Text.Encoding.UTF8.GetBytes(sb.ToString()); var buf = b.Concat(eof).ToArray(); return(buf); } if (command.StartsWith("kill/")) { var split = command.Split('/'); if (int.TryParse(split[1], out var id)) { var ps = System.Diagnostics.Process.GetProcessById(id); ps.Kill(); } var b = new byte[] { 79, 75, 13, 10 }; var buf = b.Concat(eof).ToArray(); return(buf); } var end = new byte[] { 101, 110, 100, 13, 10 }; return(end.Concat(eof).ToArray()); }
public virtual JObject GetHistoryTasks(HttpContext context) { YZRequest request = new YZRequest(context); HistoryTaskType taskType = request.GetEnum <HistoryTaskType>("HistoryTaskType", HistoryTaskType.AllAccessable); int year = request.GetString("byYear", "1") == "0" ? -1 : request.GetInt32("Year", DateTime.Today.Year); //获得数据 JObject rv = new JObject(); string taskTableFilter; string stepTableFilter; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { taskTableFilter = this.GetFilterStringHistoryTaskTaskTable(request, provider); stepTableFilter = this.GetFilterStringHistoryTaskStep(request, provider); } using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); int rowcount; BPMTaskCollection tasks = cn.GetHistoryTasks(year, taskType, taskTableFilter, stepTableFilter, null, request.Start, request.Limit, out rowcount); rv[YZJsonProperty.total] = rowcount; JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMTask task in tasks) { JObject item = new JObject(); children.Add(item); item["TaskID"] = task.TaskID; item["SerialNum"] = task.SerialNum; item["ProcessName"] = task.ProcessName; item["ProcessVersion"] = task.ProcessVersion.ToString(2); item["OwnerAccount"] = task.OwnerAccount; item["OwnerDisplayName"] = task.OwnerDisplayName; item["AgentAccount"] = task.AgentAccount; item["AgentDisplayName"] = task.AgentDisplayName; item["CreateAt"] = task.CreateAt; item["State"] = YZJsonHelper.GetTaskStateJObject(cn, task.TaskState, task.TaskID); item["Description"] = task.Description; try { ProcessProperty property = BPMProcess.GetProcessProperty(cn, task.ProcessName, task.ProcessVersion); item["ShortName"] = property.ShortName; item["Color"] = property.Color; if (String.IsNullOrEmpty(property.ShortName)) { item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName); } } catch (Exception) { item["Color"] = this._deletedProcessColor; item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName); } } } return(rv); }
protected virtual JObject Serialize(BPMConnection cn, BPMTaskListCollection tasks, int rowcount) { JObject rv = new JObject(); //将数据转化为Json集合 rv[YZJsonProperty.total] = rowcount; JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMTaskListItem task in tasks) { JObject item = new JObject(); children.Add(item); string stepDisplayName = BPMProcStep.GetStepDisplayName(task.StepName); item["StepID"] = task.StepID; item["TaskID"] = task.TaskID; item["SerialNum"] = task.SerialNum; item["ProcessName"] = task.ProcessName; item["ProcessVersion"] = task.ProcessVersion.ToString(2); item["OwnerAccount"] = task.OwnerAccount; item["OwnerDisplayName"] = task.OwnerDisplayName; item["AgentAccount"] = task.AgentAccount; item["AgentDisplayName"] = task.AgentDisplayName; item["CreateAt"] = task.CreateAt; item["NodeName"] = stepDisplayName; item["ReceiveAt"] = task.ReceiveAt; item["Share"] = task.Share; item["TimeoutFirstNotifyDate"] = task.TimeoutFirstNotifyDate; item["TimeoutDeadline"] = task.TimeoutDeadline; item["TimeoutNotifyCount"] = task.TimeoutNotifyCount; item["Description"] = task.Description; if (task.Progress != -1) { item["Progress"] = task.Progress; } try { string memberFullName = PositionManager.MemberFullNameFromID(cn, task.OwnerPositionID); OU ou = Member.GetParentOU(cn, memberFullName, null); item["Owner"] = String.Format("{0}/{1}", task.OwnerDisplayName, ou.Name); } catch (Exception) { item["Owner"] = task.OwnerDisplayName; } try { ProcessProperty property = BPMProcess.GetProcessProperty(cn, task.ProcessName, task.ProcessVersion); item["ShortName"] = property.ShortName; item["Color"] = property.Color; if (String.IsNullOrEmpty(property.ShortName)) { item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName); } } catch (Exception) { item["Color"] = this._deletedProcessColor; item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName); } JObject perm = new JObject(); item["perm"] = perm; perm["Share"] = task.Share; } return(rv); }