Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _db = new MyFamilyDatabaseDataContext();
     //_db.Log = Response.Output;
     //_db.PersonInfos.Where(p => p.SpouseID > 0 && p.Spouse.SpouseID != p.PersonID).ToList();
     //return;
     foreach (PersonInfo personInfo in _db.PersonInfos.Where(p => p.PersonID != 0))
     {
         if (personInfo.SpouseID != null && personInfo.SpouseID != 0)
         {
             PersonInfo spouse = _db.PersonInfos.Where(p => p.PersonID == personInfo.SpouseID).FirstOrDefault();
             if (spouse == null)
             {
                 ExtMethods.WriteLine(Response, "Spouse not found: " + personInfo.SpouseID);
             }
             else
             {
                 if (personInfo.PersonID != spouse.SpouseID)
                 {
                     ExtMethods.WriteLine(Response, string.Format("Spouse Mismatch: PersonId={0}, Person.SpouseID={1}, Spouse.SpouseID={2}", personInfo.PersonID, personInfo.SpouseID, spouse.SpouseID));
                 }
             }
         }
     }
 }
Пример #2
0
    protected void LinqDataSource1_Inserted(object sender, LinqDataSourceStatusEventArgs e)
    {
        PersonInfo p = e.Result as PersonInfo;

        if (p.SpouseID != null && p.SpouseID != 0)
        {
            try
            {
                //Updating SpouseID after submit
                using (MyFamilyDatabaseDataContext db = new MyFamilyDatabaseDataContext())
                {
                    PersonInfo spouse = db.PersonInfos.Where(sp => sp.PersonID == p.SpouseID).FirstOrDefault();
                    spouse.SpouseID = p.PersonID;
                    db.SubmitChanges();
                }
            }
            catch (Exception)
            {
                //Eat any exception
            }
        }

        ExtMethods.SendAddEmail(p);
        Response.Redirect("./PersonInfo.aspx?PersonID=" + p.PersonID);
    }
Пример #3
0
        public int BatchWrite(SortedDictionary <ITag, object> items, bool isSync = true)
        {
            int rev = ExtMethods.BatchWrite(items);

            if (DataChange != null && rev >= 0)
            {
                int           len  = items.Count;
                HistoryData[] data = new HistoryData[len];
                int           i    = 0;
                foreach (var item in items)
                {
                    ITag tag = item.Key;
                    data[i].ID        = tag.ID;
                    data[i].TimeStamp = tag.TimeStamp;
                    data[i].Quality   = tag.Quality;
                    //data[i].Value = item.Value.ToStorge();
                    i++;
                }
                foreach (DataChangeEventHandler deleg in DataChange.GetInvocationList())
                {
                    deleg.BeginInvoke(this, new DataChangeEventArgs(1, data), null, null);
                }
            }
            return(rev);
        }
    protected void LinqDataSource1_Updated(object sender, LinqDataSourceStatusEventArgs e)
    {
        PersonInfo p = e.Result as PersonInfo;

        if (p != null)
        {
            ExtMethods.SendUpdateEmail(p);
            Response.Redirect("./PersonInfo.aspx?PersonID=" + p.PersonID);
        }
    }
Пример #5
0
    public IEnumerator Parabola()
    {
        /// Create a temporary Object so we can move in local positions
        GameObject tmpObject = new GameObject();

        tmpObject.transform.rotation = CameraController.instance.transform.rotation;
        tmpObject.transform.parent   = null;
        tmpObject.transform.position = _StartPosition;

        /// Parent this Object to the temporary object
        transform.parent = tmpObject.transform;

        /// Convert the desired positions to local positions
        if (!positionsSet)
        {
            localStartPos = transform.InverseTransformPoint(_StartPosition);
            localEndPos   = transform.InverseTransformPoint(_EndPosition);
            positionsSet  = true;
        }

        /// Set the layer of the item so that it will render infront of everything while in the air
        gameObject.layer = 28;

        /// Perform the parabola movement
        if (transform != null)
        {
            while (Vector2.Distance(transform.localPosition, localEndPos) > 0.2f && _TimeToDestination < 0.5f)
            {
                _TimeToDestination += Time.deltaTime;

                transform.localPosition = ExtMethods.Parabola(localStartPos, localEndPos, _Height, _TimeToDestination * 2);

                yield return(null);
            }
        }

        /// Unparent, play sound, set the approriate layer and make it lootable
        transform.parent = null;
        SoundManager.instance.PlayUiSound("lootdrop");
        gameObject.layer = 10;
        GetComponent <BoxCollider>().enabled = true;

        /// destroy that temporary Object
        Destroy(tmpObject);
    }
Пример #6
0
 public HistoryData[] BatchRead(DataSource source, bool isSync, params ITag[] itemArray)
 {
     return(ExtMethods.BatchRead(source, itemArray));
 }