public static void ProcessCorpUser(bool subscribe, string logonName) { using (EmptyDbDataSource source = WeDataUtil.CreateSource()) using (InternalCorpUserResolver resolver = new InternalCorpUserResolver(source)) { DataRow row = resolver.TrySelectRowWithParam("UserLogonName", logonName); if (row != null) { resolver.SetCommands(AdapterCommand.Update); row.BeginEdit(); DateTime current = DateTime.Now; if (subscribe) { row["AttentionFlag"] = 1; row["AttentionDate"] = current; row["UnAttentionDate"] = DBNull.Value; } else { row["AttentionFlag"] = 0; row["UnAttentionDate"] = current; } row["UpdateDate"] = current; row.EndEdit(); } resolver.UpdateDatabase(); } }
public override OutputData DoAction(IInputData input) { using (TaxDocumentResolver docResolver = new TaxDocumentResolver(this)) using (WeixinMassResolver massResolver = new WeixinMassResolver(this)) using (WeixinMassDetailResolver detailResolver = new WeixinMassDetailResolver(this)) { DataRow row = massResolver.Query(input.QueryString); if (row["SendFlag"].Value <int>() == 4) // 已发送的不在发送 { return(OutputData.Create("-2")); } massResolver.SetCommands(AdapterCommand.Update); docResolver.SetCommands(AdapterCommand.Update); DateTime current = DateTime.Now; row.BeginEdit(); row["SendFlag"] = 4; row["SendDate"] = row["UpdateDate"] = current; row["SendId"] = row["UpdateId"] = BaseGlobalVariable.UserId; row.EndEdit(); MpNewsMassMessage msg = new MpNewsMassMessage(); string basePath = Path.Combine(BaseAppSetting.Current.AppPath, @"..\pic\sys\"); string path = Path.Combine(basePath, "hzwtitle.jpg"); //MediaId mId = WeUtil.UploadFile(MediaType.Image, path); string mediaId = WeDataUtil.GetMediaId(MediaType.Image, path); DataRow docRow = UpdateDocRow(docResolver, row, current, 4); msg.AddArticle(CreateArticle(docRow, mediaId)); detailResolver.SelectWithParam(string.Empty, "ORDER BY WMD_ORDER_NUM", "MassId", input.QueryString["MassId"]); DataTable childTable = detailResolver.HostTable; if (childTable != null) { foreach (DataRow childRow in childTable.Rows) { docRow = UpdateDocRow(docResolver, childRow, current, 2); path = Path.Combine(basePath, string.Format("A{0}.jpg", docRow["Catelog"])); mediaId = WeDataUtil.GetMediaId(MediaType.Image, path); msg.AddArticle(CreateArticle(docRow, mediaId)); } } UpdateUtil.UpdateTableResolvers(null, docResolver, massResolver); var media_Id = msg.UploadMessage(); var users = WeFanContainter.GetAllUsers(); var result = msg.Send(users); if (result > 0) { return(OutputData.Create("0")); } return(OutputData.Create("-1")); } }
internal static CorpTag FindTag(string id, out CorpTagList tagList) { tagList = WeDataUtil.GetCacheData <CorpTagList>(WeDataConst.CORP_TAG_NAME); CorpTag result = tagList.TagList[id]; TkDebug.AssertNotNull(result, string.Format(ObjectUtil.SysCulture, "数据有错误,无法找到Id为{0}的Tag", id), null); return(result); }
private static CorpDepartment FindDept(string id, out CorpDepartmentCollection deptList) { deptList = WeDataUtil.GetCacheData <CorpDepartmentCollection>(WeCorpConst.CORP_DEPT_NAME); CorpDepartment result = deptList.Department[id]; TkDebug.AssertNotNull(result, string.Format(ObjectUtil.SysCulture, "数据有错误,无法找到Id为{0}的Department", id), null); return(result); }
public OutputData Delete(IInputData input, string id) { CorpTagList tagList; var tag = FindTag(id, out tagList); tagList.TagList.Remove(tag); tag.Delete(); WeDataUtil.SaveData(WeDataConst.CORP_TAG_NAME, tagList); return(OutputData.CreateToolkitObject(new KeyData(tag))); }
public OutputData Delete(IInputData input, string id) { CorpDepartmentCollection deptList; var dept = FindDept(id, out deptList); deptList.Department.Remove(dept); dept.Delete(); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList); return(OutputData.CreateToolkitObject(new KeyData(dept))); }
public OutputData Insert(IInputData input, object instance) { CorpTagProxy tag = instance.Convert <CorpTagProxy>(); var tagList = WeDataUtil.GetCacheData <CorpTagList>(WeDataConst.CORP_TAG_NAME); var newTag = CorpTag.Create(tag.Name); tagList.TagList.Add(newTag); WeDataUtil.SaveData(WeDataConst.CORP_TAG_NAME, tagList); return(OutputData.CreateToolkitObject(new KeyData(newTag))); }
public OutputData Insert(IInputData input, object instance) { WeGroupProxy group = instance.Convert <WeGroupProxy>(); WeGroup newGroup = WeGroup.CreateGroup(group.Name); var groups = WeDataUtil.GetCacheData <WeGroupCollection>(WeDataConst.WEGROUP_NAME); groups.Groups.Add(newGroup); WeDataUtil.SaveData(WeDataConst.WEGROUP_NAME, groups); return(OutputData.CreateToolkitObject(new KeyData(newGroup))); }
public OutputData Update(IInputData input, object instance) { CorpTagProxy tag = instance.Convert <CorpTagProxy>(); CorpTagList tagList; var oldTag = FindTag(tag.Id, out tagList); oldTag.Name = tag.Name; oldTag.Update(); WeDataUtil.SaveData(WeDataConst.CORP_TAG_NAME, tagList); return(OutputData.CreateToolkitObject(new KeyData(oldTag))); }
public OutputData Update(IInputData input, object instance) { CorpDepartmentProxy dept = instance.Convert <CorpDepartmentProxy>(); CorpDepartmentCollection deptList; var oldDept = FindDept(dept.Id, out deptList); oldDept.Name = dept.Name; oldDept.Update(); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList); return(OutputData.CreateToolkitObject(new KeyData(oldDept))); }
public OutputData Insert(IInputData input, object instance) { CorpDepartmentProxy dept = instance.Convert <CorpDepartmentProxy>(); var deptList = WeDataUtil.GetCacheData <CorpDepartmentCollection>( WeCorpConst.CORP_DEPT_NAME); var lastNode = deptList.Department[deptList.Department.Count - 1]; var newDept = CorpDepartment.Create(dept.ParentId, dept.Name, lastNode.Id + 1); deptList.Department.Add(newDept); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList); return(OutputData.CreateToolkitObject(new KeyData(newDept))); }
public void Insert(ReceiveMessage message) { DataRow row = NewRow(); row.BeginEdit(); row["Id"] = Context.GetUniId(TableName); row["OpenId"] = message.FromUserName; row["CreateDate"] = DateTime.Now; row["Latitude"] = message.Latitude; row["Longitude"] = message.Longitude; row["Precision"] = message.Precision; row["CityCode"] = WeDataUtil.GetSXCode(Context, message.Latitude, message.Longitude); row.EndEdit(); SetCommands(AdapterCommand.Insert); UpdateDatabase(); }
public BaseSendMessage Reply(ReceiveMessage message) { using (EmptyDbDataSource source = WeDataUtil.CreateSource()) using (TableResolver resolver = new CorpAppLogResolver(source)) { resolver.SetCommands(AdapterCommand.Insert); DataRow row = resolver.NewRow(); row.BeginEdit(); row["LogId"] = resolver.CreateUniId(); row["AppId"] = message.AgentId; row["CreateDate"] = message.CreateTime; row["UserId"] = message.FromUserName; row.EndEdit(); resolver.UpdateDatabase(); } return(null); }
public BaseSendMessage Reply(ReceiveMessage message) { string fileName = FileUtil.GetRealFileName(FileName, Position); string mediaId; if (WeixinSettings.Current.Mode == WeixinMode.Normal) { mediaId = WeDataUtil.GetMediaId(Weixin.MediaType.Image, fileName); } else { mediaId = WeDataUtil.GetMediaId(message.AgentId, Weixin.MediaType.Image, fileName); } ImageSendMessage reply = new ImageSendMessage(message, mediaId); return(reply); }
public OutputData Update(IInputData input, object instance) { WeGroupProxy group = instance.Convert <WeGroupProxy>(); var groups = WeDataUtil.GetCacheData <WeGroupCollection>(WeDataConst.WEGROUP_NAME); var oldGroup = groups.Groups[group.Id]; if (oldGroup == null) { throw new WebPostException(string.Format(ObjectUtil.SysCulture, "提交数据有错误,无法找到Id为{0}的Group", group.Id)); } oldGroup.Name = group.Name; oldGroup.Update(); WeDataUtil.SaveData(WeDataConst.WEGROUP_NAME, groups); return(OutputData.CreateToolkitObject(new KeyData(oldGroup))); }
public BaseSendMessage Reply(ReceiveMessage message) { string fileName = FileUtil.GetRealFileName(ThumbMediaFileName, Position); string thumbMediaId; var md = WeUtil.UploadFile(Weixin.MediaType.Image, fileName); if (WeixinSettings.Current.Mode == WeixinMode.Normal) { thumbMediaId = WeDataUtil.GetMediaId(Weixin.MediaType.Image, fileName); } else { thumbMediaId = WeDataUtil.GetMediaId(message.AgentId, Weixin.MediaType.Image, fileName); } MusicSendMessage reply = new MusicSendMessage(message, thumbMediaId, Title, Description, MusicUrl, HQMusicUrl); return(reply); }
public object MoveUpDown(string nodeId, TreeNodeMoveDirection direction) { CorpDepartmentCollection depts = GetDepartments(); var node = depts.Department[nodeId]; var list = depts.GetChildren(node.ParentId).ToArray(); int index = Array.IndexOf(list, node); CorpDepartment swapNode = null; switch (direction) { case TreeNodeMoveDirection.Up: if (index == 0) { break; } swapNode = list[index - 1]; break; case TreeNodeMoveDirection.Down: if (index == list.Length - 1) { break; } swapNode = list[index + 1]; break; } if (swapNode != null) { node.VerifyOrder(); swapNode.VerifyOrder(); int swap = node.Order; node.Order = swapNode.Order; swapNode.Order = swap; node.Update(); swapNode.Update(); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, depts); } return(new KeyData("Id", nodeId)); }
public static void ProcessNormalUser(bool subscrible, string openId) { using (EmptyDbDataSource source = WeDataUtil.CreateSource()) using (UserResolver resolver = new UserResolver(source)) using (SubscribeDataResolver subResolver = new SubscribeDataResolver(source)) { subResolver.SetCommands(AdapterCommand.Insert); resolver.SetCommands(AdapterCommand.Insert | AdapterCommand.Update); DateTime current = DateTime.Now; DataRow row = resolver.TrySelectRowWithKeys(openId); if (row == null) { row = resolver.NewRow(); } if (subscrible) { WeUser user = WeUser.GetUser(openId); user.AddToDataRow(row); } else { row["Subscribe"] = 0; } DataRow subRow = subResolver.NewRow(); subRow.BeginEdit(); subRow["Id"] = subResolver.CreateUniId(); subRow["OpenId"] = openId; subRow["SubscribeDate"] = current; subRow["IsSubscribe"] = subscrible ? 1 : 0; subRow.EndEdit(); UpdateUtil.UpdateTableResolvers(source.Context, null, new TableResolver[] { resolver, subResolver }); } }
private static CorpDepartmentCollection GetDepartments() { return(WeDataUtil.GetCacheData <CorpDepartmentCollection>( WeCorpConst.CORP_DEPT_NAME)); }
public CorpDepartmentListObjectSource() { var depts = WeDataUtil.GetCacheData <CorpDepartmentCollection>(WeCorpConst.CORP_DEPT_NAME); fDepts = depts.Department; }
private static RegNameList <WeGroup> CreateList() { var list = WeDataUtil.GetCacheData <WeGroupCollection>(WeDataConst.WEGROUP_NAME); return(list.Groups); }
private static RegNameList <CorpTag> CreateList() { var list = WeDataUtil.GetCacheData <CorpTagList>(WeDataConst.CORP_TAG_NAME); return(list.TagList); }
public object Query(IInputData input, string id) { var groups = WeDataUtil.GetCacheData <WeGroupCollection>(WeDataConst.WEGROUP_NAME); return(groups.Groups[id]); }
public WeGroupListObjectSource() { var groups = WeDataUtil.GetCacheData<WeGroupCollection>(WeDataConst.WEGROUP_NAME); fGroups = groups.Groups; }
internal static RegNameList <CorpDepartment> CreateList() { var list = WeDataUtil.GetCacheData <CorpDepartmentCollection>(WeCorpConst.CORP_DEPT_NAME); return(list.Department); }
public CorpTagListObjectSource() { var tags = WeDataUtil.GetCacheData <CorpTagList>(WeDataConst.CORP_TAG_NAME); fTags = tags.TagList; }