Ejemplo n.º 1
0
 public void Dispose()
 {
     lock (s_ServiceLocker)
     {
         lock (s_ServiceLocker)
         {
             m_callback = null;
             GC.Collect();
             GC.WaitForPendingFinalizers();
         }
     }
     m_callback = null;
 }
Ejemplo n.º 2
0
 public void Verify(string userName, string verificationCode)
 {
     lock (s_ServiceLocker)
     {
         try
         {
             //获得回调接口实例
             ITraceServiceCallback callback = OperationContext.Current.GetCallbackChannel <ITraceServiceCallback>();
             if (!Verify(verificationCode))
             {
                 callback.CloseSession();
             }
             else
             {
                 m_callback = callback;
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Ejemplo n.º 3
0
        public bool Excute(SuperControl.ServiceModel.ExcuteAction[] actions)
        {
            bool issuccessed            = false;
            List <ExcuteAction> retList = new List <ExcuteAction>();

            lock (s_ServiceLocker)
            {
                foreach (ExcuteAction action in actions)
                {
                    ModelBase model = action.ExcuteObject as ModelBase;
                    if (model == null)
                    {
                        continue;
                    }
                    Exception ex = null;

                    string logstring = string.Empty;
                    int    maxrid    = 0;
                    switch (action.ExcuteType)
                    {
                    case ExcuteType.Delete:
                        ModelMapping mp = new ModelMapping(model.GetType());
                        ModelFactoryCollection.DeleteModel(model, mp, out ex);
                        logstring = "delete";
                        if (ex == null)
                        {
                            ModelAccessManager.CacheManager.Remove(model);
                            retList.Add(action);
                        }
                        break;

                    case ExcuteType.Append:
                    case ExcuteType.Insert:
                        mp = new ModelMapping(model.GetType());
                        //model.Rid = ModelFactoryCollection.GetMaxRid(mp);
                        ModelFactoryCollection.InsertModel(model, mp, out ex);
                        logstring = "insert";
                        maxrid    = ModelFactoryCollection.GetMaxRid(mp);
                        if (ex == null)
                        {
                            ModelAccessManager.CacheManager.Save(model);
                            retList.Add(action);
                        }
                        break;

                    case ExcuteType.Update:
                        mp        = new ModelMapping(model.GetType());
                        logstring = "update";
                        ModelFactoryCollection.UpdateModel(model, mp, out ex);
                        if (ex == null)
                        {
                            ModelAccessManager.CacheManager.Save(model);
                            retList.Add(action);
                        }
                        break;

                    default:
                        break;
                    }
                    try
                    {
                        if (ex != null)
                        {
                            issuccessed = false;
                            m_callback.ErrorNotify("Registration", ex.Message, action.ExcuteType);
                        }
                        else
                        {
                            issuccessed = true;
                        }
                    }
                    catch (Exception e)
                    {
                        m_callback = null;
                        Console.WriteLine(e.Message);
                    }
                }
                if (retList.Count > 0)
                {
                    SendAll(retList.ToArray());
                }
            }
            return(issuccessed);
        }