Beispiel #1
0
        public void LoadContactsToDbAsync()
        {
            var cons = new Contacts();

            cons.SearchCompleted += ContactsSearchCompleted;
            cons.SearchAsync(String.Empty, FilterKind.None, null);
        }
Beispiel #2
0
        /// <summary>
        /// Constructeur de la classe
        /// </summary>
        /// <param name="contact">La ligne du contact avec laquel on a une conversation</param>
        /// <param name="index">L'indice de ce contact dans la liste des contacts</param>
        public ConversationForm(Contacts.ContactsDataSet.ContactsRow contact, int index)
        {
            InitializeComponent();

            // permettra de tenir a jour la liste des conversations ouvertes.
            indice = index;

            Address = contact.Address;
            DisplayName = contact.DisplayName;
            Text = Address;

            // On séléctionne la zone de texte dans laquelle il faut écrire pour communiquer.
            WriteBox.Select();

            // Mise à jour de la barre de status
            StatusLabel.Text += DisplayName + " et vous commencée.";

            // définition de la fonction à éxécuter par le BackgroundWorker
            bw.DoWork += bw_DoWork;

            // On s'abonne à l'évenement de reception des messages
            SessionController.GetInstance().MessageReceived += ConversationForm_MessageReceived;

            // On s'abonne à l'évenement d'appuie sur une touche ( on n'agit que sur la touche entrer )
            WriteBox.KeyUp += WriteBox_KeyUp;
        }
 public MainPage()
 {
     InitializeComponent();
     contacts = new Contacts();
     contacts.SearchCompleted += contacts_SearchCompleted;
     appointments.SearchCompleted += appointments_SearchCompleted;
 }
 private void Fix_Name(Contacts cont)
 {
     if (cont.FirstName != null)
         return;
     int fn = 0;
     int ln = 1;
     string fname = "";
     string lname = "";
     string[] nps = cont.Name.Split(' ');
     List<string> newname = new List<string>();
     foreach (string name in nps)
     {
         string n = "";
         string nn = name.Replace(".", "");
         if (nn.Length == 1)
             continue;
         else
             n = name.Substring(0, 1) + name.Substring(1).ToLower();
         newname.Add(n);
     }
     if (newname.Count == 0)
         return;
     fname = newname[0];
     for (int i = 1; i < newname.Count; i++)
     {
         lname += newname[i] + " ";
     }
     cont.FirstName = fname;
     if (lname.Length > 199)
         lname = lname.Substring(0, 199);
     cont.LastName = lname;
 }
        public Task<Contact[]> GetAllAsync()
        {
            var taskCompletionSource = new TaskCompletionSource<Contact[]>();
            var contacts = new Contacts();
            contacts.SearchCompleted += (sender, args) =>
            {
                var addressbook = args.Results
                    .Where(i => !string.IsNullOrEmpty(i.DisplayName))
                    .Select(ToContact)
                    .ToArray();

                //if there is no any contact (run in emulator?) - add several fakes
                if (!addressbook.Any())
                {
                    addressbook = new[]
                        {
                            new Contact { Name = "Egor Bogatov", Number = "+01231"},
                            new Contact { Name = "Ian Gillan", Number = "+01232"},
                            new Contact { Name = "Freddie Mercury", Number = "+01233"},
                            new Contact { Name = "David Gilmour", Number = "+01234"},
                            new Contact { Name = "Steve Ballmer", Number = "+01235"},
                        };
                }

                taskCompletionSource.SetResult(addressbook);
            };
            contacts.SearchAsync(string.Empty, FilterKind.DisplayName, null);

            return taskCompletionSource.Task;
        }
        public HomeModule()
        {
            Get["/"] = _ =>
              {
            return View ["hub.cshtml"];
              };

              Get["/add_contact"] = _ =>
              {
            return View ["add_contact.cshtml"];
              };
              Post["/contact_created"] = _ =>
              {
            string name = Request.Form["contactName"];
            int number = Request.Form["contactPhone"];
            string address = Request.Form["contactAddress"];
            Contacts newContact = new Contacts(name, address, number);
            return View ["contact_added.cshtml", newContact];
              };
              Get["/view_contacts"] = _ =>
              {
            return View ["view_contacts.cshtml", Contacts.GetAllContacts()];
              };

              Get["/view_contacts/{id}"] = parameters =>
              {
            return View ["contact_detail.cshtml", Contacts.GetContactById(parameters.id)];
              };

              Get["/contacts_cleared"] = _ =>
              {
            Contacts.ClearContacts();
            return View ["contacts_deleted"];
              };
        }
 public ActionResult Delete(Contacts contactToDelete)
 {
     /*if(*/
     _service.DeleteContact(contactToDelete);/*)*/
     return RedirectToAction("Index");
     //return View();
 }
    private void InitData()
    {
        int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]);
        string URL = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_CONTACT;
        try
        {
            if (nItemID > 0)
            {
                Contacts objContactUs = new Contacts();
                objContactUs.LoadById(nItemID);
                lblEmail.Text = ConvertData.ConvertToString(objContactUs.Data.Email);
                lblFullName.Text = objContactUs.Data.Fullname.ToLower();
                lblTelephone.Text = objContactUs.Data.Telephone;
                lblMainContent.Text = objContactUs.Data.MainContent;
                lblTelephone.Text = objContactUs.Data.Telephone;
                lblContactDate.Text = ConvertData.ConvertIntToDatetimeString(objContactUs.Data.CreatedDate);

                int Result = objContactUs.UpdateStatus(nItemID, EnumeType.ACTIVE);
            }
            else
            { Response.Redirect(URL); }
        }
        catch
        {
            Response.Redirect(URL);
        }
    }
        public void getContacts()
        {
            Contacts cons = new Contacts();

            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
            cons.SearchAsync(string.Empty, FilterKind.None, null);
        }
 private void Details_Loaded(object sender, RoutedEventArgs e)
 {
     var name = NavigationContext.QueryString["name"];
     Contacts c = new Contacts();
     c.SearchCompleted += c_SearchCompleted;
     c.SearchAsync(name, FilterKind.DisplayName, name);
 }
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     Contacts objContacts = new Contacts();
     objContacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(objContacts_SearchCompleted);
     objContacts.SearchAsync(string.Empty, FilterKind.None, null);
 }
 private string fillContactsTextBox()
 {
     Contacts cons = new Contacts();
     str = "";
     cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
     cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");
     return str;
 }
        public dynamic Find(int id)
        {
            //var table = new Contacts();
            //return table.Single(key: id);

            dynamic table = new Contacts();
            return table.GetContact(Id: id);
        }
Beispiel #14
0
        public Presenter()
        {
            string[] files = { "settings.json", "contacts.xml", "messages.bin" };

            _settings = JsonSerialization.ReadFromJsonFile<Settings>(files[0]);
            _contacts = XmlSerialization.ReadFromXmlFile<Contacts>(files[1]);
            _messages = BinarySerialization.ReadFromBinaryFile<Messages>(files[2]);
        }
        private void SearchContacts()
        {
            Contacts cons = new Contacts();

            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);

            cons.SearchAsync(String.Empty, contactFilterKind, "Contacts Test #1");
        }
        private void ProcurarContacto_Click(object sender, RoutedEventArgs e)
        {
            var contacts = new Contacts();
            contacts.SearchCompleted += Contacts_SearchCompleted;

            contacts.SearchAsync(nomeTextbox.Text,
                FilterKind.DisplayName, null);
        }
 public EventStoreProcess(Contacts.AccountContactSynchronizationService accountContactSynchronizationService,
      Contacts.UserContactSynchronizationService userContactSynchronizationService,
      IUserRepository userRepository)
 {
     _accountContactSynchronizationService = accountContactSynchronizationService;
     _userContactSynchronizationService = userContactSynchronizationService;
     _userRepository = userRepository;
 }
Beispiel #18
0
        public async Task SyncContacts() {
            await TelegramSession.Instance.Established;

            Contacts contacts = new Contacts();
            contacts.SearchCompleted += ContactsOnSearchCompleted;
            contacts.SearchAsync(String.Empty, FilterKind.None, "Addressbook Contacts Sync");

        }
partial         void ContactsSet_Inserted(Contacts entity)
        {
            if (entity != null && entity.PersonType.Name == "Prisoner")
            {
                var prisoner = Prisoners.AddNew();
                prisoner.ContactId = entity;
                prisoner.SomeData = "Some prisoner data";
            }
        }
Beispiel #20
0
 public People()
 {
     //setProgressBar(true);
     InitializeComponent();
     Contacts objContacts = new Contacts();
     objContacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
     objContacts.SearchAsync(string.Empty, FilterKind.None, null);
     progressBar.Visibility = Visibility.Visible;
 }
Beispiel #21
0
    protected void PageIndexChanging(Object sender , GridViewPageEventArgs e)
    {
        grvContacts.PageIndex = e.NewPageIndex; ;

        Contacts contacts = new Contacts();

        grvContacts.DataSource = contacts.GetContactList().Tables[0];
        grvContacts.DataBind();
    }
 void addressTask_Completed(object sender, AddressResult e)
 {
     if (e.TaskResult == TaskResult.OK)
     {
         Contacts contacts = new Contacts();
         contacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(contacts_SearchCompleted);
         contacts.SearchAsync(e.DisplayName, FilterKind.DisplayName, null);
     }
 }
        public void LoadContacts(Action<List<Group<ContactWithImage>>> onLoaded)
        {
            _onContactsLoaded = onLoaded;

            StartLoader("loading contacts");

            var contacts = new Contacts();
            contacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(contacts_SearchCompleted);
            contacts.SearchAsync("", FilterKind.None, null);
        }
        public List<dynamic> GetAll()
        {
            //var table = new DynamicModel("AdventureWorks", "Person.Contact", "ContactID");
            var table = new Contacts();
            return table.All().ToList();
            //return table.Query("SELECT * FROM Person.Contact").ToList();

            //dynamic table = new Contacts();
            //return (table.Find() as IEnumerable<dynamic>).ToList();
        }
Beispiel #25
0
 private async void CreateContactStore()
 {
     contacts = await ContactStore.CreateOrOpenAsync(ContactStoreSystemAccessMode.ReadWrite, ContactStoreApplicationAccessMode.ReadOnly);
     if (contacts.RevisionNumber <1)
     {
         Contacts cons = new Contacts();
         cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(SearchCompleted);
         cons.SearchAsync(String.Empty, FilterKind.None, "Searching");
     }
 }
        private void GetContactPictures_Click(object sender, RoutedEventArgs e)
        {
            Contacts cons = new Contacts();

            //Identify the method that runs after the asynchronous search completes.
            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted_Many);

            //Start the asynchronous search.
            cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #3 Picture");
        }
Beispiel #27
0
        public void LoadData(bool refresh)
        {
            ContactItems.Clear();
            settings.IsLoadingContentSetting = true;
            Contacts cons = new Contacts();

            LoadFavorites("Favorites");
            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(ContactsSearch_Completed);
            cons.SearchAsync(String.Empty, FilterKind.None," Test" );
        }
 public bool DeleteContact(Contacts contactToDelete)
 {
     _repository.Delete(contactToDelete);
     _repository.Commit();
     //}
     //catch
     //{
     //    return false;
     //}
     return true;
 }
        public Contacts SearchContactsByName(string contactName)
        {
            Contacts myContacts = new Contacts();

            if (contactName.Length>0)
            {
                myContacts = ContactDataInterface.GetContactsByName(contactName);
            }

            return myContacts;
        }
        private void PhoneNumbersGetContacts()
        {
            Contacts cons = new Contacts();

            //Identify the method that runs after the asynchronous search completes.
            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(cons_SearchCompleted);

            //Start the asynchronous search. 
            cons.SearchAsync(String.Empty, FilterKind.DisplayName, null);

        }
Beispiel #31
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

                if (OwnerEquipmentCodePrefix != null)
                {
                    hash = hash * 59 + OwnerEquipmentCodePrefix.GetHashCode();
                }

                if (OrganizationName != null)
                {
                    hash = hash * 59 + OrganizationName.GetHashCode();
                }

                hash = hash * 59 + MeetsResidency.GetHashCode();

                if (LocalArea != null)
                {
                    hash = hash * 59 + LocalArea.GetHashCode();
                }

                if (Status != null)
                {
                    hash = hash * 59 + Status.GetHashCode();
                }

                if (DoingBusinessAs != null)
                {
                    hash = hash * 59 + DoingBusinessAs.GetHashCode();
                }

                if (RegisteredCompanyNumber != null)
                {
                    hash = hash * 59 + RegisteredCompanyNumber.GetHashCode();
                }

                if (PrimaryContact != null)
                {
                    hash = hash * 59 + PrimaryContact.GetHashCode();
                }

                if (IsMaintenanceContractor != null)
                {
                    hash = hash * 59 + IsMaintenanceContractor.GetHashCode();
                }

                if (WorkSafeBCPolicyNumber != null)
                {
                    hash = hash * 59 + WorkSafeBCPolicyNumber.GetHashCode();
                }

                if (WorkSafeBCExpiryDate != null)
                {
                    hash = hash * 59 + WorkSafeBCExpiryDate.GetHashCode();
                }

                if (CGLEndDate != null)
                {
                    hash = hash * 59 + CGLEndDate.GetHashCode();
                }

                if (ArchiveCode != null)
                {
                    hash = hash * 59 + ArchiveCode.GetHashCode();
                }

                if (ArchiveReason != null)
                {
                    hash = hash * 59 + ArchiveReason.GetHashCode();
                }

                if (ArchiveDate != null)
                {
                    hash = hash * 59 + ArchiveDate.GetHashCode();
                }

                if (Contacts != null)
                {
                    hash = hash * 59 + Contacts.GetHashCode();
                }

                if (Notes != null)
                {
                    hash = hash * 59 + Notes.GetHashCode();
                }

                if (Attachments != null)
                {
                    hash = hash * 59 + Attachments.GetHashCode();
                }

                if (History != null)
                {
                    hash = hash * 59 + History.GetHashCode();
                }

                if (EquipmentList != null)
                {
                    hash = hash * 59 + EquipmentList.GetHashCode();
                }

                return(hash);
            }
        }
 public void AddContact(Contacts contact)
 {
     context.Contacts.Add(contact);
     context.SaveChanges();
 }
