public ModelInvokeResult <WXStationAuthRequestPK> Update(string strId, WXStationAuthRequest wXStationAuthRequest)
        {
            ModelInvokeResult <WXStationAuthRequestPK> result = new ModelInvokeResult <WXStationAuthRequestPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                /***********************begin 自定义代码*******************/
                wXStationAuthRequest.OperatedBy = NormalSession.UserId.ToGuid();
                wXStationAuthRequest.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = wXStationAuthRequest.GetUpdateMethodName(), ParameterObject = wXStationAuthRequest.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new WXStationAuthRequestPK {
                    Id = int.Parse(strId)
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Beispiel #2
0
        public InvokeResult AuthServeMan(AuthServeManParam param)
        {
            InvokeResult result = new InvokeResult();

            try
            {
                var requests = BuilderFactory.DefaultBulder().List <WXStationAuthRequest>(new WXStationAuthRequest {
                    OpenId = param.OpenId, StationId = param.StationId, DoStatus = 1
                }.ToStringObjectDictionary(false));
                bool addNew = false;
                if (requests.Count == 0)
                {
                    //新申请
                    addNew = true;
                }
                else
                {
                    if (requests.Any(item => item.DoStatus == 0 || item.DoStatus == 1))
                    {
                        //已经存在或还在等待审核,则忽略
                    }
                    else if (requests.Any(item => item.DoStatus == 2))
                    {
                        //重新申请
                        addNew = true;
                    }
                }

                if (addNew)
                {
                    WXStationAuthRequest wxRequest = new WXStationAuthRequest {
                        OpenId = param.OpenId, StationId = param.StationId
                    };
                    string sourceKey = TypeConverter.ChangeString(BuilderFactory.DefaultBulder().Create <WXStationAuthRequest>(wxRequest.ToStringObjectDictionary(false)));
                    //提醒记录

                    int reminderId = Convert.ToInt32(BuilderFactory.DefaultBulder().Create <Reminder>(new Reminder {
                        SourceTable = wxRequest.GetMappingTableName(), SourceColumn = "Id", SourceKey = sourceKey, SourceType = "B0101", RemindTime = DateTime.Now, RemindContent = "您有一条微信服务人员资格申请等待审核"
                    }.ToStringObjectDictionary(false)));
                    BuilderFactory.DefaultBulder().Create <ReminderObject>(new ReminderObject {
                        ReminderId = reminderId, ObjectType = "Merchant", ObjectKey = param.StationId.ToString()
                    }.ToStringObjectDictionary(false));
                }
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }