public void ClientActivityToDTO() { var clientActivity = new ClientActivity(); var dto = (ActivityDTO)clientActivity; Assert.IsType <ActivityDTO>(dto); }
public string InitClientActivity() { ClientActivity x = new ClientActivity(); x.id = 0; x.activity = ""; x.duration = 0.0; return(JsonConvert.SerializeObject(x, Formatting.None)); }
public ClientViews(ClientActivity parent) { RefreshButton = parent.FindViewById <ImageButton>(Resource.Id.button_refresh); PeersRecyclerView = parent.FindViewById <RecyclerView>(Resource.Id.recyclerview_access_points); RefreshLayout = parent.FindViewById <SwipeRefreshLayout>(Resource.Id.refresh_layout); GlobalProgressBar = parent.FindViewById <ProgressBar>(Resource.Id.progressbar_global); ButtonProgressBar = parent.FindViewById <ProgressBar>(Resource.Id.progressbar_button); TitleLayout = parent.FindViewById <RelativeLayout>(Resource.Id.layout_title); NoPeersLayout = parent.FindViewById <RelativeLayout>(Resource.Id.layout_no_peers); PeersRecyclerView.SetLayoutManager(new LinearLayoutManager(parent)); }
public ClientActivity GetClientActivity() { var result = new ClientActivity(); var obscurer = new ClientObscurer(); var clients = _timeEntries .Where(entity => !String.IsNullOrEmpty(entity.Client)) .Select(entity => new { Client = obscurer.Obscure(entity.Client), Duration = entity.Duration }) .GroupBy(entry => entry.Client) .Select(group => new Client { Name = group.Key, TotalDuration = group.Sum(x => x.Duration / 1000) }); result.Clients = clients.ToList(); return(result); }
public string DataTrack(MvcPostValue MvcPost, FieldSchema[] fields, SheetDataType sheetDataType, ClientActivity clientActivity) { var dics = new Dictionary <string, object>(); // 数据项存在2个情况,1.数据项名称 2.数据项.子数据项 foreach (FieldSchema field in fields) { // 如果数据项设置不允许保存,那么不会被保存进去 if (sheetDataType == SheetDataType.Workflow && !clientActivity.GetItemEditable(field.Name)) { continue; } if (!MvcPost.BizObject.DataItems.ContainsKey(field.Name)) { continue; } if (field.LogicType == DataLogicType.BizObject || field.LogicType == DataLogicType.BizObjectArray) { continue; } if (field.LogicType == DataLogicType.Comment && int.Equals(MvcPost.WorkItemType, (int)WorkItemType.WorkItemAssist)) { // 协办处理审核意见和审批结果逻辑 //SaveCommentData(MvcPost.BizObject, field.Name, MvcResult, MvcPost); } else if (field.LogicType == DataLogicType.Comment) { // 处理审核意见和审批结果逻辑 //SaveCommentData(MvcPost.BizObject, field.Name, MvcResult, null); } else if (field.LogicType == DataLogicType.Attachment) { // 处理附件逻辑 } else if (field.LogicType == DataLogicType.MultiParticipant) { // 处理多人参与者逻辑 } else { // 处理普通数据项 //this.ActionContext.InstanceData[field.Name].Value = MvcPost.BizObject.DataItems[field.Name].V; dics.Add(field.Name, MvcPost.BizObject.DataItems[field.Name].V); } } // 最后保存子表,因为关联关系的子表主键有可能在主表中,所以先保存主表 foreach (FieldSchema field in fields) { // 如果数据项设置不允许保存,那么不会被保存进去 if (sheetDataType == SheetDataType.Workflow && !clientActivity.GetItemEditable(field.Name)) { continue; } if (!MvcPost.BizObject.DataItems.ContainsKey(field.Name)) { continue; } if (field.LogicType != DataLogicType.BizObject && field.LogicType != DataLogicType.BizObjectArray) { continue; } if (field.LogicType == DataLogicType.BizObject) { // 业务对象可以使用普通控件显示,例如:业务对象A.Code,可以使用文本框绑定数据项显示 A.Code } else if (field.LogicType == DataLogicType.BizObjectArray) { if (field.Name == "APPLICANT_TYPE") { continue; } // 记录字表变动数据 List <Dictionary <string, object> > result = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(MvcPost.BizObject.DataItems[field.Name].V.ToString()); if (result != null && result.Any()) { var dicItems = new List <Dictionary <string, object> >(); foreach (var item in result) { var dicItem = new Dictionary <string, object>(); foreach (var dicKey in item.Keys) { if (dicKey.ToLower() == "objectid") { continue; } var itemField = field.Schema.Fields.Where(p => p.Name == dicKey).FirstOrDefault(); if (itemField != null) { dicItem.Add(dicKey, item[dicKey]); } } dicItems.Add(dicItem); } dics.Add(field.Name, dicItems); } } } var dataTrack = JsonConvert.SerializeObject(dics, Formatting.Indented); return(dataTrack); }
public JsonResult StartInstance(string paramString) { ActionResult result = new ActionResult(false, ""); Dictionary <string, string> dicParams = JsonConvert.DeserializeObject <Dictionary <string, string> >(paramString); string WorkflowCode = string.Empty, SchemaCode = string.Empty, InstanceName = string.Empty; int WorkflowVersion = WorkflowTemplate.WorkflowDocument.NullWorkflowVersion; bool IsMobile = false; string SheetCode = string.Empty; string LoginName = string.Empty; string MobileToken = string.Empty; string WechatCode = string.Empty; string EngineCode = string.Empty; Dictionary <string, string> dicOtherParams = new Dictionary <string, string>(); //读取URL参数 foreach (string key in dicParams.Keys) { if (key == Param_WorkflowCode) { WorkflowCode = dicParams[key]; continue; } if (key == Param_SchemaCode) { SchemaCode = dicParams[key]; continue; } if (key == Param_WorkflowVersion) { int.TryParse(dicParams[key], out WorkflowVersion); continue; } if (key == Param_IsMobile) { bool.TryParse(dicParams[key], out IsMobile); continue; } if (key == Param_SheetCode) { SheetCode = dicParams[key]; continue; } if (key == Param_InstanceName) { InstanceName = dicParams[key]; continue; } if (key.ToLower() == "loginname") { LoginName = dicParams[key]; continue; } if (key.ToLower() == "mobiletoken") { MobileToken = dicParams[key]; continue; } if (key.ToLower() == "code") { WechatCode = dicParams[key]; } if (key.ToLower() == "state") { EngineCode = dicParams[key]; } dicOtherParams.Add(key, dicParams[key]); } //TODO:微信不需要做单点登录 ////实现微信单点登录 //if (!string.IsNullOrEmpty(WechatCode) && !string.IsNullOrEmpty(EngineCode) // && System.Web.HttpContext.Current.Session[Sessions.GetUserValidator()] != null) //{ // IsMobile = true; // UserValidatorFactory.LoginAsWeChat(EngineCode, WechatCode); //} //APP打开表单验证 if (!string.IsNullOrEmpty(LoginName) && !string.IsNullOrEmpty(MobileToken) && this.UserValidator == null) { if (!SSOopenSheet(LoginName, MobileToken)) { result = new ActionResult(false, "登录超时!", null, ExceptionCode.NoAuthorize); return(Json(result, JsonRequestBehavior.AllowGet)); } } else if (this.UserValidator == null) { result = new ActionResult(false, "登录超时!", null, ExceptionCode.NoAuthorize); return(Json(result, JsonRequestBehavior.AllowGet)); } //计算 WorkflowCode if (WorkflowCode == string.Empty && !string.IsNullOrEmpty(SchemaCode)) { WorkflowClause[] clauses = this.Engine.WorkflowManager.GetClausesBySchemaCode(SchemaCode); if (clauses != null) { foreach (WorkflowClause clause in clauses) { if (clause.DefaultVersion > 0) { WorkflowCode = clause.WorkflowCode; } } } } //流程版本号 if (WorkflowVersion == WorkflowTemplate.WorkflowDocument.NullWorkflowVersion || WorkflowVersion == 0) { WorkflowVersion = this.Engine.WorkflowManager.GetWorkflowDefaultVersion(WorkflowCode); } //流程优先级 OThinker.H3.Instance.PriorityType Priority = OThinker.H3.Instance.PriorityType.Normal; if (dicParams.ContainsKey(Param_Priority)) { string strPriority = dicParams[Param_Priority]; Priority = (OThinker.H3.Instance.PriorityType)Enum.Parse(typeof(OThinker.H3.Instance.PriorityType), strPriority); } try { if (string.IsNullOrEmpty(WorkflowCode)) { result.Message = "StartInstance.StartInstance_Msg0"; return(Json(result, JsonRequestBehavior.AllowGet)); } // 获得工作流模板 PublishedWorkflowTemplate workflow = this.Engine.WorkflowManager.GetPublishedTemplate(WorkflowCode, WorkflowVersion); if (workflow == null) { result.Message = "StartInstance.StartInstance_Msg1"; return(Json(result, JsonRequestBehavior.AllowGet)); } DataModel.BizObjectSchema schema = this.Engine.BizObjectManager.GetPublishedSchema(workflow.BizObjectSchemaCode); // 开始节点 ClientActivity startActivity = null; // 开始的表单 BizSheet startSheet = null; System.Text.StringBuilder instanceParamBuilder = new System.Text.StringBuilder(); if (dicOtherParams.Count > 0) { foreach (string key in dicOtherParams.Keys) { instanceParamBuilder.Append(string.Format("&{0}={1}", key, dicOtherParams[key])); } } startActivity = workflow.GetActivityByCode(workflow.StartActivityCode) as ClientActivity; if (!string.IsNullOrEmpty(SheetCode)) { startSheet = this.Engine.BizSheetManager.GetBizSheetByCode(SheetCode); } if (startSheet == null) { if (!string.IsNullOrEmpty(startActivity.SheetCode)) { startSheet = this.Engine.BizSheetManager.GetBizSheetByCode(startActivity.SheetCode); } else { BizSheet[] sheets = this.Engine.BizSheetManager.GetBizSheetBySchemaCode(workflow.BizObjectSchemaCode); if (sheets != null && sheets.Length > 0) { startSheet = sheets[0]; } } } if (workflow.StartWithSheet && startActivity != null && startSheet != null) { string url = this.GetSheetBaseUrl( SheetMode.Originate, IsMobile, startSheet); url = url + SheetEnviroment.Param_Mode + "=" + SheetMode.Originate + "&" + Param_WorkflowCode + "=" + System.Web.HttpUtility.UrlEncode(workflow.WorkflowCode) + "&" + Param_WorkflowVersion + "=" + workflow.WorkflowVersion + //(string.IsNullOrEmpty(SheetCode)?"":("&"+Param_SheetCode+"="+SheetCode))+ (instanceParamBuilder.Length == 0 ? string.Empty : ("&" + instanceParamBuilder.ToString())); //URL result.Message = url; } else { // 发起流程 string instanceId = Guid.NewGuid().ToString().ToLower(); string workItemId = null; string error = null; OThinker.H3.DataModel.BizObject bo = new DataModel.BizObject(this.UserValidator.Engine, schema, this.UserValidator.UserID); bo.Create(); if (!SheetUtility.OriginateInstance( this.Engine, bo.ObjectID, workflow, schema, ref instanceId, this.UserValidator.UserID, null, null, OThinker.H3.Instance.PriorityType.Unspecified, null, null, null, ref workItemId, ref error, false)) { result.Message = error; } string startInstanceUrl = this.GetInstanceUrl(instanceId, workItemId); startInstanceUrl += (instanceParamBuilder.Length == 0 ? null : ("&" + instanceParamBuilder.ToString())); result.Message = startInstanceUrl; } } catch (Exception ex) { result.Message = ex.Message; return(Json(result, JsonRequestBehavior.AllowGet)); } result.Success = true; return(Json(result, JsonRequestBehavior.AllowGet)); }
public void DeleteClientActivity(ClientActivity clientActivity) { _context.ClientActivities.Remove(clientActivity); }
public void AddClientActivity(int activityId, ClientActivity clientActivity) { var activity = GetActivity(activityId); activity.ClientActivities.Add(clientActivity); }
private async Task LoadData() { activityDetails = await Http.GetActivityById(Id); }