Esempio n. 1
0
        private void HandleCloneAppProperties(object param)
        {
            try
            {
                if (AllowClone && CloneAppName.Trim().Length != 0)
                {
                    cloneApp = (from s in DbContext.Apps
                                where s.AppName == CloneAppName
                                select s).FirstOrDefault();
                    if (cloneApp == null)
                    {
                        throw new Exception(string.Format("找不到测点编号为{0}的测点", CloneAppName));
                    }

                    ApparatusType type = AppTypes.FirstOrDefault(s => s.Id == cloneApp.AppTypeID);

                    NewApp.ApparatusType = type;
                    NewApp.X             = cloneApp.X;
                    NewApp.Y             = cloneApp.Y;
                    NewApp.Z             = cloneApp.Z;
                    NewApp.OtherInfo     = cloneApp.OtherInfo;
                    NewApp.BuriedTime    = cloneApp.BuriedTime;
                }
            }
            catch (Exception ex)
            {
                Messenger.Default.Send <Exception>(ex);
            }
        }