예제 #1
0
        /// <summary>
        /// 新增|修改
        /// </summary>
        /// <param name="data"></param>
        /// <param name="eventType"></param>
        private void EditAdd(MySqlResponseData data, EnumTable eventType)
        {
            if (data.SubscribeData != null)
            {
                SubscribeDataModel formHtml   = null;
                SubscribeDataModel instanceID = data.SubscribeData.Where(c => c.Key.Equals("InstanceID")).FirstOrDefault();
                SubscribeDataModel type       = data.SubscribeData.Where(c => c.Key.Equals("Type")).FirstOrDefault();
                SubscribeDataModel typeCode   = data.SubscribeData.Where(c => c.Key.Equals("TypeCode")).FirstOrDefault();
                switch (eventType)
                {
                case EnumTable.Insert:
                    formHtml = data.SubscribeData.Where(c => c.Key.Equals("Html")).FirstOrDefault();
                    break;

                case EnumTable.Update:
                    formHtml = data.SubscribeData.Where(c => c.Key.Equals("Html") && c.Updated == true).FirstOrDefault();
                    break;

                case EnumTable.Delete:
                    break;

                default:
                    break;
                }
                if (formHtml != null && instanceID != null && type != null && typeCode != null)
                {
                    new JiJiaWorkFlowRedis().HashSet <string>(RedisKey.ApplyFormKey(instanceID.Value), type.Value + "-" + typeCode.Value, formHtml.Value);
                }
            }
        }
예제 #2
0
        public void DataAnalysis(MySqlResponseData data)
        {
            EnumTable          eventType = (EnumTable)Enum.Parse(typeof(EnumTable), data.EventType);
            SubscribeDataModel id        = data.SubscribeData.Where(c => c.Key.Equals("ID")).FirstOrDefault();

            if (id != null)
            {
                switch (eventType)
                {
                case EnumTable.Insert:
                    UpdateApplyCache(data.SubscribeData, id.Value);
                    break;

                case EnumTable.Update:
                    //1流程结束,2流程退回,3流程提交失败
                    SubscribeDataModel updateStatus = data.SubscribeData.Where(c => c.Key.Equals("FlowApplyStatus") && c.Updated == true).FirstOrDefault();
                    if (updateStatus != null && id != null)
                    {
                        if (updateStatus != null)
                        {
                            int status = 0;
                            int.TryParse(updateStatus.Value, out status);
                            switch (status)
                            {
                            case 1:
                            case 2:
                            case 3:
                                DelCache(id.Value);
                                break;

                            default:
                                UpdateApplyCache(data.SubscribeData, id.Value);
                                break;
                            }
                        }
                    }
                    else
                    {
                        UpdateApplyCache(data.SubscribeData, id.Value);
                    }
                    break;

                case EnumTable.Delete:
                    if (id != null)
                    {
                        DelCache(id.Value);
                    }
                    break;

                default:
                    break;
                }
            }
        }