Ejemplo n.º 1
0
 /// <summary>
 /// 返回sql数据库列表
 /// </summary>
 /// <param name="provider"></param>
 /// <param name="cn"></param>
 /// <param name="dataSource"></param>
 /// <param name="user"></param>
 /// <param name="pwd"></param>
 /// <returns></returns>
 public static JArray GetSqlServerDBList(string dataSource, string user, string pwd)
 {
     try
     {
         string conStr = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", dataSource, "master", user, pwd);
         using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(conStr))
         {
             con.Open();
             using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand())
             {
                 cmd.Connection  = con;
                 cmd.CommandText = @"select name from master..sysdatabases";
                 using (YZReader reader = new YZReader(cmd.ExecuteReader()))
                 {
                     JArray array = new JArray();
                     while (reader.Read())
                     {
                         JObject obj = new JObject();
                         obj["text"]  = reader.ReadString("name");
                         obj["value"] = reader.ReadString("name");
                         array.Add(obj);
                     }
                     return(array);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw new BPMException(BPMExceptionType.DBLoadDataErr, "sysdatabases", ex.Message);
     }
 }
Ejemplo n.º 2
0
 public ServiceContacts(YZReader reader)
 {
     this.Product       = reader.ReadString("Product");
     this.ServiceCenter = reader.ReadString("ServiceCenter");
     this.Description   = reader.ReadString("Description");
     this.Tel           = reader.ReadString("Tel");
     this.OrderIndex    = reader.ReadInt32("OrderIndex");
 }
Ejemplo n.º 3
0
 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");
 }
Ejemplo n.º 4
0
 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");
 }
Ejemplo n.º 5
0
 public SpriteLink(YZReader reader)
 {
     this.FileID           = reader.ReadString("FileID");
     this.SpriteID         = reader.ReadString("SpriteID");
     this.LinkType         = reader.ReadEnum <ReferenceType>("LinkType", ReferenceType.SpriteToSprite);
     this.LinkedFileID     = reader.ReadString("LinkedFileID");
     this.LinkedSpriteID   = reader.ReadString("LinkedSpriteID");
     this.LinkedByProperty = reader.ReadString("LinkedByProperty");
 }
Ejemplo n.º 6
0
 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");
 }
Ejemplo n.º 7
0
Archivo: SMS.cs Proyecto: radtek/EMIP
 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");
 }
Ejemplo n.º 8
0
 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");
 }
Ejemplo n.º 9
0
 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");
 }
Ejemplo n.º 10
0
 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");
 }
Ejemplo n.º 11
0
 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");
 }
Ejemplo n.º 12
0
        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");
        }
Ejemplo n.º 13
0
        public Member(IDataReader reader)
        {
            YZReader dbr = new YZReader(reader);

            this.ItemID  = dbr.ReadInt32("ItemID");
            this.GroupID = dbr.ReadInt32("GroupID");
            this.UID     = dbr.ReadString("UID");
            this.Role    = dbr.ReadString("Role");

            if (String.IsNullOrEmpty(this.Role))
            {
                this.Role = "Guest";
            }
        }
Ejemplo n.º 14
0
Archivo: File.cs Proyecto: radtek/EMIP
 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");
 }
Ejemplo n.º 15
0
 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");
 }
Ejemplo n.º 16
0
        private static ConnectInfo ReaderToEntity(YZReader reader)
        {
            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);
            return(connect);
        }
Ejemplo n.º 17
0
        public JArray GetFactorys(IDbConnection cn)
        {
            JArray factorys = new JArray();

            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection  = cn as SqlConnection;
                cmd.CommandText = "SELECT * FROM iSYSFactory";

                using (YZReader reader = new YZReader(cmd.ExecuteReader()))
                {
                    while (reader.Read())
                    {
                        JObject factory = new JObject();
                        factorys.Add(factory);

                        factory["ID"]   = reader.ReadInt32("ID");
                        factory["Name"] = reader.ReadString("Name");
                        factory["MapX"] = reader.ReadInt32("MapX");
                        factory["MapY"] = reader.ReadInt32("MapY");
                    }
                }
            }
            return(factorys);
        }
Ejemplo n.º 18
0
        protected static object RenderLeaveType(string fieldXClass, object value)
        {
            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    using (IDbCommand cmd = cn.CreateCommand())
                    {
                        IDbDataParameter pmTypeCode = provider.CreateParameter("TypeCode", value, true);
                        cmd.CommandText = String.Format("select * from YZMDLeavingType WHERE TypeCode={0}", pmTypeCode.ParameterName);
                        cmd.Parameters.Add(pmTypeCode);

                        using (YZReader reader = new YZReader(cmd.ExecuteReader()))
                        {
                            if (reader.Read())
                            {
                                return(reader.ReadString("Name"));
                            }
                            else
                            {
                                return(value);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 19
0
    public JsonItemCollection GetFactorys(IDbConnection cn)
    {
        JsonItemCollection factorys = new JsonItemCollection();

        using (SqlCommand cmd = new SqlCommand())
        {
            cmd.Connection  = cn as SqlConnection;
            cmd.CommandText = "SELECT * FROM iSYSFactory";

            using (YZReader reader = new YZReader(cmd.ExecuteReader()))
            {
                while (reader.Read())
                {
                    JsonItem factory = new JsonItem();
                    factorys.Add(factory);

                    factory.Attributes["ID"]   = reader.ReadInt32("ID");
                    factory.Attributes["Name"] = reader.ReadString("Name");
                    factory.Attributes["MapX"] = reader.ReadInt32("MapX");
                    factory.Attributes["MapY"] = reader.ReadInt32("MapY");
                }
            }
        }
        return(factorys);
    }
Ejemplo n.º 20
0
        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");
        }
Ejemplo n.º 21
0
        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);
        }
Ejemplo n.º 22
0
 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");
 }
Ejemplo n.º 23
0
 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");
 }
Ejemplo n.º 24
0
 public static BPMObjectNameCollection GetNotifyUsersTaskSocial(IYZDbProvider provider, IDbConnection cn, int taskid)
 {
     try
     {
         BPMObjectNameCollection uids = new BPMObjectNameCollection();
         using (YZReader reader = new YZReader(provider.GetNotifyUsersTaskSocial(cn, taskid)))
         {
             while (reader.Read())
             {
                 uids.Add(reader.ReadString(0));
             }
             return(uids);
         }
     }
     catch (Exception e)
     {
         throw new BPMException(BPMExceptionType.DBLoadDataErr, "BPMInstProcSteps", e.Message);
     }
 }
Ejemplo n.º 25
0
 public static BPMObjectNameCollection GetUidsFromRegisterId(IYZDbProvider provider, IDbConnection cn, string registerId)
 {
     try
     {
         BPMObjectNameCollection uids = new BPMObjectNameCollection();
         using (YZReader reader = new YZReader(provider.GetUidsFromPushNotificationRegisterId(cn, registerId)))
         {
             while (reader.Read())
             {
                 uids.Add(reader.ReadString(0));
             }
             return(uids);
         }
     }
     catch (Exception e)
     {
         throw new BPMException(BPMExceptionType.DBLoadDataErr, "BPMSysUserCommonInfo", e.Message);
     }
 }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
 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");
 }
Ejemplo n.º 28
0
 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");
 }
Ejemplo n.º 29
0
        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());
            }
        }
Ejemplo n.º 30
0
 public SpriteIdentity(YZReader reader)
 {
     this.FileID   = reader.ReadString("FileID");
     this.SpriteID = reader.ReadString("SpriteID");
     this.Name     = reader.ReadString("Name");
 }