示例#1
0
        protected override atDAL.DALManager RemoteDAL(string user, string fwPassword)
        {
            System.Runtime.Remoting.Channels.Http.HttpClientChannel hcc = null;
            try
            {
                hcc = RegisterChannel(hcc, user, fwPassword, ServerInfo.proxyUrl);
                object      obj  = Activator.GetObject(typeof(atriumDAL.atriumDALManager), ServerInfo.proxyUrl + "/RemoteActivationService.rem");
                IDictionary dict = System.Runtime.Remoting.Channels.ChannelServices.GetChannelSinkProperties(obj);
                //ObjRef objectReference = RemotingServices.Marshal((System.MarshalByRefObject)obj);
                //Uri objectUri = new Uri(objectReference.URI);
                //set credentials on the proxy object
                dict["credentials"]     = cc;
                dict["preauthenticate"] = true;


                if (System.Runtime.Remoting.RemotingConfiguration.GetRegisteredActivatedClientTypes().Length == 0)
                {
                    System.Runtime.Remoting.RemotingConfiguration.RegisterActivatedClientType(typeof(atriumDAL.atriumDALManager), ServerInfo.proxyUrl);
                    //get instance of your object
                }
                atriumDAL.atriumDALManager atDALMngr = new atriumDAL.atriumDALManager(myNC.UserName, myNC.Password, ServerInfo.dbConnect);

                //object[] url ={ new System.Runtime.Remoting.Activation.UrlAttribute(remoteServer) };
                //DALMngr = (atriumDAL.atriumDALManager)Activator.CreateInstance(typeof(atriumDAL.atriumDALManager), BindingFlags.ExactBinding , url,nc.UserName,nc.Password);

                //get channel sink object for your object and set credentials on that
                dict = System.Runtime.Remoting.Channels.ChannelServices.GetChannelSinkProperties(atDALMngr);
                dict["credentials"] = cc;


                //ObjRef rem= RemotingServices.GetObjRefForProxy(atDALMngr);

                return(atDALMngr);
            }
            catch (System.Reflection.TargetInvocationException tex)
            {
                if (tex.InnerException != null)
                {
                    throw tex.InnerException;
                }
                else
                {
                    throw tex;
                }
            }
            catch (Exception xRemote)
            {
                ChannelServices.UnregisterChannel(hcc);

                throw;
            }
        }
示例#2
0
        public int LoadBF(int officeId, int officerID, DateTime date, bool refresh)
        {
            if (refresh)
            {
                //                myLastEdit = new DateTime(1900, 1, 1);
                myLastTS = 0;
                //myDAL.PreRefresh();
            }
            else
            {
                //  myA.AtMng.LogMessage(String.Format("RefreshBF {0} {1}", myA.IsVirtualFM, myA.CurrentFileId));
            }


            if (myActivityBFDT.Rows.Count > 0)
            {
                myLastTS = (Int64)myActivityBFDT.Select("", "ver desc")[0]["ver"];
            }


            int     i;
            DataSet ds;

            if (myA.AtMng.AppMan.UseService)
            {
                ds = BEManager.DecompressDataSet(myA.AtMng.AppMan.AtriumX().ActivityBFLoadBF(officeId, officerID, date, myA.AtMng.OfficeLoggedOn.OfficerBF, myLastTS, myA.AtMng.AppMan.AtriumXCon), new atriumDB());
            }
            else
            {
                //to fix two threads using connection at same time
                atriumDAL.ActivityBFDAL abdal = myDAL;
                if (!refresh)
                {
                    atriumDAL.atriumDALManager adm = new atriumDAL.atriumDALManager(myA.AtMng.AppMan.myUser, myA.AtMng.AppMan.myPwd, myA.AtMng.AppMan.Connect);
                    abdal = adm.GetActivityBF();
                }
                try
                {
                    ds = atLogic.BEManager.DecompressDataSet(abdal.LoadBF(officeId, officerID, date, myA.AtMng.OfficeLoggedOn.OfficerBF, myLastTS), new atriumDB());
                }
                catch (System.Runtime.Serialization.SerializationException x)
                {
                    RecoverDAL();
                    ds = atLogic.BEManager.DecompressDataSet(myDAL.LoadBF(officeId, officerID, date, myA.AtMng.OfficeLoggedOn.OfficerBF, myLastTS), new atriumDB());
                }
            }
            i = ds.Tables["ACtivityBF"].Rows.Count;
            Fill(ds.Tables["ActivityBF"]);

            return(i);
        }
示例#3
0
        private void Init(System.Net.NetworkCredential nc, string user, string language, string pwd, string fwPassword)
        {
            myNC = nc;

            myUser       = user;
            myPwd        = pwd;
            myFWPassword = fwPassword;

            AtriumXURL = ServerInfo.AtriumX;
            if (ServerInfo.IsCompressionNull())
            {
                Compression = true;
            }
            else
            {
                Compression = ServerInfo.Compression;
            }

            UseProxy   = ServerInfo.useProxy;
            UseService = ServerInfo.useService;
            UseTrusted = serverInfo.trustedConnection;

            Connect = ServerInfo.dbConnect;

            if (language == "FRE")
            {
                atriumBE.Properties.Resources.Culture = new System.Globalization.CultureInfo("fr-CA");

                this.myLanguage = language;
            }

            //WindowsFormsApplicationBase creates a talk-back channel
            if (!UseService)
            {
                if (UsingRemote)
                {
                    //start proxy
                    if (ServerInfo.useProxy)
                    {
                        StartProxy(ServerInfo, user, fwPassword);
                    }

                    DALMngr = (atriumDAL.atriumDALManager)RemoteDAL(nc.UserName, fwPassword);
                }
                else
                {
                    DALMngr = new atriumDAL.atriumDALManager(nc.UserName, nc.Password, ServerInfo.dbConnect);
                }

                myDALClient = new DALClient(this);
            }


            //atSecurity.SecurityApp secApp= new atSecurity.SecurityApp(nc, user, ServerInfo.proxyUrl, ServerInfo.useRemote, ServerInfo.dbConnect, fwPassword);
            //SecurityManager = secApp.SecurityManager;


            AtMng = new atriumManager(this);

            StartPulse();
            pulse.Elapsed += new System.Timers.ElapsedEventHandler(pulse_Elapsed1);
        }