Exemplo n.º 1
0
 private void AddCallContextAwaiter(IChannelId channelId, int rpcId, ICallContext callContext)
 {
     if (!CallContexts.TryGetValue(channelId, out ConcurrentDictionary <int, ICallContext> callContexts))
     {
         callContexts = new ConcurrentDictionary <int, ICallContext>();
         CallContexts.AddOrUpdate(channelId, callContexts, (k, v) => callContexts);
     }
     callContexts.AddOrUpdate(rpcId, callContext, (k, v) => callContext);
 }
Exemplo n.º 2
0
 private bool TryRemoveChannelCallContexts(IChannelHandlerContext context, out List <ICallContext> callContexts)
 {
     callContexts = null;
     if (CallContexts.TryRemove(context.Channel.Id, out ConcurrentDictionary <int, ICallContext> values))
     {
         callContexts = values.Values.ToList();
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        private ICallContext RemoveCallAwaiter(IChannelHandlerContext context, int rpcId)
        {
            if (!CallContexts.TryGetValue(context.Channel.Id, out ConcurrentDictionary <int, ICallContext> callContexts))
            {
                return(null);
            }

            callContexts.TryRemove(rpcId, out ICallContext callContext);
            return(callContext);
        }
 public void Delete(Element element)
 {
     using (var client = new STMTrackJobServiceClient())
     {
         client.ClientCredentials.Windows.ClientCredential.Domain   = UserAccount.Domain;
         client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username;
         client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password;
         client.delete(CallContexts.get(), Client.read(element.RecId));
     }
 }
        public IHttpActionResult Find(Element element)
        {
            List <TrackJob> trackList       = new List <TrackJob>();
            AxdSTMTrackJob  trackJob        = new AxdSTMTrackJob();
            CriteriaElement criteriaElement = new CriteriaElement();

            criteriaElement.DataSourceName = element.DataSourceName; // "STMTrackJobTable";
            criteriaElement.FieldName      = element.FieldName;      // "StmTrackId";
            criteriaElement.Operator       = Operator.Equal;
            criteriaElement.Value1         = element.Value;          // "TK000001";

            QueryCriteria criteria = new QueryCriteria();

            criteria.CriteriaElement = new CriteriaElement[] { criteriaElement };

            using (var client = new STMTrackJobServiceClient())
            {
                client.ClientCredentials.Windows.ClientCredential.Domain   = UserAccount.Domain;
                client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username;
                client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password;
                trackJob = client.find(CallContexts.get(), criteria);
            }

            for (int i = 0; i < trackJob.STMTrackJobTable.Length; i++)
            {
                string bu       = Enum.GetName(typeof(AxdEnum_STMMBU), trackJob.STMTrackJobTable[i].STMMBU);
                string typeroom = Enum.GetName(typeof(AxdEnum_STMTypeRoomJIS), trackJob.STMTrackJobTable[i].STMTypeRoom);
                string status   = Enum.GetName(typeof(AxdEnum_STMTrackStatus), trackJob.STMTrackJobTable[i].STMTrackStatus);

                trackList.Add(new TrackJob
                {
                    RecId       = trackJob.STMTrackJobTable[i].RecId.ToString(),
                    TrackId     = trackJob.STMTrackJobTable[i].StmTrackId == null ? "" : trackJob.STMTrackJobTable[i].StmTrackId.ToString(),
                    BU          = bu,
                    CreateDate  = Convert.ToDateTime(trackJob.STMTrackJobTable[i].CreatedDate),
                    FinishDate  = Convert.ToDateTime(trackJob.STMTrackJobTable[i].FinishDate),
                    Name        = trackJob.STMTrackJobTable[i].Name == null ? "" : trackJob.STMTrackJobTable[i].Name.ToString(),
                    ProjId      = trackJob.STMTrackJobTable[i].ProjId == null ? "" : trackJob.STMTrackJobTable[i].ProjId.ToString(),
                    RefTrackId  = trackJob.STMTrackJobTable[i].RefTrackId == null ? "" : trackJob.STMTrackJobTable[i].RefTrackId.ToString(),
                    Stage       = trackJob.STMTrackJobTable[i].ProjStage == null ? "" : trackJob.STMTrackJobTable[i].ProjStage.ToString(),
                    StartDate   = Convert.ToDateTime(trackJob.STMTrackJobTable[i].StartDate),
                    TypeRoom    = typeroom,
                    Unit        = Convert.ToInt32(trackJob.STMTrackJobTable[i].Unit),
                    ProjAmount  = Convert.ToDouble(trackJob.STMTrackJobTable[i].ProjAmount),
                    TrackStatus = status
                });
            }

            return(Json(trackList));
        }
        public void Create(TrackJob element)
        {
            using (var client = new STMTrackJobServiceClient())
            {
                string startDate  = element.StartDate.ToShortDateString();
                string finishDate = element.FinishDate.ToShortDateString();
                string createDate = element.CreateDate.ToShortDateString();

                AxdEntity_STMTrackJobTable entity = new AxdEntity_STMTrackJobTable();
                entity._DocumentHash  = entity._DocumentHash;
                entity.RecId          = Convert.ToInt64(element.RecId);
                entity.RecIdSpecified = true;
                entity.RefTrackId     = element.RefTrackId;
                entity.Name           = element.Name;
                entity.ProjId         = element.ProjId;
                entity.ProjStage      = element.Stage;
                entity.STMMBU         = (AxdEnum_STMMBU)Enum.Parse(typeof(AxdEnum_STMMBU), element.BU);
                entity.StmTrackId     = element.TrackId;
                entity.STMTypeRoom    = (AxdEnum_STMTypeRoomJIS)Enum.Parse(typeof(AxdEnum_STMTypeRoomJIS), element.TypeRoom);
                entity.ProjAmount     = Convert.ToDecimal(element.ProjAmount);
                entity.STMTrackStatus = (AxdEnum_STMTrackStatus)Enum.Parse(typeof(AxdEnum_STMTrackStatus), element.TrackStatus);
                if (startDate != "01/01/1900" && startDate != "01/01/0544")//(soDaily.DueDate != DateTime.MinValue)
                {
                    entity.StartDate = DateTime.ParseExact(startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (finishDate != "01/01/1900" && finishDate != "01/01/0544")//(soDaily.DueDate != DateTime.MinValue)
                {
                    entity.FinishDate = DateTime.ParseExact(finishDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (createDate != "01/01/1900" && createDate != "01/01/0544")//(soDaily.DueDate != DateTime.MinValue)
                {
                    entity.CreatedDate = DateTime.ParseExact(createDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }

                var trackJob = new AxdSTMTrackJob()
                {
                    STMTrackJobTable = new AxdEntity_STMTrackJobTable[1] {
                        entity
                    }
                };

                client.ClientCredentials.Windows.ClientCredential.Domain   = UserAccount.Domain;
                client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username;
                client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password;
                client.create(CallContexts.get(), trackJob);
            }
        }
        public void Edit(TrackJob element)
        {
            AxdSTMTrackJob trackJob = new AxdSTMTrackJob();

            using (var client = new STMTrackJobServiceClient())
            {
                client.ClientCredentials.Windows.ClientCredential.Domain   = UserAccount.Domain;
                client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username;
                client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password;
                trackJob = client.read(CallContexts.get(), Client.read(element.RecId));
            }

            using (var client = new STMTrackJobServiceClient())
            {
                AxdEntity_STMTrackJobTable entity = trackJob.STMTrackJobTable[0];
                var trackJobQry = new AxdSTMTrackJob()
                {
                    ClearNilFieldsOnUpdate          = trackJob.ClearNilFieldsOnUpdate,
                    ClearNilFieldsOnUpdateSpecified = true,
                    DocPurpose          = trackJob.DocPurpose,
                    DocPurposeSpecified = true,
                    SenderId            = trackJob.SenderId
                };

                string startDate  = element.StartDate.ToShortDateString();
                string finishDate = element.FinishDate.ToShortDateString();
                string createDate = element.CreateDate.ToShortDateString();

                AxdEntity_STMTrackJobTable entityUpdate = new AxdEntity_STMTrackJobTable();
                entityUpdate._DocumentHash  = entity._DocumentHash;
                entityUpdate.RecId          = Convert.ToInt64(element.RecId);
                entityUpdate.RecIdSpecified = true;
                entityUpdate.RefTrackId     = "";
                entityUpdate.Name           = element.Name;
                entityUpdate.ProjId         = element.ProjId;
                entityUpdate.ProjStage      = element.Stage;
                entityUpdate.STMMBU         = (AxdEnum_STMMBU)Enum.Parse(typeof(AxdEnum_STMMBU), element.BU);
                entityUpdate.StmTrackId     = element.TrackId;
                entityUpdate.STMTypeRoom    = (AxdEnum_STMTypeRoomJIS)Enum.Parse(typeof(AxdEnum_STMTypeRoomJIS), element.TypeRoom);
                entityUpdate.ProjAmount     = Convert.ToDecimal(element.ProjAmount);
                entityUpdate.STMTrackStatus = (AxdEnum_STMTrackStatus)Enum.Parse(typeof(AxdEnum_STMTrackStatus), element.TrackStatus);
                if (startDate != "01/01/1900" && startDate != "01/01/0544")//(soDaily.DueDate != DateTime.MinValue)
                {
                    entityUpdate.StartDate = DateTime.ParseExact(startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (finishDate != "01/01/1900" && finishDate != "01/01/0544")//(soDaily.DueDate != DateTime.MinValue)
                {
                    entityUpdate.FinishDate = DateTime.ParseExact(finishDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                if (createDate != "01/01/1900" && createDate != "01/01/0544")//(soDaily.DueDate != DateTime.MinValue)
                {
                    entityUpdate.CreatedDate = DateTime.ParseExact(createDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }

                trackJobQry.STMTrackJobTable = new AxdEntity_STMTrackJobTable[1] {
                    entityUpdate
                };

                client.ClientCredentials.Windows.ClientCredential.Domain   = UserAccount.Domain;
                client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username;
                client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password;
                client.update(CallContexts.get(), Client.read(element.RecId), trackJobQry);
            }
        }