Example #1
0
        /// <summary> 操作数据
        /// </summary>
        /// <param name="dt">数据表</param>
        /// <param name="operation">操作类别</param>
        /// <param name="dbName">帐套</param>
        private static void Operation(DataTable dt, string operation, string dbName)
        {
            if (dt == null)
            {
                return;
            }
            string path = string.Empty;

            foreach (DataRow dr in dt.Rows)
            {
                FileProtocol protocol = GetProtocol(dr, dbName);
                if (protocol != null)
                {
                    protocol.Operation = operation;
                    if (operation == DataSources.EnumOperationType.Add.ToString("d") ||
                        operation == DataSources.EnumOperationType.Update.ToString("d"))
                    {
                        FileModel file = FileModel.CreateModel(dr);
                        protocol.FileId   = file.Id;
                        protocol.FileType = file.FileType;

                        path = GlobalStaticObj_Server.Instance.FilePath + "\\" + file.Path;
                        //上传文件信息
                        byte[] files = FileHelper.GetFileInByte(path);
                        if (files == null)
                        {
                            continue;
                        }
                        protocol.File = ProtocolTranslator.ByteToHex(files);
                    }
                    FileAgent.AddSendQueue(protocol);
                }
            }
        }