Beispiel #33
0
        private void ExportToFile()
        {
            TransferOut        clsTransferOut        = new TransferOut();
            TransferOutDetails clsTransferOutDetails = clsTransferOut.Details(long.Parse(lblTransferOutID.Text));

            TransferOutItem clsTransferOutItem  = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable       dtaTransferOutItems = clsTransferOutItem.ListAsDataTable(clsTransferOutDetails.TransferOutID, null, SortOption.Ascending);

            Branch        clsBranch = new Branch(clsTransferOut.Connection, clsTransferOut.Transaction);
            BranchDetails clsBranchDetails;

            Contacts       clsContact = new Contacts(clsTransferOut.Connection, clsTransferOut.Transaction);
            ContactDetails clsContactDetails;

            Products       clsProduct = new Products(clsTransferOut.Connection, clsTransferOut.Transaction);
            ProductDetails clsProductDetails;

            ProductVariations clsProductVariation = new ProductVariations(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable         dtaProductVariation;

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable dtaProductVariationsMatrix;

            string        xmlFileName = Server.MapPath(@"\RetailPlus\temp\" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsTransferOutDetails.TransferOutNo + "_" + clsTransferOutDetails.TransferOutDate.ToString("yyyyMMddHHmmssffff") + ".xml");
            XmlTextWriter writer      = new XmlTextWriter(xmlFileName, System.Text.Encoding.UTF8);

            writer.Formatting = Formatting.Indented;
            writer.WriteStartDocument();
            writer.WriteComment("This file represents the TransferOut Details of TransferOut No: '" + clsTransferOutDetails.TransferOutNo + "' for " + lblBranchCode.Text + " branch.");
            writer.WriteComment("Save this in your local file. Goto 'File', click 'Save As', select the location in your local directory, click 'Save'.");
            writer.WriteStartElement("TransferOutDetails");
            writer.WriteAttributeString("TransferOutID", XmlConvert.ToString(clsTransferOutDetails.TransferOutID));
            writer.WriteAttributeString("TransferOutNo", clsTransferOutDetails.TransferOutNo);
            writer.WriteAttributeString("TransferOutDate", clsTransferOutDetails.TransferOutDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Supplier information******/
            clsContactDetails = clsContact.Details(clsTransferOutDetails.SupplierID);
            writer.WriteAttributeString("SupplierID", XmlConvert.ToString(clsContactDetails.ContactID));
            writer.WriteAttributeString("SupplierCode", clsContactDetails.ContactCode);
            writer.WriteAttributeString("SupplierName", clsContactDetails.ContactName);
            writer.WriteAttributeString("SupplierContact", clsContactDetails.BusinessName);
            writer.WriteAttributeString("SupplierAddress", clsTransferOutDetails.SupplierAddress);
            writer.WriteAttributeString("SupplierTelephoneNo", clsTransferOutDetails.SupplierTelephoneNo);
            writer.WriteAttributeString("SupplierModeOfTerms", XmlConvert.ToString(clsTransferOutDetails.SupplierModeOfTerms));
            writer.WriteAttributeString("SupplierTerms", XmlConvert.ToString(clsTransferOutDetails.SupplierTerms));
            writer.WriteAttributeString("SupplierContactGroupName", clsContactDetails.ContactGroupName);
            /******End Of Supplier Information******/

            writer.WriteAttributeString("RequiredDeliveryDate", clsTransferOutDetails.RequiredDeliveryDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Branch & Transferrer Information******/
            clsBranchDetails = clsBranch.Details(short.Parse(clsTransferOutDetails.BranchID.ToString()));
            writer.WriteAttributeString("BranchID", XmlConvert.ToString(clsTransferOutDetails.BranchID));
            writer.WriteAttributeString("BranchCode", clsTransferOutDetails.BranchCode);
            writer.WriteAttributeString("BranchName", clsTransferOutDetails.BranchName);
            writer.WriteAttributeString("BranchAddress", clsTransferOutDetails.BranchAddress);
            writer.WriteAttributeString("BranchDBIP", clsBranchDetails.DBIP);
            writer.WriteAttributeString("BranchDBPort", clsBranchDetails.DBPort);
            writer.WriteAttributeString("BranchRemarks", clsBranchDetails.Remarks);
            writer.WriteAttributeString("TransferrerID", clsTransferOutDetails.TransferrerID.ToString());
            writer.WriteAttributeString("TransferrerName", clsTransferOutDetails.TransferrerName);
            /******End Of Branch & Transferrer Information******/

            /******Amount Information******/
            writer.WriteAttributeString("SubTotal", XmlConvert.ToString(clsTransferOutDetails.SubTotal));
            writer.WriteAttributeString("Discount", XmlConvert.ToString(clsTransferOutDetails.Discount));
            writer.WriteAttributeString("DiscountApplied", XmlConvert.ToString(clsTransferOutDetails.DiscountApplied));
            writer.WriteAttributeString("DiscountType", clsTransferOutDetails.DiscountType.ToString("d"));
            writer.WriteAttributeString("VAT", XmlConvert.ToString(clsTransferOutDetails.VAT));
            writer.WriteAttributeString("VatableAmount", XmlConvert.ToString(clsTransferOutDetails.VatableAmount));
            writer.WriteAttributeString("EVAT", XmlConvert.ToString(clsTransferOutDetails.EVAT));
            writer.WriteAttributeString("EVatableAmount", XmlConvert.ToString(clsTransferOutDetails.EVatableAmount));
            writer.WriteAttributeString("LocalTax", XmlConvert.ToString(clsTransferOutDetails.LocalTax));
            writer.WriteAttributeString("Freight", XmlConvert.ToString(clsTransferOutDetails.Freight));
            writer.WriteAttributeString("Deposit", XmlConvert.ToString(clsTransferOutDetails.Deposit));
            writer.WriteAttributeString("UnpaidAmount", XmlConvert.ToString(clsTransferOutDetails.UnpaidAmount));
            writer.WriteAttributeString("PaidAmount", XmlConvert.ToString(clsTransferOutDetails.PaidAmount));
            writer.WriteAttributeString("TotalItemDiscount", XmlConvert.ToString(clsTransferOutDetails.TotalItemDiscount));
            writer.WriteAttributeString("Status", clsTransferOutDetails.Status.ToString("d"));
            writer.WriteAttributeString("Remarks", clsTransferOutDetails.Remarks);
            writer.WriteAttributeString("SupplierDRNo", clsTransferOutDetails.SupplierDRNo);
            writer.WriteAttributeString("DeliveryDate", clsTransferOutDetails.DeliveryDate.ToString("MM/dd/yyyy HH:mm:ss"));
            writer.WriteAttributeString("CancelledDate", clsTransferOutDetails.CancelledDate.ToString("MM/dd/yyyy HH:mm:ss"));
            writer.WriteAttributeString("CancelledRemarks", clsTransferOutDetails.CancelledRemarks);
            writer.WriteAttributeString("CancelledByID", XmlConvert.ToString(clsTransferOutDetails.CancelledByID));
            /******End Of Branch Information******/

            foreach (DataRow row in dtaTransferOutItems.Rows)
            {
                clsProductDetails = new ProductDetails();
                clsProductDetails = clsProduct.Details(Convert.ToInt64(row["ProductID"].ToString()));

                writer.WriteStartElement("TransferOutItem");
                writer.WriteAttributeString("TransferOutItemID", row["TransferOutItemID"].ToString());
                writer.WriteAttributeString("TransferOutID", row["TransferOutID"].ToString());
                writer.WriteAttributeString("ProductID", row["ProductID"].ToString());

                /*****Product Information*****/
                writer.WriteAttributeString("ProductCode", clsProductDetails.ProductCode);
                writer.WriteAttributeString("BarCode", clsProductDetails.BarCode);
                writer.WriteAttributeString("ProductDesc", clsProductDetails.ProductDesc);
                writer.WriteAttributeString("MatrixDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ProductSubGroupID", clsProductDetails.ProductSubGroupID.ToString());
                writer.WriteAttributeString("ProductSubGroupCode", clsProductDetails.ProductSubGroupCode);
                writer.WriteAttributeString("ProductSubGroupName", clsProductDetails.ProductSubGroupName);
                writer.WriteAttributeString("ProductGroupID", clsProductDetails.ProductGroupID.ToString());
                writer.WriteAttributeString("ProductGroupCode", clsProductDetails.ProductGroupCode);
                writer.WriteAttributeString("ProductGroupName", clsProductDetails.ProductGroupName);
                writer.WriteAttributeString("BaseUnitID", clsProductDetails.BaseUnitID.ToString());
                writer.WriteAttributeString("BaseUnitCode", clsProductDetails.BaseUnitCode);
                writer.WriteAttributeString("BaseUnitName", clsProductDetails.BaseUnitName);
                writer.WriteAttributeString("DateCreated", clsProductDetails.DateCreated.ToString("MM/dd/yy HH:mm:ss"));
                writer.WriteAttributeString("Deleted", clsProductDetails.Deleted.ToString());
                writer.WriteAttributeString("Price", clsProductDetails.Price.ToString());
                writer.WriteAttributeString("PurchasePrice", clsProductDetails.PurchasePrice.ToString());
                writer.WriteAttributeString("IncludeInSubtotalDiscount", clsProductDetails.IncludeInSubtotalDiscount.ToString());
                writer.WriteAttributeString("VAT", clsProductDetails.VAT.ToString());
                writer.WriteAttributeString("EVAT", clsProductDetails.EVAT.ToString());
                writer.WriteAttributeString("LocalTax", clsProductDetails.LocalTax.ToString());
                writer.WriteAttributeString("Quantity", clsProductDetails.Quantity.ToString());
                writer.WriteAttributeString("MinThreshold", clsProductDetails.MinThreshold.ToString());
                writer.WriteAttributeString("MaxThreshold", clsProductDetails.MaxThreshold.ToString());
                writer.WriteAttributeString("ChartOfAccountIDPurchase", clsProductDetails.ChartOfAccountIDPurchase.ToString());
                writer.WriteAttributeString("ChartOfAccountIDSold", clsProductDetails.ChartOfAccountIDSold.ToString());
                writer.WriteAttributeString("ChartOfAccountIDInventory", clsProductDetails.ChartOfAccountIDInventory.ToString());
                writer.WriteAttributeString("ChartOfAccountIDTaxPurchase", clsProductDetails.ChartOfAccountIDTaxPurchase.ToString());
                writer.WriteAttributeString("ChartOfAccountIDTaxSold", clsProductDetails.ChartOfAccountIDTaxSold.ToString());
                writer.WriteAttributeString("IsItemSold", clsProductDetails.IsItemSold.ToString());
                writer.WriteAttributeString("WillPrintProductComposition", clsProductDetails.WillPrintProductComposition.ToString());
                writer.WriteAttributeString("UpdatedBy", clsProductDetails.UpdatedBy.ToString());
                writer.WriteAttributeString("UpdatedOn", clsProductDetails.UpdatedOn.ToString("MM/dd/yyyy HH:mm"));
                writer.WriteAttributeString("PercentageCommision", clsProductDetails.PercentageCommision.ToString());
                writer.WriteAttributeString("Active", clsProductDetails.Active.ToString());
                /*****End Of Product Information*****/

                writer.WriteAttributeString("ItemProductGroup", row["ProductGroup"].ToString());
                writer.WriteAttributeString("ItemProductSubGroup", row["ProductSubGroup"].ToString());
                writer.WriteAttributeString("ItemVariationMatrixID", row["VariationMatrixID"].ToString());
                writer.WriteAttributeString("ItemBaseVariationDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ItemProductUnitID", row["ProductUnitID"].ToString());
                writer.WriteAttributeString("ItemProductUnitCode", row["ProductUnitCode"].ToString());
                writer.WriteAttributeString("ItemQuantity", row["Quantity"].ToString());
                writer.WriteAttributeString("ItemUnitCost", row["UnitCost"].ToString());
                writer.WriteAttributeString("ItemDiscount", row["Discount"].ToString());
                writer.WriteAttributeString("ItemDiscountApplied", row["DiscountApplied"].ToString());
                writer.WriteAttributeString("ItemDiscountType", row["DiscountType"].ToString());
                writer.WriteAttributeString("ItemAmount", row["Amount"].ToString());
                writer.WriteAttributeString("ItemVAT", row["VAT"].ToString());
                writer.WriteAttributeString("ItemVatableAmount", row["VatableAmount"].ToString());
                writer.WriteAttributeString("ItemEVAT", row["EVAT"].ToString());
                writer.WriteAttributeString("ItemEVatableAmount", row["EVatableAmount"].ToString());
                writer.WriteAttributeString("ItemLocalTax", row["LocalTax"].ToString());
                writer.WriteAttributeString("ItemisVATInclusive", row["isVATInclusive"].ToString());
                writer.WriteAttributeString("ItemTransferOutItemStatus", row["TransferOutItemStatus"].ToString());
                writer.WriteAttributeString("ItemIsVatable", row["IsVatable"].ToString());
                writer.WriteAttributeString("ItemSellingPrice", row["SellingPrice"].ToString());
                writer.WriteAttributeString("ItemSellingVAT", row["SellingVAT"].ToString());
                writer.WriteAttributeString("ItemSellingEVAT", row["SellingEVAT"].ToString());
                writer.WriteAttributeString("ItemSellingLocalTax", row["SellingLocalTax"].ToString());
                writer.WriteAttributeString("ItemOldSellingPrice", row["OldSellingPrice"].ToString());
                writer.WriteAttributeString("ItemRemarks", row["Remarks"].ToString());

                dtaProductVariation = clsProductVariation.ListAsDataTable(clsProductDetails.ProductID, null, System.Data.SqlClient.SortOrder.Ascending);
                foreach (DataRow rowVariation in dtaProductVariation.Rows)
                {
                    writer.WriteStartElement("Variation", null);
                    writer.WriteAttributeString("VariationCode", rowVariation["VariationCode"].ToString());
                    writer.WriteAttributeString("VariationType", rowVariation["VariationType"].ToString());
                    writer.WriteEndElement();
                }

                dtaProductVariationsMatrix = clsProductVariationsMatrix.ProductVariationsMatrixListAsDataTable(long.Parse(row["VariationMatrixID"].ToString()), null, System.Data.SqlClient.SortOrder.Ascending);
                foreach (DataRow rowVariationsMatrix in dtaProductVariationsMatrix.Rows)
                {
                    writer.WriteStartElement("VariationMatrix", null);
                    writer.WriteAttributeString("MatriXID", rowVariationsMatrix["MatriXID"].ToString());
                    writer.WriteAttributeString("VariationID", rowVariationsMatrix["VariationID"].ToString());
                    writer.WriteAttributeString("Description", rowVariationsMatrix["Description"].ToString());
                    writer.WriteAttributeString("VariationCode", rowVariationsMatrix["VariationCode"].ToString());
                    writer.WriteAttributeString("VariationType", rowVariationsMatrix["VariationType"].ToString());
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }

            writer.WriteEndElement();

            //Write the XML to file and close the writer
            writer.Flush();
            writer.Close();

            clsTransferOut.CommitAndDispose();

            string stScript = "<Script>";

            stScript += "window.open('/RetailPlus/temp/" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsTransferOutDetails.TransferOutNo + "_" + clsTransferOutDetails.TransferOutDate.ToString("yyyyMMddHHmmssffff") + ".xml')";
            stScript += "</Script>";
            Response.Write(stScript);
        }
Beispiel #34
0
        /// <summary>
        /// Returns true if Owner instances are equal
        /// </summary>
        /// <param name="other">Instance of Owner to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Owner other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     OwnerEquipmentCodePrefix == other.OwnerEquipmentCodePrefix ||
                     OwnerEquipmentCodePrefix != null &&
                     OwnerEquipmentCodePrefix.Equals(other.OwnerEquipmentCodePrefix)
                 ) &&
                 (
                     OrganizationName == other.OrganizationName ||
                     OrganizationName != null &&
                     OrganizationName.Equals(other.OrganizationName)
                 ) &&
                 (
                     MeetsResidency == other.MeetsResidency ||
                     MeetsResidency.Equals(other.MeetsResidency)
                 ) &&
                 (
                     LocalArea == other.LocalArea ||
                     LocalArea != null &&
                     LocalArea.Equals(other.LocalArea)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     DoingBusinessAs == other.DoingBusinessAs ||
                     DoingBusinessAs != null &&
                     DoingBusinessAs.Equals(other.DoingBusinessAs)
                 ) &&
                 (
                     RegisteredCompanyNumber == other.RegisteredCompanyNumber ||
                     RegisteredCompanyNumber != null &&
                     RegisteredCompanyNumber.Equals(other.RegisteredCompanyNumber)
                 ) &&
                 (
                     PrimaryContact == other.PrimaryContact ||
                     PrimaryContact != null &&
                     PrimaryContact.Equals(other.PrimaryContact)
                 ) &&
                 (
                     IsMaintenanceContractor == other.IsMaintenanceContractor ||
                     IsMaintenanceContractor != null &&
                     IsMaintenanceContractor.Equals(other.IsMaintenanceContractor)
                 ) &&
                 (
                     WorkSafeBCPolicyNumber == other.WorkSafeBCPolicyNumber ||
                     WorkSafeBCPolicyNumber != null &&
                     WorkSafeBCPolicyNumber.Equals(other.WorkSafeBCPolicyNumber)
                 ) &&
                 (
                     WorkSafeBCExpiryDate == other.WorkSafeBCExpiryDate ||
                     WorkSafeBCExpiryDate != null &&
                     WorkSafeBCExpiryDate.Equals(other.WorkSafeBCExpiryDate)
                 ) &&
                 (
                     CGLEndDate == other.CGLEndDate ||
                     CGLEndDate != null &&
                     CGLEndDate.Equals(other.CGLEndDate)
                 ) &&
                 (
                     ArchiveCode == other.ArchiveCode ||
                     ArchiveCode != null &&
                     ArchiveCode.Equals(other.ArchiveCode)
                 ) &&
                 (
                     ArchiveReason == other.ArchiveReason ||
                     ArchiveReason != null &&
                     ArchiveReason.Equals(other.ArchiveReason)
                 ) &&
                 (
                     ArchiveDate == other.ArchiveDate ||
                     ArchiveDate != null &&
                     ArchiveDate.Equals(other.ArchiveDate)
                 ) &&
                 (
                     Contacts == other.Contacts ||
                     Contacts != null &&
                     Contacts.SequenceEqual(other.Contacts)
                 ) &&
                 (
                     Notes == other.Notes ||
                     Notes != null &&
                     Notes.SequenceEqual(other.Notes)
                 ) &&
                 (
                     Attachments == other.Attachments ||
                     Attachments != null &&
                     Attachments.SequenceEqual(other.Attachments)
                 ) &&
                 (
                     History == other.History ||
                     History != null &&
                     History.SequenceEqual(other.History)
                 ) &&
                 (
                     EquipmentList == other.EquipmentList ||
                     EquipmentList != null &&
                     EquipmentList.SequenceEqual(other.EquipmentList)
                 ));
        }
        public XmppSession(
            XmppClientEx xmppClient,
            IMapper mapper,
            MyViewModel myViewModel,
            Contacts contacts,
            IPresenceManager presenceManager,
            IAvatarStorage avatarStorage,
            IUserAvatarStorage userAvatarStorage)
        {
            this.xmppClient        = xmppClient;
            this.mapper            = mapper;
            this.viewModel         = myViewModel;
            this.contacts          = contacts;
            this.presenceManager   = presenceManager;
            this.avatarStorage     = avatarStorage;
            this.userAvatarStorage = userAvatarStorage;

            xmppClient.XmppSessionStateObserver.Subscribe(async state =>
            {
                if (state == SessionState.Disconnected && SessionState != SessionState.Disconnected)
                {
                    //Task.Run(() => DoReconnectAsync(Connect, TimeSpan.FromSeconds(30), 100));
                }

                await SetSessionState(state);

                System.Diagnostics.Debug.WriteLine(state);
            });

            xmppClient
            .XmppXElementStreamObserver
            .Where(el =>
                   el.OfType <MatrixPresence>() &&
                   el.Cast <MatrixPresence>().Type == MatrixPresenceType.Available &&
                   contacts.Any(c => c.Jid == el.Cast <MatrixPresence>().From.Bare)
                   )
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(el =>
            {
                // received online presence from a contact
                System.Diagnostics.Debug.WriteLine($"online presence from: {el.Cast<MatrixPresence>().From}");
                var pres     = el.Cast <MatrixPresence>();
                var contact  = contacts.FirstOrDefault(ct => ct.Jid == pres.From.Bare);
                var viewPres = mapper.Map <ViewModel.Presence>(pres);
                contact.Presences.AddOrReplace(viewPres, p => p.Resource == viewPres.Resource);
            });


            xmppClient
            .XmppXElementStreamObserver
            .Where(el =>
                   el.OfType <MatrixPresence>() &&
                   el.Cast <MatrixPresence>().Type == MatrixPresenceType.Unavailable &&
                   el.Cast <MatrixPresence>().From != null &&
                   el.Cast <MatrixPresence>().From.Resource != null &&
                   contacts.Any(c => c.Jid == el.Cast <MatrixPresence>().From.Bare)
                   )
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(el =>
            {
                // received offline presence from a contact
                System.Diagnostics.Debug.WriteLine($"offline presence from: {el.Cast<MatrixPresence>().From}");
                var pres    = el.Cast <MatrixPresence>();
                var contact = contacts.FirstOrDefault(ct => ct.Jid == pres.From.Bare);

                contact.Presences.Remove(p => p.Resource == pres.From.Resource);
            });


            xmppClient
            .XmppXElementStreamObserver
            .Where(el =>
                   el.OfType <MatrixMessage>() &&
                   el.Cast <MatrixMessage>().Type == MatriXMessageType.Chat &&
                   el.Cast <MatrixMessage>().From != null &&
                   el.Cast <MatrixMessage>().Body != null
                   )
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(el =>
            {
                var msg = el.Cast <MatrixMessage>();
                Contact contact;

                // handle incoming chat message
                if (!viewModel.Chats.Any(c => c.Jid == msg.From.Bare))
                {
                    if (contacts.Contains(msg.From.Bare))
                    {
                        contact = contacts[msg.From.Bare];
                    }
                    else
                    {
                        contact = new Contact(msg.From.Bare);
                    }
                    viewModel.AddChatMenu(contact, false);
                }
                else
                {
                    contact = contacts[msg.From.Bare];
                }

                contact.LastMessageResource = msg.From.Resource;
                var viewMessage             = mapper.Map <Message>(msg);
                viewMessage.Nickname        = contact.Name;
                viewMessage.IsSelf          = false;

                if (msg.Id != null)
                {
                    viewMessage.Id = msg.Id;
                }

                viewModel.GetChatMenu(msg.From.Bare).Messages.Add(viewMessage);
            });


            /*
             * <presence>
             *  <show>away</show>
             *  <status>Kann nicht chatten. Muss arbeiten.</status>
             *  <priority>40</priority>
             *  <c xmlns="http://jabber.org/protocol/caps" ver="r75qsgpbcZtkumlpddBcZZCeDco=" hash="sha-1" node="http://psi-im.org"/>
             *  <x xmlns="vcard-temp:x:update">
             *      <photo>9b33b369b378be852b8487e23105dd4bd880a0f0</photo>
             *  </x>
             *  </presence>
             *
             */
        }
Beispiel #36
0
        private void ReadElement(XmlReader xmlReader)
        {
            switch (xmlReader.Name)
            {
            case ConstTagUser:
                ReadUser(xmlReader);
                break;

            case ConstTagProxy:
                ReadProxy(xmlReader);
                break;

            case ConstTagMap:
                ReadMap(xmlReader);
                break;

            case ConstTagCure:
                ReadCure(xmlReader);
                break;

            case ConstTagAutoAnswer:
                ReadAutoAnswer(xmlReader);
                break;

            case ConstTagFish:
                ReadFish(xmlReader);
                break;

            case ConstTagChat:
                ReadChat(xmlReader);
                break;

            case ConstTagLightForum:
                ReadForum(xmlReader);
                break;

            case ConstTagTorg:
                ReadTorg(xmlReader);
                break;

            case "window":
                Window.State = FormWindowState.Normal;
                var windowState = xmlReader["state"] ?? string.Empty;
                try
                {
                    Window.State = (FormWindowState)Enum.Parse(typeof(FormWindowState), windowState);
                }
                catch (ArgumentException)
                {
                }

                Window.Left   = (xmlReader["left"] == null) ? 0 : Convert.ToInt32(xmlReader["left"], CultureInfo.InvariantCulture);
                Window.Top    = (xmlReader["top"] == null) ? 0 : Convert.ToInt32(xmlReader["top"], CultureInfo.InvariantCulture);
                Window.Width  = (xmlReader["width"] == null) ? 0 : Convert.ToInt32(xmlReader["width"], CultureInfo.InvariantCulture);
                Window.Height = (xmlReader["height"] == null) ? 0 : Convert.ToInt32(xmlReader["height"], CultureInfo.InvariantCulture);
                break;

            case "stat":
                Stat.Drop          = xmlReader["drop"] ?? string.Empty;
                Stat.LastReset     = (xmlReader["lastreset"] == null) ? 0 : Convert.ToInt64(xmlReader["lastreset"]);
                Stat.LastUpdateDay = (xmlReader["lastupdateday"] == null) ? DateTime.Now.DayOfYear : Convert.ToInt32(xmlReader["lastupdateday"]);
                Stat.Reset         = (xmlReader["reset"] != null) && Convert.ToBoolean(xmlReader["reset"]);
                Stat.SavedTraffic  = (xmlReader["savedtraffic"] == null) ? 0 : Convert.ToInt64(xmlReader["savedtraffic"]);
                Stat.Show          = (xmlReader["show"] == null) ? 0 : Convert.ToInt32(xmlReader["show"]);
                Stat.Traffic       = (xmlReader["traffic"] == null) ? 0 : Convert.ToInt64(xmlReader["traffic"]);
                Stat.XP            = (xmlReader["xp"] == null) ? 0 : Convert.ToInt64(xmlReader["xp"]);
                Stat.NV            = (xmlReader["nv"] == null) ? 0 : Convert.ToInt32(xmlReader["nv"]);
                Stat.FishNV        = (xmlReader["fishnv"] == null) ? 0 : Convert.ToInt32(xmlReader["fishnv"]);
                break;

            case "itemdrop":
                var itemdrop = new TypeItemDrop
                {
                    Name  = xmlReader["name"] ?? string.Empty,
                    Count = (xmlReader["count"] == null) ? 1 : Convert.ToInt32(xmlReader["count"])
                };
                Stat.ItemDrop.Add(itemdrop);
                break;

            case "splitter":
                Splitter.Collapsed = (xmlReader["collapsed"] != null) && Convert.ToBoolean(xmlReader["collapsed"], CultureInfo.InvariantCulture);
                Splitter.Width     = (xmlReader["width"] == null) ? 200 : Convert.ToInt32(xmlReader["width"], CultureInfo.InvariantCulture);
                break;

            case "inv":
                DoInvPack     = (xmlReader["doInvPack"] == null) || Convert.ToBoolean(xmlReader["doInvPack"]);
                DoInvPackDolg = (xmlReader["doInvPackDolg"] == null) || Convert.ToBoolean(xmlReader["doInvPackDolg"]);
                DoInvSort     = (xmlReader["doInvSort"] == null) || Convert.ToBoolean(xmlReader["doInvSort"]);
                break;

            case "dopromptexit":
                xmlReader.Read();
                DoPromptExit = xmlReader.ReadContentAsBoolean();
                break;

            case "dostopondig":
                xmlReader.Read();
                DoStopOnDig = xmlReader.ReadContentAsBoolean();
                break;

            case "dohttplog":
                xmlReader.Read();
                DoHttpLog = xmlReader.ReadContentAsBoolean();
                break;

            case "dotexlog":
                xmlReader.Read();
                DoTexLog = xmlReader.ReadContentAsBoolean();
                break;

            case "doautocutwritechat":
                xmlReader.Read();
                DoAutoCutWriteChat = xmlReader.ReadContentAsBoolean();
                break;

            case "showperformance":
                xmlReader.Read();
                ShowPerformance = xmlReader.ReadContentAsBoolean();
                break;

            case "showoverwarning":
                xmlReader.Read();
                ShowOverWarning = xmlReader.ReadContentAsBoolean();
                break;

            case "selectedrightpanel":
                xmlReader.Read();
                SelectedRightPanel = xmlReader.ReadContentAsInt();
                break;

            case "notepad":
                xmlReader.Read();
                Notepad = HelperPacks.UnpackString(xmlReader.ReadContentAsString());
                break;

            case "nextcheckversion":
                xmlReader.Read();
                var binaryNextCheckVersion = xmlReader.ReadContentAsLong();
                NextCheckVersion = DateTime.FromBinary(binaryNextCheckVersion);
                break;

            case "tab":
                xmlReader.Read();
                _listtabs.Add(xmlReader.ReadContentAsString());
                break;

            case "favlocation":
                xmlReader.Read();
                _listfavlocations.Add(xmlReader.ReadContentAsString());
                break;

            case "herbautocut":
                xmlReader.Read();
                HerbsAutoCut.Add(xmlReader.ReadContentAsString());
                break;

            case "complects":
                xmlReader.Read();
                Complects = xmlReader.ReadContentAsString();
                break;

            case "dotray":
                xmlReader.Read();
                DoTray = xmlReader.ReadContentAsBoolean();
                break;

            case "showtraybaloons":
                xmlReader.Read();
                ShowTrayBaloons = xmlReader.ReadContentAsBoolean();
                break;

/*
 *              case "servdiff":
 *                  xmlReader.Read();
 *                  var servdiff = xmlReader.ReadContentAsString();
 *                  TimeSpan val;
 *                  if (!TimeSpan.TryParse(servdiff, out val))
 *                  {
 *                      val = TimeSpan.MinValue;
 *                  }
 *
 *                  ServDiff = val;
 *                  break;
 */

            case "doconvertrussian":
                xmlReader.Read();
                DoConvertRussian = xmlReader.ReadContentAsBoolean();
                break;

            case "apptimer":
                var appTimer    = new AppTimer();
                var triggertime = xmlReader["triggertime"];
                if (triggertime != null)
                {
                    long binary;
                    if (long.TryParse(triggertime, out binary))
                    {
                        appTimer.TriggerTime = DateTime.FromBinary(binary);
                    }
                }

                appTimer.Description = xmlReader["description"] ?? string.Empty;
                appTimer.Complect    = xmlReader["complect"] ?? string.Empty;
                appTimer.Potion      = xmlReader["potion"] ?? string.Empty;
                var xmldrinkcount = xmlReader["drinkcount"];
                if (xmldrinkcount != null)
                {
                    int drinkcount;
                    if (int.TryParse(xmldrinkcount, out drinkcount))
                    {
                        appTimer.DrinkCount = drinkcount;
                    }
                }

                var xmlisrecur = xmlReader["isrecur"];
                if (xmlisrecur != null)
                {
                    bool isrecur;
                    if (bool.TryParse(xmlisrecur, out isrecur))
                    {
                        appTimer.IsRecur = isrecur;
                    }
                }

                var xmlisherb = xmlReader["isherb"];
                if (xmlisherb != null)
                {
                    bool isherb;
                    if (bool.TryParse(xmlisherb, out isherb))
                    {
                        appTimer.IsHerb = isherb;
                    }
                }

                var xmleveryminutes = xmlReader["everyminutes"];
                if (xmleveryminutes != null)
                {
                    int everyMinutes;
                    if (int.TryParse(xmleveryminutes, out everyMinutes))
                    {
                        appTimer.EveryMinutes = everyMinutes;
                    }
                }

                appTimer.Destination = xmlReader["destination"] ?? string.Empty;
                AppConfigTimers.Add(appTimer);
                break;

            case "pers":
                Pers.Guamod   = (xmlReader["guamod"] == null) || Convert.ToBoolean(xmlReader["guamod"], CultureInfo.InvariantCulture);
                Pers.IntHP    = (xmlReader["inthp"] != null) ? Convert.ToDouble(xmlReader["inthp"], CultureInfo.InvariantCulture) : 2000;
                Pers.IntMA    = (xmlReader["intma"] != null) ? Convert.ToDouble(xmlReader["intma"], CultureInfo.InvariantCulture) : 9000;
                Pers.Ready    = (xmlReader["ready"] != null) ? Convert.ToInt64(xmlReader["ready"], CultureInfo.InvariantCulture) : 0;
                Pers.LogReady = xmlReader["logready"] ?? string.Empty;
                break;

            case "navigator":
                Navigator.AllowTeleports = (xmlReader["allowteleports"] == null) || Convert.ToBoolean(xmlReader["allowteleports"], CultureInfo.InvariantCulture);
                break;

            case "contactentry":
                var strclassid = xmlReader["classid"] ?? string.Empty;
                int classid;
                if (!int.TryParse(strclassid, out classid))
                {
                    classid = 0;
                }

                var strtoolid = xmlReader["toolid"] ?? string.Empty;
                int toolid;
                if (!int.TryParse(strtoolid, out toolid))
                {
                    toolid = 0;
                }

                var contact = new Contact(
                    xmlReader["name"] ?? string.Empty,
                    classid,
                    toolid,
                    xmlReader["sign"] ?? string.Empty,
                    xmlReader["clan"] ?? string.Empty,
                    xmlReader["align"] ?? string.Empty,
                    HelperPacks.UnpackString(xmlReader["comments"] ?? string.Empty),
                    xmlReader["tracing"] == null || Convert.ToBoolean(xmlReader["tracing"], CultureInfo.InvariantCulture),
                    xmlReader["level"] ?? string.Empty,
                    true);

                if (Contacts == null)
                {
                    Contacts = new SortedList <string, Contact>();
                }

                if (!Contacts.ContainsKey(contact.Name.ToLower()))
                {
                    Contacts.Add(contact.Name.ToLower(), contact);
                }

                break;

            case "herbcell":
                var herbCell = new HerbCell();
                var location = xmlReader["location"] ?? string.Empty;
                if (!string.IsNullOrEmpty(location))
                {
                    herbCell.RegNum = location;
                    var herbs = xmlReader["herbs"] ?? string.Empty;
                    if (!string.IsNullOrEmpty(location))
                    {
                        herbCell.Herbs = herbs;
                    }

                    var lastViewString = xmlReader["lastview"] ?? string.Empty;
                    if (!string.IsNullOrEmpty(location))
                    {
                        long updatedInTicks;
                        if (long.TryParse(lastViewString, out updatedInTicks))
                        {
                            if ((ServDiff != TimeSpan.MinValue) && (updatedInTicks < DateTime.Now.Subtract(ServDiff).Ticks))
                            {
                                herbCell.UpdatedInTicks = updatedInTicks;
                                var timediff = TimeSpan.FromTicks(DateTime.Now.Subtract(ServDiff).Ticks - updatedInTicks);
                                if (timediff.TotalHours < 6)
                                {
                                    if (!HerbCells.ContainsKey(location))
                                    {
                                        HerbCells.Add(location, herbCell);
                                    }
                                }
                            }
                        }
                    }
                }

                break;

            case "dorob":
                xmlReader.Read();
                DoRob = xmlReader.ReadContentAsBoolean();
                break;

            case "doautocure":
                xmlReader.Read();
                DoAutoCure = xmlReader.ReadContentAsBoolean();
                break;

            case "autowearcomplect":
                xmlReader.Read();
                AutoWearComplect = xmlReader.ReadContentAsString();
                break;

            case "sound":
                Sound.Enabled       = (xmlReader["enabled"] == null) || Convert.ToBoolean(xmlReader["enabled"], CultureInfo.InvariantCulture);
                Sound.DoPlayAlarm   = (xmlReader["alarm"] == null) || Convert.ToBoolean(xmlReader["alarm"], CultureInfo.InvariantCulture);
                Sound.DoPlayAttack  = (xmlReader["attack"] == null) || Convert.ToBoolean(xmlReader["attack"], CultureInfo.InvariantCulture);
                Sound.DoPlayDigits  = (xmlReader["digits"] == null) || Convert.ToBoolean(xmlReader["digits"], CultureInfo.InvariantCulture);
                Sound.DoPlayRefresh = (xmlReader["refresh"] == null) || Convert.ToBoolean(xmlReader["refresh"], CultureInfo.InvariantCulture);
                Sound.DoPlaySndMsg  = (xmlReader["sndmsg"] == null) || Convert.ToBoolean(xmlReader["sndmsg"], CultureInfo.InvariantCulture);
                Sound.DoPlayTimer   = (xmlReader["timer"] == null) || Convert.ToBoolean(xmlReader["timer"], CultureInfo.InvariantCulture);
                break;

            case "autoadv":
                AutoAdv.Sec   = (xmlReader["sec"] != null) ? Convert.ToInt32(xmlReader["sec"], CultureInfo.InvariantCulture) : 600;
                AutoAdv.Phraz = HelperPacks.UnpackString(xmlReader["phraz"] ?? string.Empty);
                break;

            case "autodrinkblaz":
                DoAutoDrinkBlaz   = (xmlReader["do"] != null) && Convert.ToBoolean(xmlReader["do"], CultureInfo.InvariantCulture);
                AutoDrinkBlazTied = (xmlReader["tied"] != null) ? Convert.ToInt32(xmlReader["tied"], CultureInfo.InvariantCulture) : 84;
                break;

            case "autodrinkblazorder":
                xmlReader.Read();
                AutoDrinkBlazOrder = xmlReader.ReadContentAsInt();
                if ((AutoDrinkBlazOrder < 0) || (AutoDrinkBlazOrder > 1))
                {
                    AutoDrinkBlazOrder = 0;
                }
                break;

            case "fastactions":
                DoShowFastAttack               = (xmlReader["simple"] != null) && Convert.ToBoolean(xmlReader["simple"], CultureInfo.InvariantCulture);
                DoShowFastAttackBlood          = (xmlReader["blood"] == null) || Convert.ToBoolean(xmlReader["blood"], CultureInfo.InvariantCulture);
                DoShowFastAttackUltimate       = (xmlReader["ultimate"] == null) || Convert.ToBoolean(xmlReader["ultimate"], CultureInfo.InvariantCulture);
                DoShowFastAttackClosedUltimate = (xmlReader["closedultimate"] == null) || Convert.ToBoolean(xmlReader["closedultimate"], CultureInfo.InvariantCulture);
                DoShowFastAttackClosed         = (xmlReader["closed"] == null) || Convert.ToBoolean(xmlReader["closed"], CultureInfo.InvariantCulture);
                DoShowFastAttackFist           = (xmlReader["fist"] != null) && Convert.ToBoolean(xmlReader["fist"], CultureInfo.InvariantCulture);
                DoShowFastAttackClosedFist     = (xmlReader["closedfist"] == null) || Convert.ToBoolean(xmlReader["closedfist"], CultureInfo.InvariantCulture);
                DoShowFastAttackOpenNevid      = (xmlReader["opennevid"] == null) || Convert.ToBoolean(xmlReader["opennevid"], CultureInfo.InvariantCulture);
                DoShowFastAttackPoison         = (xmlReader["poison"] == null) || Convert.ToBoolean(xmlReader["poison"], CultureInfo.InvariantCulture);
                DoShowFastAttackStrong         = (xmlReader["strong"] == null) || Convert.ToBoolean(xmlReader["strong"], CultureInfo.InvariantCulture);
                DoShowFastAttackNevid          = (xmlReader["nevid"] == null) || Convert.ToBoolean(xmlReader["nevid"], CultureInfo.InvariantCulture);
                DoShowFastAttackFog            = (xmlReader["fog"] == null) || Convert.ToBoolean(xmlReader["fog"], CultureInfo.InvariantCulture);
                DoShowFastAttackZas            = (xmlReader["zas"] == null) || Convert.ToBoolean(xmlReader["zas"], CultureInfo.InvariantCulture);
                DoShowFastAttackTotem          = (xmlReader["totem"] == null) || Convert.ToBoolean(xmlReader["totem"], CultureInfo.InvariantCulture);
                DoShowFastAttackPortal         = (xmlReader["portal"] == null) || Convert.ToBoolean(xmlReader["portal"], CultureInfo.InvariantCulture);
                break;

            case AppConsts.TagLezDoAutoboi:
                xmlReader.Read();
                LezDoAutoboi = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagLezDoWaitHp:
                xmlReader.Read();
                LezDoWaitHp = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagLezDoWaitMa:
                xmlReader.Read();
                LezDoWaitMa = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagLezWaitHp:
                xmlReader.Read();
                LezWaitHp = xmlReader.ReadContentAsInt();
                break;

            case AppConsts.TagLezWaitMa:
                xmlReader.Read();
                LezWaitMa = xmlReader.ReadContentAsInt();
                break;

            case AppConsts.TagLezDoDrinkHp:
                xmlReader.Read();
                LezDoDrinkHp = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagLezDoDrinkMa:
                xmlReader.Read();
                LezDoDrinkMa = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagLezDrinkHp:
                xmlReader.Read();
                LezDrinkHp = xmlReader.ReadContentAsInt();
                break;

            case AppConsts.TagLezDrinkMa:
                xmlReader.Read();
                LezDrinkMa = xmlReader.ReadContentAsInt();
                break;

            case AppConsts.TagLezDoWinTimeout:
                xmlReader.Read();
                LezDoWinTimeout = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagLezSay:
                xmlReader.Read();
                LezSay = (LezSayType)Enum.Parse(typeof(LezSayType), xmlReader.ReadContentAsString());
                break;

            case AppConsts.TagLezBotsGroup:
                var group = new LezBotsGroup(001, 0);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsGroupId] ?? "0", out group.Id);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsMinimalLevelId] ?? "0", out group.MinimalLevel);

                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoRestoreHp] ?? "true", out group.DoRestoreHp);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoRestoreMa] ?? "true", out group.DoRestoreMa);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsRestoreHp] ?? "50", out group.RestoreHp);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsRestoreMa] ?? "50", out group.RestoreMa);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoAbilBlocks] ?? "true", out group.DoAbilBlocks);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoAbilHits] ?? "true", out group.DoAbilHits);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoMagHits] ?? "true", out group.DoMagHits);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsMagHits] ?? "5", out group.MagHits);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoMagBlocks] ?? "false", out group.DoMagBlocks);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoHits] ?? "true", out group.DoHits);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoBlocks] ?? "true", out group.DoBlocks);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoMiscAbils] ?? "true", out group.DoMiscAbils);

                group.SpellsHits      = LezSpellCollection.SpellsFromString(xmlReader[AppConsts.AttrLezBotsSpellsHits] ?? "");
                group.SpellsBlocks    = LezSpellCollection.SpellsFromString(xmlReader[AppConsts.AttrLezBotsSpellsBlocks] ?? "");
                group.SpellsRestoreHp = LezSpellCollection.SpellsFromString(xmlReader[AppConsts.AttrLezBotsSpellsRestoreHp] ?? "");
                group.SpellsRestoreMa = LezSpellCollection.SpellsFromString(xmlReader[AppConsts.AttrLezBotsSpellsRestoreMa] ?? "");
                group.SpellsMisc      = LezSpellCollection.SpellsFromString(xmlReader[AppConsts.AttrLezBotsSpellsMisc] ?? "");

                if (group.SpellsHits.Length == 0)
                {
                    group.SpellsHits = LezSpellCollection.Hits;
                }

                if (group.SpellsBlocks.Length == 0)
                {
                    group.SpellsBlocks = LezSpellCollection.Blocks;
                }

                if (group.SpellsRestoreHp.Length == 0)
                {
                    group.SpellsRestoreHp = LezSpellCollection.RestoreHp;
                }

                if (group.SpellsRestoreMa.Length == 0)
                {
                    group.SpellsRestoreMa = LezSpellCollection.RestoreMa;
                }

                if (group.SpellsMisc.Length == 0)
                {
                    group.SpellsMisc = LezSpellCollection.Misc;
                }

                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoStopNow] ?? "false", out group.DoStopNow);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoStopLowHp] ?? "false", out group.DoStopLowHp);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoStopLowMa] ?? "false", out group.DoStopLowMa);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsStopLowHp] ?? "25", out group.StopLowHp);
                int.TryParse(xmlReader[AppConsts.AttrLezBotsStopLowMa] ?? "25", out group.StopLowMa);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoExit] ?? "false", out group.DoExit);
                bool.TryParse(xmlReader[AppConsts.AttrLezBotsDoExitRisky] ?? "true", out group.DoExitRisky);

                LezGroups.Add(group);
                break;

            case AppConsts.TagDoContactTrace:
                xmlReader.Read();
                DoContactTrace = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagDoBossTrace:
                xmlReader.Read();
                DoBossTrace = xmlReader.ReadContentAsBoolean();
                break;

            case AppConsts.TagBossSay:
                xmlReader.Read();
                BossSay = (LezSayType)Enum.Parse(typeof(LezSayType), xmlReader.ReadContentAsString());
                break;

            case AppConsts.TagSkinAuto:
                xmlReader.Read();
                SkinAuto = xmlReader.ReadContentAsBoolean();
                break;
            }
        }
 private void OnContactLoaded(object sender, ContactEventArgs e)
 {
     Contacts.Add(e.Contact);
 }
 public IActionResult Delete(Contacts contacts)
 {
     context.Contacts.Remove(contacts);
     context.SaveChanges();
     return(RedirectToAction("Index", "Home"));
 }
Beispiel #39
0
 public void AddContact(Person contact)
 {
     Contacts.Add(new PartyContact(this, contact));
 }
Beispiel #40
0
 void Awake()
 {
     m_Contacts            = GetComponent <Contacts>();
     m_Contacts.onContact += M_Contacts_onContact;
 }
 public void EditContact(Contacts contact)
 {
     context.Entry(contact).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }