public void CreateContacts_WithContactsCollection_ReturnsTrueWhenFailed()
        {
            // Arrange
            Contact contact = new Contact();

            ContactCollection collection = new ContactCollection(contact);

            string serialisedContent = "serialisedContent";

            RestResource resource = new ContactsResource(serialisedContent);

            RestResponse response = null;

            mockSerialiser
            .Setup(s => s.Serialise(collection))
            .Returns(serialisedContent);

            mockRestClient
            .Setup(r => r.Post(resource))
            .Returns(response);

            // Act
            bool actualResult = service.CreateContacts(collection);

            // Assert
            Assert.IsFalse(actualResult);
        }
示例#2
0
		public RawDevicesManager(InputProvider inputProvider)
		{
			virtualScreen = SystemInformation.VirtualScreen;

			this.inputProvider = inputProvider;
			mouseSpeed = SystemInformation.MouseSpeed * 0.15;

			devices = new DeviceCollection();
			contacts = new ContactCollection();

			IEnumerable<RawDevice> rawDevices = from device in RawDevice.GetRawDevices()
												where (device.RawType == RawType.Device &&
														device.GetRawInfo().UsagePage == HID_USAGE_PAGE_DIGITIZER &&
														device.GetRawInfo().Usage == HID_USAGE_DIGITIZER_PEN) ||
														device.RawType == RawType.Mouse
												select device;


			foreach (RawDevice mouseDevice in rawDevices)
				devices.Add(new DeviceStatus(mouseDevice));

			Thread inputThread = new Thread(InputWorker);
			inputThread.IsBackground = true;
			inputThread.SetApartmentState(ApartmentState.STA);
			inputThread.Name = "MultipleMice thread";
			inputThread.Start();

			this.inputProvider.IsRunning = true;
		}
        public void CreateContacts_WithContactsCollection_ReturnsTrueWhenSuccessful()
        {
            // Arrange
            Contact requestedContact = new Contact();

            ContactCollection requestedCollection = new ContactCollection(requestedContact);

            string serialisedContent = "serialisedContent";

            RestResource resource = new ContactsResource(serialisedContent);

            RestResponse response = new RestResponse()
            {
                StatusCode = HttpStatusCode.OK
            };

            mockSerialiser
            .Setup(s => s.Serialise(requestedCollection))
            .Returns(serialisedContent);

            mockRestClient
            .Setup(r => r.Post(resource))
            .Returns(response);

            // Act
            bool actualResult = service.CreateContacts(requestedCollection);

            // Assert
            Assert.IsTrue(actualResult);
        }
 /// <summary>
 /// Default class constructor, called by Form_Login
 /// </summary>
 /// <param name="_Account">An instance of WhatsAppAccount</param>
 public Form_Main(WhatsappAccount _Account)
 {
     InitializeComponent();
     Account = _Account;
     Prot = new WhatsAppProtocol(Account);
     Contacts = new ContactCollection();
 }
        public void PremierContactCollectionWithLowerCost()
        {
            var calculator = new ContactIndexCalculator();

            var collectionWithLowestCost  = new ContactCollection("more contacts", 800m, 100, new List <Contact>());
            var collectionWithHigherCost  = new ContactCollection("more contacts", 1000m, 100, new List <Contact>());
            var collectionWithHigherCost2 = new ContactCollection("more contacts", 1000m, 100, new List <Contact>());

            // add the same contact to all collections
            collectionWithLowestCost.Contacts.Add(GetContact(null, 3));
            collectionWithHigherCost.Contacts.Add(GetContact(null, 3));
            collectionWithHigherCost2.Contacts.Add(GetContact(null, 3));

            collectionWithLowestCost.Contacts.Add(GetContact(4, 3));
            collectionWithHigherCost.Contacts.Add(GetContact(4, 3));
            collectionWithHigherCost2.Contacts.Add(GetContact(4, 3));

            collectionWithLowestCost.Contacts.Add(GetContact(2, 5));
            collectionWithHigherCost.Contacts.Add(GetContact(2, 5));
            collectionWithHigherCost2.Contacts.Add(GetContact(2, 5));


            var contactCollecions = new List <ContactCollection>();

            contactCollecions.Add(collectionWithLowestCost);
            contactCollecions.Add(collectionWithHigherCost);
            contactCollecions.Add(collectionWithHigherCost2);

            calculator.SetIndexValues(contactCollecions);

            Assert.IsTrue(collectionWithLowestCost.IndexValue > collectionWithHigherCost.IndexValue);
            Assert.IsTrue(collectionWithLowestCost.IndexValue > collectionWithHigherCost2.IndexValue);
        }
        public IList <Contact> ImportContacts()
        {
            var contacts = new List <Contact>();
            var dlg      = new OpenFileDialog();

            dlg.DefaultExt = ".xml";
            dlg.Filter     = "XML Files (*.xml)|*.xml";

            if (dlg.ShowDialog() == true)
            {
                string fileName     = dlg.FileName;
                var    deserializer = new XMLSerializer <ContactCollection>(fileName);

                ContactCollection contactCollection = null;

                try
                {
                    contactCollection = deserializer.Deserialize();
                }
                catch (InvalidOperationException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                contacts = contactCollection?.Contacts;
            }

            return(contacts);
        }
示例#7
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <ContactInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContactInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <ContactInfo>);
            }
            else
            {
                List <ContactInfo> list       = new List <ContactInfo>();
                ContactCollection  collection = new  ContactCollection();
                Query qry = new Query(Contact.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (Contact contact in collection)
                {
                    ContactInfo contactInfo = new ContactInfo();
                    LoadFromDAL(contactInfo, contact);
                    list.Add(contactInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(ContactInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
        public void PremierContactCollectionHighterUserRaiting()
        {
            var calculator = new ContactIndexCalculator();

            var collectionWithHighUserRaitingCost   = new ContactCollection("more contacts", 800m, 100, new List <Contact>());
            var collectionWithNotAllUserRaitingCost = new ContactCollection("more contacts", 800m, 100, new List <Contact>());

            collectionWithHighUserRaitingCost.Contacts.Add(GetContact(3, 3));
            collectionWithNotAllUserRaitingCost.Contacts.Add(GetContact(null, 3));

            collectionWithHighUserRaitingCost.Contacts.Add(GetContact(4, 3));
            collectionWithNotAllUserRaitingCost.Contacts.Add(GetContact(null, 3));

            collectionWithHighUserRaitingCost.Contacts.Add(GetContact(1, 1));
            collectionWithNotAllUserRaitingCost.Contacts.Add(GetContact(null, 1));


            var contactCollecions = new List <ContactCollection>();

            contactCollecions.Add(collectionWithHighUserRaitingCost);
            contactCollecions.Add(collectionWithNotAllUserRaitingCost);

            calculator.SetIndexValues(contactCollecions);

            Assert.IsTrue(collectionWithHighUserRaitingCost.IndexValue > collectionWithNotAllUserRaitingCost.IndexValue);
        }
        public void AddContactBlurb(string businessKey, int index, bool chained)
        {
            ContactCollection contacts = new ContactCollection();

            contacts.Get(businessKey);

            string text    = contacts[index].PersonName;
            string tooltip = Localization.GetString("HEADING_CONTACT");
            string url     = root;

            if (BreadCrumbType.Edit == type)
            {
                url += "/edit/editcontact.aspx?key=";
            }
            else
            {
                url += "/details/contactdetail.aspx?search=" + Request["search"] + "&key=";
            }

            url += businessKey + "&index=" + index + "&frames=" + frames.ToString().ToLower();

            AddBusinessBlurb(businessKey, true);

            if (chained)
            {
                AddBlurb(text, url, null, tooltip, true);
            }
            else
            {
                AddBlurb(text, null, "contact.gif", tooltip, false);
            }
        }
示例#10
0
 public ListItems Convert(ContactCollection contacts)
 {
     var items = contacts
         .Select(contact => Mapper.Map<ListItem>(contact))
         .ToArray();
     return new ListItems(items, contacts.Page, contacts.Pages);
 }
 public override void OnCollisionStay(GameObject3D go, ContactCollection contacts)
 {
     DebugText.Text.ClearXbox();
     DebugText.Text.Append("White Box Info\n\n- Last event: Collision Stay");
     //var thisGo = (GameObject3D) Owner;
     //thisGo.RigidBody.Entity.ApplyImpulse(thisGo.Transform.Position, Vector3.Up * 0.5f);
 }
 /// <summary>
 /// Default class constructor, called by Form_Login
 /// </summary>
 /// <param name="_Account">An instance of WhatsAppAccount</param>
 public Form_Main(WhatsappAccount _Account)
 {
     InitializeComponent();
     Account  = _Account;
     Prot     = new WhatsAppProtocol(Account);
     Contacts = new ContactCollection();
 }
示例#13
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <ContactInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <ContactInfo> list = new List <ContactInfo>();

            Query q = Contact.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            ContactCollection collection = new  ContactCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Contact contact  in collection)
            {
                ContactInfo contactInfo = new ContactInfo();
                LoadFromDAL(contactInfo, contact);
                list.Add(contactInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
示例#14
0
        public void ExportContacts(IList <Contact> contacts)
        {
            var dlg = new SaveFileDialog();

            dlg.DefaultExt = ".xml";
            dlg.Filter     = "XML Files (*.xml)|*.xml";

            if (dlg.ShowDialog() == true)
            {
                string fileName = dlg.FileName;

                var serializer = new XMLSerializer <ContactCollection>(fileName);

                var contactCollection = new ContactCollection();
                contactCollection.Contacts = contacts.ToList();

                try
                {
                    serializer.Serialize(contactCollection);
                }
                catch (InvalidOperationException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        public void ContactsGetRecentlyUpdatedTest()
        {
            Flickr f = TestData.GetAuthInstance();

            ContactCollection contacts = f.ContactsGetListRecentlyUploaded(DateTime.Now.AddDays(-1), null);

            Assert.IsNotNull(contacts, "Contacts should not be null.");
        }
        public void ContactsGetListFullParamTest()
        {
            Flickr f = TestData.GetAuthInstance();

            ContactCollection contacts = f.ContactsGetList(null, 0, 0);

            Assert.IsNotNull(contacts, "Contacts should not be null.");
        }
示例#17
0
        public ListItems Convert(ContactCollection contacts)
        {
            var items = contacts
                        .Select(contact => Mapper.Map <ListItem>(contact))
                        .ToArray();

            return(new ListItems(items, contacts.Page, contacts.Pages));
        }
        public override void OnCollisionExit(GameObject3D go, ContactCollection contacts)
        {
            DebugText.Text.ClearXbox();
            DebugText.Text.Append("White Box Info\n\n- Last event: Collision Exit");

            // Restore the last collided gameobject's original material
            go.ModelRenderer.Material = lastCollidedGOMaterial;
        }
 public HomeController(ILogger <HomeController> logger, IArticleCollection articleColl, ContactCollection _contactCollection)
 {
     _logger           = logger;
     _coll             = new ArticleCollection();
     _articles         = new List <Models.ArticleModel>();
     _articlelogic     = new techburst_BLL.ArticleModel();
     _articleColl      = articleColl;
     contactCollection = _contactCollection;
 }
        public void ContactsGetPublicListTest()
        {
            ContactCollection contacts = AuthInstance.ContactsGetPublicList(Data.UserId);

            Assert.IsNotNull(contacts, "Contacts should not be null.");

            Assert.AreNotEqual(0, contacts.Total, "Total should not be zero.");
            Assert.AreNotEqual(0, contacts.PerPage, "PerPage should not be zero.");
        }
示例#21
0
        internal GetClosestNodes(ContactCollection contacts, Callback callback)
            : base(GUID)
        {
            this.contacts = contacts;
            this.callback = callback;

            Serializer.PrepareSerializer <RequestMessage>();
            Serializer.PrepareSerializer <ResponseMessage>();
        }
示例#22
0
        public void Initialize(ContactCollection contacts, BusinessEntity parent, bool allowEdit)
        {
            this.contacts = contacts;
            this.parent   = parent;

            grid.Columns[0].Visible = allowEdit;
            grid.Columns[1].Visible = allowEdit;
            grid.Columns[2].Visible = !allowEdit;
        }
        /// <summary>
        /// Fügt einen neuen Kontakt in die ObservableCollection ContactCollection hinzu
        /// </summary>
        private void AddNewContactToCollection()
        {
            ContactCollection.Add(new ViewModels.ContactViewModel()
            {
                Contact = new Models.Contact()
            });

            this.CurrentContact = ContactCollection[ContactCollection.Count - 1];
        }
示例#24
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <ContactInfo> pList, ContactCollection pCollection)
 {
     foreach (Contact contact in pCollection)
     {
         ContactInfo contactInfo = new ContactInfo();
         LoadFromDAL(contactInfo, contact);
         pList.Add(contactInfo);
     }
 }
示例#25
0
        public async void ContactsList_Tapped(object sender, ItemTappedEventArgs e)
        {
            HideQuickActionControls();
            ContactModel            item  = e.Item as ContactModel;
            var                     index = ContactCollection.IndexOf(item);
            PreviewBusinessCardPage page  = new PreviewBusinessCardPage(item, index);

            page.PageClosing += PreviewBusinessCardPage_PageClosing;
            await PopupNavigation.Instance.PushAsync(page);
        }
示例#26
0
 public ListItems Convert(ContactCollection contacts)
 {
     var items = contacts
         .Select(contact => new ListItem(
                                string.IsNullOrEmpty(contact.PathAlias) ? contact.UserId : contact.PathAlias,
                                contact.UserName,
                                contact.BuddyIconUrl))
         .ToArray();
     return new ListItems(items, contacts.Page, contacts.Pages);
 }
示例#27
0
        public void ContactCollection_DefaultConstructor()
        {
            // Arrange

            // Act
            ContactCollection contactCollectionInstance = new ContactCollection();

            // Assert
            Assert.That(contactCollectionInstance.Items, Is.InstanceOf <List <Contact> >());
        }
        public override void OnCollisionEnter(GameObject3D go, ContactCollection contacts)
        {
            DebugText.Text.ClearXbox();
            DebugText.Text.Append("White Box Info\n\n- Last event: Collision Enter");

            // Save the last collided game object's material
            lastCollidedGOMaterial = go.ModelRenderer.Material;

            // Paint it green
            go.ModelRenderer.Material = greenMaterial;
        }
示例#29
0
        /******** 私有方法 ********/

        /// <summary>
        /// 执行刷新操作。
        /// </summary>
        private async Task List()
        {
            ContactCollection.Clear();

            var contacts = await _contactService.ListAsync();

            foreach (var contact in contacts)
            {
                ContactCollection.Add(contact);
            }
        }
        public void ContactsGetPublicListTest()
        {
            Flickr f = TestData.GetInstance();

            ContactCollection contacts = f.ContactsGetPublicList(TestData.TestUserId);

            Assert.IsNotNull(contacts, "Contacts should not be null.");

            Assert.AreNotEqual(0, contacts.Total, "Total should not be zero.");
            Assert.AreNotEqual(0, contacts.PerPage, "PerPage should not be zero.");
        }
示例#31
0
        public void ContactCollection_DefaultDIConstructor_WithContact()
        {
            // Arrange
            Contact contact = new Contact();

            // Act
            ContactCollection contactCollectionInstance = new ContactCollection(contact);

            // Assert
            Assert.AreEqual(contact, contactCollectionInstance.Items.ElementAt(0));
        }
示例#32
0
        /// <summary>
        /// Posts a com.esendex.sdk.contacts.Contact to a com.esendex.sdk.groups.Group.
        /// </summary>
        /// <param name="accountReference">The number of the page.</param>
        /// <param name="groupId">The number of items in the page.</param>
        /// <param name="contact"></param>
        /// <returns>A com.esendex.sdk.groups.PagedGroupCollection instance that contains the groups.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public bool AddContactToGroup(string accountReference, string groupId, Contact contact)
        {
            var contactColletion = new ContactCollection();

            contactColletion.ItemsId.Add(contact.Id.ToString());

            RestResource resource = new GroupsResource(accountReference, groupId, Serialiser.Serialise(contactColletion));
            var          response = MakeRequest(HttpMethod.POST, resource);

            return(response != null);
        }
        public ucEditEmployee(long parameter) : this()
        {
            // Set the parameter ID, then load the fields
            ContactCollection contacts = new ContactCollection("iContactID = " + parameter);

            _contact = null;
            if (contacts.Count > 0)
            {
                _contact = contacts[0];
            }
        }
示例#34
0
    static void Main(string[] args)
    {
        var list         = new MyList();
        var contacts     = new ContactCollection();
        var partnerships = new PartnershipCollection();

        contacts.Add(new Contact());
        partnerships.Add(new Partnership());
        list.Add(contacts);
        list.Add(partnerships);
        list.ClearCollections();
    }
        public ContactCollection getContacts()
        {
            SqlConnection con = new SqlConnection(conStr);
            con.Open();

            ContactCollection contacts = new ContactCollection();

            String qry = String.Empty;
            qry = @"SELECT * FROM contacts order by name";

            SqlCommand cmd = new SqlCommand(qry, con);
            SqlDataReader dr = cmd.ExecuteReader();
            DataTable contactTable = new DataTable();
            contactTable.Load(dr);
            dr.Close();

            qry = String.Empty;
            qry = @"SELECT * FROM lines";

            cmd = new SqlCommand(qry, con);
            dr = cmd.ExecuteReader();
            DataTable lineTable = new DataTable();
            lineTable.Load(dr);
            dr.Close();

            cmd.Dispose();

            for (int i = 0; i < contactTable.Rows.Count; i++)
            {
                Contact c = new Contact((int)contactTable.Rows[i]["slNo"], (string)contactTable.Rows[i]["name"],
                    (string)contactTable.Rows[i]["number"]);
                

                createAssociation(c, 
                    contactTable.Rows[i]["lineAssociation"] == DBNull.Value ? String.Empty :(String) contactTable.Rows[i]["lineAssociation"],
                    contactTable.Rows[i]["shiftAssociation"] == DBNull.Value ? String.Empty :(String) contactTable.Rows[i]["shiftAssociation"],
                    contactTable.Rows[i]["departmentAssociation"] == DBNull.Value ? String.Empty :(String) contactTable.Rows[i]["departmentAssociation"],
                    contactTable.Rows[i]["escalationAssociation"] == DBNull.Value ? String.Empty :(String) contactTable.Rows[i]["escalationAssociation"]);

                if ((bool)contactTable.Rows[i]["hourlySummary"] == true)
                    c.LineSummary = true;
                else
                    c.LineSummary = false;

                if ((bool)contactTable.Rows[i]["shiftSummary"] == true)
                    c.ShiftSummary = true;
                else
                    c.ShiftSummary = false;
                

                contacts.Add(c);
            }

            con.Close();
            con.Dispose();
            return contacts;
        }
        public StartPage()
        {
            try
            {
                InitializeComponent();
                //_dbConnectionString = "Data Source=SAMBRAHMA\\SQLEXPRESS;database=IAS_Schneider;User id=sa; Password=mei123$%^;";
                _dbConnectionString  = ConfigurationSettings.AppSettings["DBConStr"];

                string lineList = ConfigurationSettings.AppSettings["LINES"];

                whID = Convert.ToInt32(ConfigurationSettings.AppSettings["WH_ID"]);

                DataAccess.conStr = _dbConnectionString;

                MainMenu _mainMenu = new MainMenu(_dbConnectionString);
                _mainFrame.Navigate(_mainMenu);
                dataAccess = new DataAccess();
                lines = dataAccess.getLines();
                lineQ = new Queue<int>();
                String[] linesLst = separateCommandData(lineList);

                foreach (line l in lines)
                {
                    foreach (String s in linesLst)
                    {

                        if (l.ID == Convert.ToInt32(s))
                        {
                            lineQ.Enqueue(l.ID);
                        }
                    }
                }

                departmentTable = dataAccess.getDepartmentInfo("");

                departmentQ = new Queue<int>();
                for (int i = 0; i < departmentTable.Rows.Count; i++)
                    departmentQ.Enqueue((int)departmentTable.Rows[i]["id"]);
                andonManager = new AndonManager(lineQ,departmentQ,AndonManager.MODE.MASTER);

                shifts = dataAccess.getShifts();

                contacts = dataAccess.getContacts();


                xmlSerializer = new XmlSerializer(typeof(AndonAlertEventArgs));

                serverType = ConfigurationSettings.AppSettings["ServerType"];
                dataAccess.updateIssueMarquee();


                commandTimer = new System.Timers.Timer(3 * 1000);
                commandTimer.Elapsed += new System.Timers.ElapsedEventHandler(commandTimer_Elapsed);
                commandTimer.AutoReset = false;

                commandTimer.Start();

                Issues = new Dictionary<int, Issue>();
                timeout = dataAccess.getEscalationTimeout();
                               
                
                andonManager.andonAlertEvent += new EventHandler<AndonAlertEventArgs>(andonManager_andonAlertEvent);

                andonManager.start();
               
            }
            catch( Exception e)
            {
                tbMsg.Text+= e.Message;
            }
        }
示例#37
0
        public ContactCollection getContacts()
        {
            SqlConnection con = new SqlConnection(conStr);
            con.Open();

            ContactCollection contacts = new ContactCollection();

            String qry = String.Empty;
            qry = @"SELECT * FROM contacts order by Name";

            SqlCommand cmd = new SqlCommand(qry, con);
            SqlDataReader dr = cmd.ExecuteReader();
            DataTable contactTable = new DataTable();
            contactTable.Load(dr);
            dr.Close();

            qry = String.Empty;
            qry = @"SELECT * FROM lines";

            cmd = new SqlCommand(qry, con);
            dr = cmd.ExecuteReader();
            DataTable lineTable = new DataTable();
            lineTable.Load(dr);
            dr.Close();

            cmd.Dispose();

            for (int i = 0; i < contactTable.Rows.Count; i++)
            {
                bool isprocurement = false;
                if (contactTable.Rows[i]["isProcurement"] == DBNull.Value) ;

                else if ((int)contactTable.Rows[i]["isProcurement"] == 1)
                    isprocurement = true;

                Contact c = new Contact((string)contactTable.Rows[i]["ID"],
                    (string)contactTable.Rows[i]["password"],
                    (string)contactTable.Rows[i]["name"],
                    (string)contactTable.Rows[i]["number"],
                    isprocurement);

                createAssociation(c,
                    contactTable.Rows[i]["lineAssociation"] == DBNull.Value ? String.Empty : (String)contactTable.Rows[i]["lineAssociation"],
                    contactTable.Rows[i]["shiftAssociation"] == DBNull.Value ? String.Empty : (String)contactTable.Rows[i]["shiftAssociation"],
                    contactTable.Rows[i]["departmentAssociation"] == DBNull.Value ? String.Empty : (String)contactTable.Rows[i]["departmentAssociation"],
                    contactTable.Rows[i]["escalationAssociation"] == DBNull.Value ? String.Empty : (String)contactTable.Rows[i]["escalationAssociation"]);




                contacts.Add(c);
            }

            con.Close();
            con.Dispose();
            return contacts;
        }
示例#38
0
        /**
         * method refreshCustomerList
         * accepts a CustomerCollection and
         * fill the repeater with it.
         * Also refresh the Dashboard stats
         * NOTE: Not very efficient
         */
        protected void refreshCustomerList(CustomerCollection cc)
        {
            Repeater1.DataSource = cc;
            Repeater1.DataBind();

            //fill Dashboard values
            CustomerCollection cc2 = new CustomerCollection();

            //Odd
            if (!cc2.getCustomersOdd())
            {
                //error
                lblError.Text = cc.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBOdd.Text = cc2.Count.ToString();
            }

            //Even
            if (!cc2.getCustomerEven())
            {
                //error
                lblError.Text = cc.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBEven.Text = cc2.Count.ToString();
            }

            //Family
            int famResult = cc2.getCustomerFamily();
            if (famResult == -1)
            {
                //error
                lblError.Text = cc.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBFamily.Text = famResult.ToString();
            }

            //Contacts
            ContactCollection concol = new ContactCollection();
            if (! concol.getAllContactsToday())
            {
                //error
                lblError.Text = concol.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBToday.Text = concol.Count.ToString();
            }
        }
示例#39
0
		/// <summary>
		/// This constructor will create an empty class, normally
		/// used when the Node property is assigned
		/// </summary>
		public Message()
		{
			m_MessageId = Guid.NewGuid();
			m_tos = new ContactCollection();
			m_cc = new ContactCollection();
			m_bcc = new ContactCollection();
			m_documents = new DocumentCollection();
            m_machine = Environment.MachineName;
            m_user = Environment.UserName;
            m_application = Properties.Resources.APPNAME;
		}
示例#40
0
		/// <summary>
		/// This constructor is used when we have just the name
		/// </summary>
		public Message( string subject, DateTime dateSent, string policyType, string mimeType, Contact sender)
		{
			if (mimeType == null)
				mimeType = "";
            if (sender == null || subject == null || policyType == null || mimeType == null)
			{
				System.Diagnostics.Trace.WriteLine( Workshare.Reports.Properties.Resources.TRACE_NULL, "Message Constructor 1" );
				throw ( new ArgumentNullException( "subject, sender, channel", Workshare.Reports.Properties.Resources.TRACE_NULL ) );
			}
			m_MessageId = Guid.NewGuid();
			m_subject = subject;
			m_dateSent = dateSent;
			m_channel = policyType;
			m_content = mimeType;
			m_sender = sender;
            m_sender.MessageId = m_MessageId;
			m_tos = new ContactCollection();
			m_cc = new ContactCollection();
			m_bcc = new ContactCollection();
			m_documents = new DocumentCollection();
            m_machine = Environment.MachineName;
		}
示例#41
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<ContactInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContactInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< ContactInfo>;
     }
     else
     {
         List< ContactInfo>  list =new List< ContactInfo>();
         ContactCollection  collection=new  ContactCollection();
         Query qry = new Query(Contact.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(Contact contact in collection)
         {
             ContactInfo contactInfo= new ContactInfo();
             LoadFromDAL(contactInfo,contact);
             list.Add(contactInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(ContactInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
示例#42
0
 /// <summary>
 /// Resets content
 /// </summary>
 public override void Clear()
 {
     base.Clear();
     m_UserName = "";
     m_FirstName = "";
     m_LastName = "";
     m_EMail = "";
     m_Birthday = null;
     m_Sex = Sex.Unknown;
     m_Status = EmployeeStatus.Default;
     m_Terminated = null;
     m_Department = "";
     m_WorkFrom = null;
     m_Location = "";
     m_Notes = "";
     m_Groups = new TlUserGroupCollection();
     m_Contacts = new ContactCollection();
     m_AvatarURL = "";
     m_AvatarMediumURL = "";
 }
示例#43
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< ContactInfo> pList, ContactCollection pCollection)
 {
     foreach (Contact contact in pCollection)
     {
         ContactInfo contactInfo = new ContactInfo();
         LoadFromDAL(contactInfo, contact );
         pList.Add(contactInfo);
     }
 }
 protected CollidablePairHandler()
 {
     Contacts = new ContactCollection(this);
 }
示例#45
0
        /// <summary>
        /// Base constructor.
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="guid"></param>
        private CCPCharacter(CharacterIdentity identity, Guid guid)
            : base(identity, guid)
        {
            QueryMonitors = new QueryMonitorCollection();
            SkillQueue = new SkillQueue(this);
            Standings = new StandingCollection(this);
            Assets = new AssetCollection(this);
            WalletJournal = new WalletJournalCollection(this);
            WalletTransactions = new WalletTransactionsCollection(this);
            CharacterMarketOrders = new MarketOrderCollection(this);
            CorporationMarketOrders = new MarketOrderCollection(this);
            CharacterContracts = new ContractCollection(this);
            CorporationContracts = new ContractCollection(this);
            CharacterContractBids = new ContractBidCollection(this);
            CorporationContractBids = new ContractBidCollection(this);
            CharacterIndustryJobs = new IndustryJobCollection(this);
            CorporationIndustryJobs = new IndustryJobCollection(this);
            ResearchPoints = new ResearchPointCollection(this);
            EVEMailMessages = new EveMailMessageCollection(this);
            EVEMailingLists = new EveMailingListCollection(this);
            EVENotifications = new EveNotificationCollection(this);
            Contacts = new ContactCollection(this);
            CharacterMedals = new MedalCollection(this);
            CorporationMedals = new MedalCollection(this);
            UpcomingCalendarEvents = new UpcomingCalendarEventCollection(this);
            KillLog = new KillLogCollection(this);
            PlanetaryColonies = new PlanetaryColonyCollection(this);

            m_endedOrdersForCharacter = new List<MarketOrder>();
            m_endedOrdersForCorporation = new List<MarketOrder>();

            m_endedContractsForCharacter = new List<Contract>();
            m_endedContractsForCorporation = new List<Contract>();

            m_jobsCompletedForCharacter = new List<IndustryJob>();

            EveMonClient.CharacterAssetsUpdated += EveMonClient_CharacterAssetsUpdated;
            EveMonClient.CharacterMarketOrdersUpdated += EveMonClient_CharacterMarketOrdersUpdated;
            EveMonClient.CorporationMarketOrdersUpdated += EveMonClient_CorporationMarketOrdersUpdated;
            EveMonClient.CharacterContractsUpdated += EveMonClient_CharacterContractsUpdated;
            EveMonClient.CorporationContractsUpdated += EveMonClient_CorporationContractsUpdated;
            EveMonClient.CharacterIndustryJobsUpdated += EveMonClient_CharacterIndustryJobsUpdated;
            EveMonClient.CorporationIndustryJobsUpdated += EveMonClient_CorporationIndustryJobsUpdated;
            EveMonClient.CharacterIndustryJobsCompleted += EveMonClient_CharacterIndustryJobsCompleted;
            EveMonClient.CorporationIndustryJobsCompleted += EveMonClient_CorporationIndustryJobsCompleted;
            EveMonClient.CharacterPlaneteryPinsCompleted += EveMonClient_CharacterPlaneteryPinsCompleted;
            EveMonClient.APIKeyInfoUpdated += EveMonClient_APIKeyInfoUpdated;
            EveMonClient.TimerTick += EveMonClient_TimerTick;
        }
示例#46
0
        /**
         * method initCustomer
         * fetch from the database the Customer
         * with the supplied id and populate the
         * objects properties
         */
        public bool initCustomer(int customerId)
        {
            SqlServer sqlsvr = new SqlServer();
            DataSet ds;
            string sql;

            try
            {
                sql = "SELECT * FROM Customer WHERE id = " + customerId;
                ds = sqlsvr.runSqlReturnDataSet(sql);

                if (ds == null)
                {
                    errorMessage = "Sql Server Error in Customer.initCustomer:" + sqlsvr.errorMessage;
                    return false;
                }

                if (ds.Tables[0].Rows.Count == 0)
                {
                    errorMessage = "No record in Customer.initCustomer";
                    return false;
                }

                DataRow row = ds.Tables[0].Rows[0];
                id = customerId;
                firstName = row["FirstName"].ToString();
                lastName = row["LastName"].ToString();
                phoneNumber = row["PhoneNumber"].ToString();
                email = row["Email"].ToString();

                // fetch all Contacts for this Customer
                // sorted by newest first
                ContactCollection cc = new ContactCollection();
                if (! cc.getAllContactsForCustomer(id))
                {
                    errorMessage = "Error getting Contacts in in Customer.initCustomer:" + cc.errorMessage;
                    return false;
                }
                contacts = cc;
                lastContact = cc[0].createDate;  //Last Contact

                return true;
            }
            catch (Exception ex)
            {
                errorMessage = "Exception in Customer.initCustomer:" + ex.Message + ex.StackTrace;
                return false;
            }
        }
示例#47
0
 public void SyncContacts(SyncCallback callback)
 {
     ContactCollection tmp = new ContactCollection(this);
     tmp.Resync(() =>
     {
         System.Threading.Interlocked.Exchange(ref mContacts, tmp);
         callback();
     });
 }
示例#48
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<ContactInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< ContactInfo> list = new List< ContactInfo>();

            Query q = Contact .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            ContactCollection  collection=new  ContactCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Contact  contact  in collection)
            {
                ContactInfo contactInfo = new ContactInfo();
                LoadFromDAL(contactInfo,   contact);
                list.Add(contactInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }