private static SourceInfo ReaderToEntity(YZReader reader) { reader.Read(); SourceInfo source = new SourceInfo(); source.sourceId = reader.ReadInt32("sourceId"); source.sourceName = reader.ReadString("sourceName"); source.sourceType = reader.ReadEnum <SourceTypeEnum>("connectType", SourceTypeEnum.NoType); source.sourceStr = reader.ReadString("sourceStr"); source.caption = reader.ReadString("caption"); source.createTime = reader.ReadDateTime("createTime"); source.updateTime = reader.ReadDateTime("updateTime"); source.isvalid = reader.ReadBool("isvalid", false); ConnectInfo connect = new ConnectInfo(); connect.connectId = reader.ReadInt32("connectId"); connect.connectName = reader.ReadString("connectName"); connect.connectType = reader.ReadEnum <SourceTypeEnum>("connectType", SourceTypeEnum.NoType); connect.caption = reader.ReadString("caption"); connect.connectStr = reader.ReadString("connectStr"); connect.createTime = reader.ReadDateTime("createTime"); connect.updateTime = reader.ReadDateTime("updateTime"); connect.isvalid = reader.ReadBool("isvalid", false); source.connectInfo = connect; return(source); }
public SMS(YZReader reader) { this.ItemGUID = reader.ReadString("ItemGUID"); this.IDDCode = reader.ReadString("IDDCode"); this.PhoneNumber = reader.ReadString("PhoneNumber"); this.ValidationCode = reader.ReadString("ValidationCode"); this.ExpireDate = reader.ReadDateTime("ExpireDate"); this.CreateDate = reader.ReadDateTime("CreateDate"); this.CreateBy = reader.ReadString("CreateBy"); }
public Device(YZReader reader) { this.Account = reader.ReadString("Account"); this.UUID = reader.ReadString("UUID"); this.Name = reader.ReadString("Name"); this.Model = reader.ReadString("Model"); this.Description = reader.ReadString("Description"); this.Disabled = reader.ReadBool("Disabled", false); this.RegisterAt = reader.ReadDateTime("RegisterAt"); this.LastLogin = reader.ReadDateTime("LastLogin"); }
public Cash(YZReader reader) { this.ItemID = reader.ReadInt32("ItemID"); this.Account = reader.ReadString("Account"); this.Type = reader.ReadString("Type"); this.Date = reader.ReadDateTime("Date"); this.Amount = reader.ReadDecimal("Amount"); this.Invoice = reader.ReadString("Invoice"); this.Comments = reader.ReadString("Comments"); this.CreateAt = reader.ReadDateTime("CreateAt"); }
public Group(YZReader reader) { this.GroupID = reader.ReadInt32("GroupID"); this.GroupType = reader.ReadString("GroupType"); this.Name = reader.ReadString("Name"); this.Desc = reader.ReadString("Desc"); this.DocumentFolderID = reader.ReadInt32("DocumentFolderID"); this.FolderID = reader.ReadInt32("FolderID"); this.Owner = reader.ReadString("Owner"); this.CreateAt = reader.ReadDateTime("CreateAt"); this.ImageFileID = reader.ReadString("ImageFileID"); this.Deleted = reader.ReadBool("Deleted", false); this.DeleteBy = reader.ReadString("DeleteBy"); this.DeleteAt = reader.ReadDateTime("DeleteAt"); }
public WeeklyReport(YZReader reader) { this.IsEmpty = false; this.ItemID = reader.ReadInt32("ItemID"); this.TaskID = reader.ReadInt32("TaskID"); this.Account = reader.ReadString("Account"); this.Date = reader.ReadDateTime("Date"); this.Done = reader.ReadString("Done"); this.Undone = reader.ReadString("Undone"); this.Coordinate = reader.ReadString("Coordinate"); this.Done = reader.ReadString("Done"); this.Pics = reader.ReadString("Pics"); this.Attachments = reader.ReadString("Attachments"); this.CreateAt = reader.ReadDateTime("CreateAt"); }
public File(YZReader reader) { this.ID = reader.ReadInt32("ID"); this.FolderID = reader.ReadInt32("FolderID"); this.FileID = reader.ReadString("FileID"); this.AddBy = reader.ReadString("AddBy"); this.AddAt = reader.ReadDateTime("AddAt"); this.Comments = reader.ReadString("Comments"); this.Deleted = reader.ReadBool("Deleted", false); this.DeleteBy = reader.ReadString("DeleteBy"); this.DeleteAt = reader.ReadDateTime("DeleteAt"); this.Recyclebin = reader.ReadBool("Recyclebin", false); this.Flag = reader.ReadString("Flag"); this.OrderIndex = reader.ReadInt32("OrderIndex"); }
public Folder(YZReader reader) { this.FolderID = reader.ReadInt32("FolderID"); this.RootID = reader.ReadInt32("RootID"); this.ParentID = reader.ReadInt32("ParentID"); this.FolderType = reader.ReadString("FolderType"); this.Name = reader.ReadString("Name"); this.Desc = reader.ReadString("Desc"); this.Owner = reader.ReadString("Owner"); this.CreateAt = reader.ReadDateTime("CreateAt"); this.Deleted = reader.ReadBool("Deleted", false); this.DeleteBy = reader.ReadString("DeleteBy"); this.DeleteAt = reader.ReadDateTime("DeleteAt"); this.OrderIndex = reader.ReadInt32("OrderIndex"); }
public Library(YZReader reader) { this.LibID = reader.ReadInt32("LibID"); this.LibType = reader.ReadString("LibType"); this.Name = reader.ReadString("Name"); this.Desc = reader.ReadString("Desc"); this.DocumentFolderID = reader.ReadInt32("DocumentFolderID"); this.FolderID = reader.ReadInt32("FolderID"); this.Owner = reader.ReadString("Owner"); this.CreateAt = reader.ReadDateTime("CreateAt"); this.ImageFileID = reader.ReadString("ImageFileID"); this.Deleted = reader.ReadBool("Deleted", false); this.DeleteBy = reader.ReadString("DeleteBy"); this.DeleteAt = reader.ReadDateTime("DeleteAt"); this.OrderIndex = reader.ReadInt32("OrderIndex"); }
public Favorite(YZReader reader) { this.uid = reader.ReadString("uid"); this.resType = (YZResourceType)reader.ReadEnum("resType", typeof(YZResourceType), YZResourceType.Process); this.resId = reader.ReadString("resId"); this.date = reader.ReadDateTime("date"); this.comments = reader.ReadString("comments"); this.orderIndex = reader.ReadInt32("orderIndex"); }
public YZMessage(YZReader reader) { this.id = reader.ReadInt32("id"); this.uid = reader.ReadString("uid"); this.date = reader.ReadDateTime("date"); this.resType = (YZResourceType)reader.ReadEnum("resType", typeof(YZResourceType), YZResourceType.Task); this.resId = reader.ReadString("resId"); this.message = reader.ReadString("message"); }
public YZMessageVote(IDataReader reader) { YZReader dbr = new YZReader(reader); this.id = dbr.ReadInt32("id"); this.messageid = dbr.ReadInt32("messageid"); this.uid = dbr.ReadString("uid"); this.date = dbr.ReadDateTime("date"); }
public Speak(YZReader reader) { this.ItemID = reader.ReadInt32("ItemID"); this.Account = reader.ReadString("Account"); this.FileID = reader.ReadString("FileID"); this.Duration = reader.ReadInt32("Duration"); this.Comments = reader.ReadString("Comments"); this.CreateAt = reader.ReadDateTime("CreateAt"); }
public Barcode(YZReader reader) { this.ItemID = reader.ReadInt32("ItemID"); this.Account = reader.ReadString("Account"); this.BarcodeValue = reader.ReadString("Barcode"); this.Format = reader.ReadString("Format"); this.ProductName = reader.ReadString("ProductName"); this.Comments = reader.ReadString("Comments"); this.CreateAt = reader.ReadDateTime("CreateAt"); }
private static ConnectInfoCollection ReaderToEntityList(YZReader reader) { ConnectInfoCollection rv = new ConnectInfoCollection(); while (reader.Read()) { ConnectInfo connect = new ConnectInfo(); connect.connectId = reader.ReadInt32("connectId"); connect.connectName = reader.ReadString("connectName"); connect.connectType = reader.ReadEnum <SourceTypeEnum>("connectType", SourceTypeEnum.NoType); connect.caption = reader.ReadString("caption"); connect.connectStr = reader.ReadString("connectStr"); connect.createTime = reader.ReadDateTime("createTime"); connect.updateTime = reader.ReadDateTime("updateTime"); connect.isvalid = reader.ReadBool("isvalid", false); rv.Add(connect); } return(rv); }
public P2PGroup(YZReader reader) { this.GroupID = reader.ReadInt32("GroupID"); this.Account1 = reader.ReadString("Account1"); this.Account2 = reader.ReadString("Account2"); this.UserName1 = reader.ReadString("UserName1"); this.UserName2 = reader.ReadString("UserName2"); this.FolderID = reader.ReadInt32("FolderID"); this.CreateBy = reader.ReadString("CreateBy"); this.CreateAt = reader.ReadDateTime("CreateAt"); }
public YZMessage(IDataReader reader) { YZReader dbr = new YZReader(reader); this.id = dbr.ReadInt32("id"); this.replyto = dbr.ReadInt32("replyto"); this.uid = dbr.ReadString("uid"); this.date = dbr.ReadDateTime("date"); this.resType = (YZResourceType)dbr.ReadEnum("resType", typeof(YZResourceType), YZResourceType.Task); this.resId = dbr.ReadString("resId"); this.message = dbr.ReadString("message"); this.duration = dbr.ReadInt32("duration"); }
public Footmark(YZReader reader) : this() { this.ItemID = reader.ReadInt32("ItemID"); this.Account = reader.ReadString("Account"); this.Time = reader.ReadDateTime("Time"); this.Position.RawLat = reader.ReadFloat("RawLat"); this.Position.RawLon = reader.ReadFloat("RawLon"); this.Position.Lat = reader.ReadFloat("Lat"); this.Position.Lon = reader.ReadFloat("Lon"); this.Position.Id = reader.ReadString("LocId"); this.Position.Name = reader.ReadString("LocName"); this.Position.Address = reader.ReadString("LocAddress"); this.Contact = reader.ReadString("Contact"); this.Comments = reader.ReadString("Comments"); this.Attachments = reader.ReadString("Attachments"); }
public virtual JArray GetDeletedObjects(HttpContext context) { YZRequest request = new YZRequest(context); BPMObjectNameCollection libTypes = BPMObjectNameCollection.FromStringList(request.GetString("libTypes"), ','); string uid = YZAuthHelper.LoginUserAccount; JArray rv = new JArray(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { using (YZReader reader = new YZReader(provider.GetDeletedObjects(cn, libTypes, uid))) { while (reader.Read()) { JObject jItem = new JObject(); rv.Add(jItem); jItem["LibID"] = reader.ReadInt32("LibID"); jItem["LibType"] = reader.ReadString("LibType"); jItem["LibName"] = reader.ReadString("LibName"); jItem["LibDesc"] = reader.ReadString("LibDesc"); jItem["DeleteBy"] = reader.ReadString("DeleteBy"); jItem["DeleteAt"] = reader.ReadDateTime("DeleteAt"); jItem["Path"] = reader.ReadString("Path"); jItem["FolderID"] = reader.ReadInt32("FolderID"); jItem["Name"] = reader.ReadString("Name"); jItem["ID"] = reader.ReadInt32("ID"); jItem["FileID"] = reader.ReadString("FileID"); jItem["Ext"] = reader.ReadString("Ext"); jItem["Size"] = reader.ReadInt32("Size"); jItem["ObjectID"] = (int)jItem["ID"] == -1 ? String.Format("Folder-{0}", jItem["FolderID"]) : String.Format("File-{0}", jItem["ID"]); } } } } return(rv); }
public void ProcessRequest(HttpContext context) { try { YZAuthHelper.OAuth(); //YZAuthHelper.AshxAuthCheck(); string loginUid = YZAuthHelper.LoginUserAccount; IDBProvider dbProvider = YZDBProviderManager.CurrentProvider; string method = context.Request.Params["method"]; JsonItem rv = new JsonItem(); // System.Threading.Thread.Sleep(2000); if (method == "Send") { //http://oauth.skyworthdigital.com/WebService/Iservice/Communication.ashx?UserAccount=SDT12872&restype=1&message=添加一条哦啊讨论啊&resId=216928&method=Send YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), context.Request.Params["resType"], true); string resId = context.Request.Params["resId"]; string msg = context.Request.Params["message"]; if (!string.IsNullOrEmpty(msg.Trim())) { using (IDbConnection cn = dbProvider.OpenConnection()) { YZMessage message = new YZMessage(loginUid, DateTime.Now, resType, resId, msg); message.Insert(cn); YZCommunicationManager.UpdateReaded(cn, loginUid, resType, resId, message.id); JsonItem result = new JsonItem(); rv.Attributes.Add("message", result); message.Serialize(result); } } } else if (method == "GetTaskCommunicationList") { GridPageInfo gridPageInfo = new GridPageInfo(context); SecurityToken token = null; using (BPMConnection bpmcn = new BPMConnection()) { bpmcn.WebOpen(); token = bpmcn.Token; } using (IDbConnection cn = dbProvider.OpenConnection()) { //http://oauth.skyworthdigital.com/WebService/Iservice/Communication.ashx?UserAccount=SDT12872&method=GetTaskCommunicationList&SearchType=QuickSearch&Keyword=216928 //http://oauth.skyworthdigital.com/WebService/Iservice/Communication.ashx?UserAccount=SDT12872&method=GetTaskCommunicationList&SearchType=QuickSearch&Keyword=REQ2014090001 using (BPMConnection bpmcn = new BPMConnection()) { bpmcn.WebOpen(); IDbCommand cmd = dbProvider.GetTaskCommunicationListCommand(cn, loginUid, token.SIDs, dbProvider.FilterStringCommunicationListTaskTableFilter, dbProvider.FilterStringCommunicationMessageTableFilter, gridPageInfo.Start, gridPageInfo.Limit); cmd.Connection = cn; JsonItemCollection children = new JsonItemCollection(); rv.Attributes.Add("children", children); using (YZReader reader = new YZReader(cmd.ExecuteReader())) { while (reader.Read()) { JsonItem item = new JsonItem(); children.Add(item); string ownerAccount = reader.ReadString("OwnerAccount"); User owner = User.TryGetUser(bpmcn, ownerAccount); string ownerDisplayName = owner != null ? owner.DisplayName : ownerAccount; string lastMsgUid = reader.ReadString("uid"); User lastMsgUser = User.TryGetUser(bpmcn, lastMsgUid); string lastMessageUserShortName = lastMsgUser != null ? lastMsgUser.ShortName : lastMsgUid; TaskState state = (TaskState)reader.ReadEnum("State", typeof(TaskState), TaskState.Unknow); int taskid = reader.ReadInt32("TaskID"); item.Attributes["tid"] = taskid; item.Attributes["sn"] = reader.ReadString("SerialNum"); item.Attributes["pn"] = reader.ReadString("ProcessName"); item.Attributes["user"] = YZStringHelper.GetUserShortName(ownerAccount, ownerDisplayName); item.Attributes["state"] = state.ToString(); item.Attributes["stateText"] = YZStringHelper.GetTaskStateDisplayString(bpmcn, state, taskid); item.Attributes["date"] = YZStringHelper.DateToStringL(reader.ReadDateTime("CreateAt")); string desc = Convert.ToString(reader.ReadString("Description")); item.Attributes["desc"] = String.IsNullOrEmpty(desc) ? "无内容摘要" : desc.CutStrHTML(isHTML: true); item.Attributes["count"] = reader.ReadInt32("count"); item.Attributes["total"] = reader.ReadInt32("total"); item.Attributes["Id"] = reader.ReadInt32("Id"); item.Attributes["lastMessageId"] = reader.ReadInt32("lastMsgId"); item.Attributes["lastMessageUid"] = lastMsgUid; item.Attributes["lastMessageUserShortName"] = lastMessageUserShortName; item.Attributes["lastMessageDate"] = YZStringHelper.DateToStringL(reader.ReadDateTime("date")); item.Attributes["lastMessage"] = reader.ReadString("message"); } } } rv.Attributes["newMessageCount"] = dbProvider.GetTaskCommunicationNewMessageCount(cn, loginUid, token.SIDs); } } else if (method == "GetBadge") { YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), context.Request.Params["resType"], true); string resId = context.Request.Params["resId"]; using (IDbConnection cn = dbProvider.OpenConnection()) { rv.Attributes["total"] = YZCommunicationManager.GetMessageCount(cn, resType, resId); rv.Attributes["newMessageCount"] = YZCommunicationManager.GetNewMessageCount(cn, loginUid, resType, resId); } } else if (method == "UpdateReaded") { YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), context.Request.Params["resType"], true); string resId = context.Request.Params["resId"]; string strLastId = context.Request.Params["lastid"]; if (String.IsNullOrEmpty(strLastId)) { strLastId = "-1"; } int lastId = Convert.ToInt32(strLastId); using (IDbConnection cn = dbProvider.OpenConnection()) { YZCommunicationManager.UpdateReaded(cn, loginUid, resType, resId, lastId); } } else { //http://bpm.sdt.com/YZSoft/Forms/XForm/%E5%B7%A5%E4%BD%9C%E6%8A%A5%E5%91%8A/%E5%B7%A5%E4%BD%9C%E6%8A%A5%E5%91%8A.aspx?tid=216928 //http://oauth.skyworthdigital.com/WebService/Iservice/Communication.ashx?UserAccount=SDT12872&restype=1&lastid=306&resId=216928 YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), context.Request.Params["resType"], true); string resId = context.Request.Params["resId"]; string strLastId = context.Request.Params["lastid"]; if (String.IsNullOrEmpty(strLastId)) { strLastId = "-1"; } int lastId = Convert.ToInt32(strLastId); //获得数据 JsonItemCollection children = new JsonItemCollection(); rv.Attributes.Add("children", children); using (BPMConnection bpmcn = new BPMConnection()) { bpmcn.WebOpen(); using (IDbConnection cn = dbProvider.OpenConnection()) { YZMessageCollection messages = YZCommunicationManager.GetNewMessages(cn, resType, resId, lastId); messages.Serialize(bpmcn, children); } } } //输出数据 context.Response.AppendHeader("Access-Control-Allow-Origin", "*"); // 响应类型 context.Response.AppendHeader("Access-Control-Allow-Methods", "POST"); // 响应头设置 context.Response.AppendHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); context.Response.Charset = "gb2312"; //设置字符集类型 context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); context.Response.ContentType = "application/json;charset=gb2312"; //输出数据 rv.Attributes.Add("success", true); context.Response.Write(rv.ToString()); } catch (Exception e) { JsonItem rv = new JsonItem(); context.Response.AppendHeader("Access-Control-Allow-Origin", "*"); // 响应类型 context.Response.AppendHeader("Access-Control-Allow-Methods", "POST"); // 响应头设置 context.Response.AppendHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); context.Response.Charset = "gb2312"; //设置字符集类型 context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); context.Response.ContentType = "application/json;charset=gb2312"; rv.Attributes.Add("success", false); rv.Attributes.Add("errorMessage", e.Message); context.Response.Write(rv.ToString()); } }
public static DateTime ReadDateTime(IDataReader reader, int index) { YZReader dbr = new YZReader(reader); return(dbr.ReadDateTime(index)); }