Example #1
0
        public void AddProposal(string paper_name, string co_authors,
                                string[] keywords, string[] topics, string abstractFileName, string paperFileName,
                                User author, Edition ed)
        {
            PaperMetaInformation metaInfo = new PaperMetaInformation(paper_name, string.Join(",", keywords), author, co_authors);

            metaInfoRepo.Save(metaInfo);
            foreach (string topic in topics)
            {
                Topic t = new Topic(topic);
                topicsRepo.Save(t);
                MetaInformationTopics mit = new MetaInformationTopics(t, metaInfo);
                metaTopicsRepo.Save(mit);
            }

            Abstract abs   = (abstractFileName != "") ? new Abstract(abstractFileName) : null;
            Paper    paper = (paperFileName != "") ? new Paper(paperFileName, abs, metaInfo, ed) : null;

            if (abs != null)
            {
                abstractRepo.Save(abs);
            }
            if (paper != null)
            {
                paerRepo.Save(paper);
            }
        }
Example #2
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Abstract != null)
         {
             hashCode = hashCode * 59 + Abstract.GetHashCode();
         }
         if (NpasgrUpperLimit != null)
         {
             hashCode = hashCode * 59 + NpasgrUpperLimit.GetHashCode();
         }
         if (NpasgrLowerLimit != null)
         {
             hashCode = hashCode * 59 + NpasgrLowerLimit.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #3
0
    public static void AttentionLoop(Abstract obj, float secs, float scale, string clipName, string stopFunctionName = null, bool play = true)
    {
        AddAnimation(obj.gameObject);
        DeleteClipIfExists(obj.gameObject, clipName);

        AnimationClip  animClip = new AnimationClip();
        AnimationCurve curveX   = AnimationCurve.EaseInOut(0, obj.singleTransform.localScale.x, secs, obj.singleTransform.localScale.x);
        AnimationCurve curveY   = AnimationCurve.EaseInOut(0, obj.singleTransform.localScale.y, secs, obj.singleTransform.localScale.y);
        AnimationCurve curveZ   = AnimationCurve.EaseInOut(0, obj.singleTransform.localScale.z, secs, obj.singleTransform.localScale.z);

        curveX.AddKey(secs / 2, scale);
        curveY.AddKey(secs / 2, scale);
        curveZ.AddKey(secs / 2, scale);

        animClip.SetCurve("", typeof(Transform), "localScale.x", curveX);
        animClip.SetCurve("", typeof(Transform), "localScale.y", curveY);
        animClip.SetCurve("", typeof(Transform), "localScale.z", curveZ);

        if (stopFunctionName != null && stopFunctionName != "None")
        {
            AnimationEvent eventStop = new AnimationEvent();
            eventStop.functionName = stopFunctionName;
            eventStop.time         = secs;
            animClip.AddEvent(eventStop);
        }

        obj.animation.AddClip(animClip, clipName);
        obj.animation [clipName].layer = 1;
        obj.animation.wrapMode         = WrapMode.Loop;
        if (play)
        {
            obj.animation.Play(clipName);
        }
    }
Example #4
0
    public static void RotateXYZ(Abstract obj, Vector3 rotateTo, float secs, string clipName, string stopFunctionName = null, bool play = true)
    {
        AddAnimation(obj.gameObject);
        DeleteClipIfExists(obj.gameObject, clipName);

        AnimationClip  animClip           = new AnimationClip();
        Quaternion     rotateToQuaternion = Quaternion.Euler(rotateTo);
        AnimationCurve curveX             = AnimationCurve.Linear(0, obj.singleTransform.localRotation.x, secs, rotateToQuaternion.x);
        AnimationCurve curveY             = AnimationCurve.Linear(0, obj.singleTransform.localRotation.y, secs, rotateToQuaternion.y);
        AnimationCurve curveZ             = AnimationCurve.Linear(0, obj.singleTransform.localRotation.z, secs, rotateToQuaternion.z);
        AnimationCurve curveW             = AnimationCurve.Linear(0, obj.singleTransform.localRotation.w, secs, rotateToQuaternion.w);

        animClip.SetCurve("", typeof(Transform), "localRotation.x", curveX);
        animClip.SetCurve("", typeof(Transform), "localRotation.y", curveY);
        animClip.SetCurve("", typeof(Transform), "localRotation.z", curveZ);
        animClip.SetCurve("", typeof(Transform), "localRotation.w", curveW);

        if (stopFunctionName != null && stopFunctionName != "None")
        {
            AnimationEvent eventStop = new AnimationEvent();
            eventStop.functionName = stopFunctionName;
            eventStop.time         = secs;
            animClip.AddEvent(eventStop);
        }

        obj.animation.AddClip(animClip, clipName);
        obj.animation [clipName].layer = 1;
        obj.animation.wrapMode         = WrapMode.Once;
        if (play)
        {
            obj.animation.Play(clipName);
        }
    }
Example #5
0
        //-------------------------------左侧按钮功能区:包括9个按钮:结束--------------------------------------------------


        //---------------------------辅助方法,被调用-------------------------------------------------

        //把从数据库中读出来的数据表转换为abstract序列
        private List <Abstract> DTtoAbstracts(System.Data.DataTable dt)
        {
            List <Abstract> abstracts = new List <Abstract>();

            foreach (DataRow dr in dt.Rows)
            {
                Abstract ab = new Abstract()
                {
                    AttorneyNum = dr["案件信息.我方案号"].ToString(),
                    CaseType    = dr["案件类型"].ToString(),
                    Applicant   = dr["申请人"].ToString(),
                    DocName     = dr["交底名称"].ToString(),
                    CaseStatus  = dr["案件状态"].ToString(),
                    Infosss     = dr["备注"].ToString()
                };
                try
                {
                    ab.Deadline = (DateTime)dr["完成时限"];
                }
                catch
                { }
                abstracts.Add(ab);
            }

            return(abstracts);
        }
Example #6
0
        /// <summary>
        ///     Returns true if PerformanceForecast instances are equal
        /// </summary>
        /// <param name="other">Instance of PerformanceForecast to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PerformanceForecast other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Abstract == other.Abstract ||
                     Abstract != null &&
                     Abstract.Equals(other.Abstract)
                 ) &&
                 (
                     NpasgrUpperLimit == other.NpasgrUpperLimit ||
                     NpasgrUpperLimit != null &&
                     NpasgrUpperLimit.Equals(other.NpasgrUpperLimit)
                 ) &&
                 (
                     NpasgrLowerLimit == other.NpasgrLowerLimit ||
                     NpasgrLowerLimit != null &&
                     NpasgrLowerLimit.Equals(other.NpasgrLowerLimit)
                 ));
        }
Example #7
0
        private bool addAuthors(String authorText, Abstract abs)
        {
            List <String> authors      = authorText.Split(',').ToList();
            var           accountsList = ctrl.repository;
            var           info         = accountsList.ListenerSet.ToList();
            List <Author> toBeAdded    = new List <Author>();
            int           size         = 0;

            foreach (var username in authors)
            {
                foreach (Author a in info)
                {
                    if (a.Username == username)
                    {
                        size++;
                        toBeAdded.Add(a);
                    }
                }
            }
            if (size == authors.Count)
            {
                toBeAdded.Add(initialAuthor);
                foreach (Author auth in toBeAdded)
                {
                    if (!abs.Authors.Contains(auth))
                    {
                        abs.Authors.Add(auth);
                    }
                }
                return(true);
            }
            return(false);
        }
Example #8
0
 public override void FlyInStopped()
 {
     base.FlyInStopped();
     mission.SetActive();
     tutorial = Instantiate(((BaseTutorialMission)mission).tutorialPrefab) as Abstract;
     tutorial.singleTransform.position = new Vector3(0f, 0f, 1.5f);
 }
Example #9
0
        private void abstractsSaveButton_Click(object sender, EventArgs e)
        {
            var context = this.ctrl.repository;

            foreach (DataGridViewRow row in abstractGridView.Rows)
            {
                var chBoxCell = row.Cells[6] as DataGridViewCheckBoxCell;
                if (chBoxCell.Value != null)
                {
                    if (Convert.ToBoolean(chBoxCell.Value) == true)
                    {
                        AbstractBidding ab = new AbstractBidding();
                        int             abstractId;
                        int.TryParse(row.Cells[0].Value.ToString(), out abstractId);
                        Abstract abs        = context.AbstractSet.ToList().Find(a => a.Id == abstractId);
                        int      reviewerId = this.reviewer.Id;
                        ab.Abstract   = abs;
                        ab.AbstractId = abstractId;
                        ab.ReviewerId = reviewerId;
                        ab.Reviewer   = this.reviewer;
                        context.AbstractBiddingSet.Add(ab);
                    }
                    else
                    {
                        AbstractBidding absBid = context.AbstractBiddingSet.ToList().Find(ab => ab.AbstractId ==
                                                                                          int.Parse(row.Cells[0].Value.ToString()) && ab.ReviewerId == this.reviewer.Id);
                        if (absBid != null)
                        {
                            context.AbstractBiddingSet.Remove(absBid);
                        }
                    }
                }
            }
            context.SaveChanges();
        }
Example #10
0
    private void DropPosilkaDynamic(Vector3 moveTo)
    {
        flagPosilka  = true;
        posilkaTimer = Time.time;
        if (VelocityHeadStart > 1)
        {
            VelocityPosilka = 0.6f;
        }
        else
        {
            VelocityPosilka = 0.2f;
        }

        SetRealVelocityWithNoDeltaTime();
        posilka = Instantiate(PosilkaRight) as GameObject;

        Abstract posilkaAbstract = posilka.GetComponent <Abstract>();

        posilkaAbstract.singleTransform.position = characterTransform.position + new Vector3(0, 2, 2);
        float flyTime = 0.3f / (GetRealVelocityWithNoDeltaTime() / startVelocity);

        if (moveTo.x > 0)
        {
            AnimationFactory.FlyXYZRotateXYZ(posilkaAbstract, moveTo, new Vector3(0f, 180f, 0f), flyTime, "FlyXYZRotateXYZ", "FlyXYZRotateXYZStop");
        }
        else
        {
            AnimationFactory.FlyXYZRotateXYZ(posilkaAbstract, moveTo, new Vector3(0f, -180f, 0f), flyTime, "FlyXYZRotateXYZ", "FlyXYZRotateXYZStop");
        }
    }
Example #11
0
        //修改案件基本信息
        private void btnChaneCaseInfo_Click(object sender, RoutedEventArgs e)
        {
            CaseInfo cs = new CaseInfo();
            Abstract ab = (Abstract)lvw3.SelectedItem;

            cs.CaseID = ab.CaseID;
            cs.Show();
        }
Example #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            Abstract @abstract = db.Abstracts.Find(id);

            db.Abstracts.Remove(@abstract);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #13
0
        //双击打开案件详情
        private void lvw3_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            CaseInfo cs = new CaseInfo();
            Abstract ab = (Abstract)lvw3.SelectedItem;

            cs.CurrentDir = CurrentDir;
            cs.CaseID     = ab.CaseID;
            cs.Show();
        }
Example #14
0
        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var            context   = ctrl.repository;
            var            abstracts = context.AbstractSet.ToList();
            int            id        = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());
            Abstract       abs       = abstracts.Find(a => a.Id == id);
            AbstractWindow aw        = new AbstractWindow(author, abs, ctrl);

            aw.Show();
        }
Example #15
0
 public ActionResult Edit([Bind(Include = "Id,Title,Keywords,Description")] Abstract @abstract)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@abstract).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(@abstract));
 }
Example #16
0
        public ActionResult Create([Bind(Include = "Id,Title,Keywords,Description")] Abstract @abstract)
        {
            if (ModelState.IsValid)
            {
                db.Abstracts.Add(@abstract);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(@abstract));
        }
    static void Main(string[] args)
    {
        MockRepository repository = new MockRepository();
        Abstract       mock       = repository.PartialMock <Abstract>();

        using (repository.Record())
        {
            Expect.Call(mock.Bar()).Return(5);
        }

        Console.WriteLine(mock.Foo());     // Prints 10
    }
Example #18
0
            public void building()
            {
                Debug.Log (index_);
                GameManager.GetInstance ().road.onMove += this.doMove;
                _vText.text = "0M";
                this.mode_ = next ();
                index_ = 0;
                chapters_ = 0;

                paragraph_ = 0;
                this.mode_.begin (0.0f, chapters_, paragraph_);
            }
        public ActionResult Review(string notificationId)
        {
            Database     db           = new Database();
            Notification notification = db.FindOne <Notification>(Notification.MongoCollectionName, doc => doc.Id == notificationId);
            Abstract     attachment   = db.FindOne <Abstract>("Abstracts", doc => doc.Id == notification.AttachmentIdString);

            Type        typeOfNotification        = Type.GetType(notification.NotificationType + ", " + Database.AppName); // target type
            Object      dynamicNotificationObject = Activator.CreateInstance(typeOfNotification);                          // an instance of target type
            INotifiable notificationType          = (INotifiable)dynamicNotificationObject;
            string      title = notificationType.Title;

            NewAbstractViewModel viewModel = new NewAbstractViewModel
            {
                Title                      = title,
                UserName                   = notification.UserName,
                Url                        = attachment.Url,
                AttachmentId               = attachment.Id,
                NotificationId             = notification.Id,
                Rehost                     = attachment.Rehost,
                PublicAccess               = attachment.PublicAccess,
                Content                    = attachment.Content,
                DatasetTitle               = attachment.DatasetTitle,
                Authors                    = attachment.Authors,
                Source                     = attachment.Source,
                NumberOfStudies            = attachment.NumberOfStudies,
                SameModalityAndManuf       = attachment.SameModalityAndManuf,
                Modality                   = attachment.Modality,
                Manufacturer               = attachment.Manufacturer,
                HasLabels                  = attachment.HasLabels,
                LabelType                  = attachment.LabelType,
                LabelFormat                = attachment.LabelFormat,
                LabelsReviewed             = attachment.LabelsReviewed,
                ClinicalIssues             = attachment.ClinicalIssues,
                IsAnonymized               = attachment.IsAnonymized,
                HowAnonymized              = attachment.HowAnonymized,
                Country                    = attachment.Country,
                USRegion                   = attachment.USRegion,
                State                      = attachment.State,
                PixelDataShifted           = attachment.PixelDataShifted,
                HowPixelDataShifted        = attachment.HowPixelDataShifted,
                PixelDataSynthesized       = attachment.PixelDataSynthesized,
                HowPixelDataSynthesized    = attachment.HowPixelDataSynthesized,
                MultipleModalitiesAndManuf = attachment.MultipleModalitiesAndManuf,
                ModelsAndVersions          = attachment.ModelsAndVersions,
                DateGenerated              = attachment.DateGenerated
            };

            ViewBag.viewModel = viewModel;

            return(View());
        }
Example #20
0
        // GET: Abstracts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Abstract @abstract = db.Abstracts.Find(id);

            if (@abstract == null)
            {
                return(HttpNotFound());
            }
            return(View(@abstract));
        }
    static void Main(string[] args)
    {
        // Arrange
        Abstract mock = MockRepository.GeneratePartialMock <Abstract>();

        mock.Stub(action => action.Bar()).Return(5);

        // Act
        int result = mock.Foo();

        // Assert
        mock.AssertWasCalled(x => x.Bar());
        // And assert that result is 10...
    }
Example #22
0
    public static void Next(Abstract obj, float secs, float movexTo, int times, string clipName, string stopFunctionName = null, bool play = true)
    {
        AddAnimation(obj.gameObject);
        DeleteClipIfExists(obj.gameObject, clipName);

        AnimationClip  animClip = new AnimationClip();
        AnimationCurve curveX   = AnimationCurve.EaseInOut(0, obj.singleTransform.localPosition.x, secs, obj.singleTransform.localPosition.x);
        AnimationCurve curveY   = AnimationCurve.EaseInOut(0, obj.singleTransform.localPosition.y, secs, obj.singleTransform.localPosition.y);
        AnimationCurve curveZ   = AnimationCurve.EaseInOut(0, obj.singleTransform.localPosition.z, secs, obj.singleTransform.localPosition.z);


        int   n       = times + 2;
        float iterval = 1 / ((float)n - 1);
        bool  odd     = true;

        for (int i = 1; i < n - 1; i++)
        {
            if (odd)
            {
                curveX.AddKey(iterval * i * secs, obj.singleTransform.localPosition.x + movexTo);
            }
            else
            {
                curveX.AddKey(iterval * i * secs, obj.singleTransform.localPosition.x);
            }
            odd = !odd;
        }

        animClip.SetCurve("", typeof(Transform), "localPosition.x", curveX);
        animClip.SetCurve("", typeof(Transform), "localPosition.y", curveY);
        animClip.SetCurve("", typeof(Transform), "localPosition.z", curveZ);

        if (stopFunctionName != null && stopFunctionName != "None")
        {
            AnimationEvent eventStop = new AnimationEvent();
            eventStop.functionName = stopFunctionName;
            eventStop.time         = secs;
            animClip.AddEvent(eventStop);
        }

        obj.animation.AddClip(animClip, clipName);
        obj.animation [clipName].layer = 1;
        if (play)
        {
            obj.animation.Play(clipName);
        }
    }
        public ActionResult SubmitAbstract(AbstractViewModel model)
        {
            /*
             * if (!ModelState.IsValid)
             * {
             *  return View(model);
             * }
             */

            Abstract newAbstract  = new Abstract(User.Identity.GetUserName(), model);
            var      notification = newAbstract.GenerateNewAbstractNotification();

            newAbstract.AddToDb();
            notification.AddToDb();

            return(View("~/Views/Home/Index.cshtml"));
        }
Example #24
0
 private void BlockShape_OnMouseUp(object sender, MouseEventArgs e)
 {
     if (LinkRectangle.Contains(e.Location))
     {
         if (m_linkedLayer != null)
         {
             Abstract.ActiveLayer(m_linkedLayer.Name);
         }
         else
         {
             m_linkedLayer = GenerateLayer(UID.ToString().Trim());
             Abstract.Layers.Add(m_linkedLayer);
             Abstract.ActiveLayer(m_linkedLayer.Name);
         }
         Site.Invalidate();
     }
 }
Example #25
0
    public static void Stamp(Abstract obj, float secs, string clipName, string stopFunctionName = null, bool play = true)
    {
        AddAnimation(obj.gameObject);
        DeleteClipIfExists(obj.gameObject, clipName);

        AnimationClip  animClip = new AnimationClip();
        AnimationCurve curveX   = AnimationCurve.EaseInOut(0, obj.singleTransform.localPosition.x, secs, obj.singleTransform.localPosition.x);
        AnimationCurve curveY   = AnimationCurve.EaseInOut(0, obj.singleTransform.localPosition.y, secs, obj.singleTransform.localPosition.y);
        AnimationCurve curveZ   = AnimationCurve.EaseInOut(0, obj.singleTransform.localPosition.z, secs, obj.singleTransform.localPosition.z);

        AnimationCurve curveRotateX = AnimationCurve.EaseInOut(0, obj.singleTransform.localRotation.x, secs, obj.singleTransform.localRotation.x);
        AnimationCurve curveRotateY = AnimationCurve.EaseInOut(0, obj.singleTransform.localRotation.y, secs, obj.singleTransform.localRotation.y);
        AnimationCurve curveRotateZ = AnimationCurve.EaseInOut(0, obj.singleTransform.localRotation.z, secs, obj.singleTransform.localRotation.z);
        AnimationCurve curveRotateW = AnimationCurve.EaseInOut(0, obj.singleTransform.localRotation.w, secs, obj.singleTransform.localRotation.w);

        curveX.AddKey(0.3f * secs, obj.singleTransform.localPosition.x - 0.03f);
        curveY.AddKey(0.3f * secs, obj.singleTransform.localPosition.y + 0.04f);

        curveRotateX.AddKey(0.3f * secs, obj.singleTransform.localRotation.x + 0.04f);
        curveRotateY.AddKey(0.3f * secs, obj.singleTransform.localRotation.y + 0.035f);

        animClip.SetCurve("", typeof(Transform), "localPosition.x", curveX);
        animClip.SetCurve("", typeof(Transform), "localPosition.y", curveY);
        animClip.SetCurve("", typeof(Transform), "localPosition.z", curveZ);

        animClip.SetCurve("", typeof(Transform), "localRotation.x", curveRotateX);
        animClip.SetCurve("", typeof(Transform), "localRotation.y", curveRotateY);
        animClip.SetCurve("", typeof(Transform), "localRotation.z", curveRotateZ);
        animClip.SetCurve("", typeof(Transform), "localRotation.w", curveRotateW);

        if (stopFunctionName != null && stopFunctionName != "None")
        {
            AnimationEvent eventStop = new AnimationEvent();
            eventStop.functionName = stopFunctionName;
            eventStop.time         = secs;
            animClip.AddEvent(eventStop);
        }

        obj.animation.AddClip(animClip, clipName);
        obj.animation [clipName].layer = 1;
        if (play)
        {
            obj.animation.Play(clipName);
        }
    }
Example #26
0
    public static void MoveRound(Abstract obj, float secs, float radius, string clipName, string stopFunctionName = null, bool play = true)
    {
        AddAnimation(obj.gameObject);
        DeleteClipIfExists(obj.gameObject, clipName);

        int   deleter      = 50;
        float intervalTeta = Mathf.PI * 2 / deleter;
        float intervalTime = secs / deleter;

        float beginPositionX = obj.singleTransform.localPosition.x;
        float beginPositionY = obj.singleTransform.localPosition.y;

        AnimationCurve curveX = AnimationCurve.EaseInOut(0, beginPositionX, secs, beginPositionX);
        AnimationCurve curveY = AnimationCurve.EaseInOut(0, beginPositionY, secs, beginPositionY);
        AnimationCurve curveZ = AnimationCurve.Linear(0, obj.singleTransform.localPosition.z, secs, obj.singleTransform.localPosition.z);

        for (int i = 1; i < deleter; i++)
        {
            curveX.AddKey(new Keyframe(i * intervalTime, obj.singleTransform.localPosition.x - radius + radius * Mathf.Cos(i * intervalTeta)));
            curveY.AddKey(new Keyframe(i * intervalTime, obj.singleTransform.localPosition.y + radius * Mathf.Sin(Mathf.PI * 2 - i * intervalTeta)));
        }

        AnimationClip animClip = new AnimationClip();

        animClip.SetCurve("", typeof(Transform), "localPosition.x", curveX);
        animClip.SetCurve("", typeof(Transform), "localPosition.y", curveY);
        animClip.SetCurve("", typeof(Transform), "localPosition.z", curveZ);

        if (stopFunctionName != null && stopFunctionName != "None")
        {
            AnimationEvent eventStop = new AnimationEvent();
            eventStop.functionName = stopFunctionName;
            eventStop.time         = secs;
            animClip.AddEvent(eventStop);
        }

        obj.animation.AddClip(animClip, clipName);
        obj.animation [clipName].layer = 1;
        obj.animation.wrapMode         = WrapMode.Loop;
        if (play)
        {
            obj.animation.Play(clipName);
        }
    }
Example #27
0
        public static void ValidateMenu(Menu menu, string enterpriseId, Raven.Client.IDocumentSession session, Abstract.ILogger _logger)
        {
            var allProductIds = menu.Categories.SelectMany(c => c.Products);
            var productIds = allProductIds as string[] ?? allProductIds.ToArray();

            var allProducts = session.Load<Product>(productIds);

            //Check if all products belongs to this enterprise
            foreach (var product in allProducts.Where(product => product != null && product.Enterprise != enterpriseId).ToList())
            {
                foreach (var category in from category in menu.Categories from c in category.Products.Where(c => c == product.Id).ToList() select category)
                {
                    category.Products.Remove(product.Id);
                }
                _logger.Warn("Product '{0}' belongs to enterprise: '{1}' was about to be added to '{2}' Code:[hTrsvv563]", product.Id, product.Enterprise, enterpriseId);
            }

            //Remove category if it does not have any products
            foreach (var category in menu.Categories.Where(category => category.Products.Count == 0).ToList())
            {
                menu.Categories.Remove(category);
            }

            try
            {
                var productDuplicates = productIds.GroupBy(p => p.ToUpper()).SelectMany(grp => grp.Skip(1));
                foreach (var productDuplicate in productDuplicates)
                {
                    _logger.Warn("Duplicate in products found: {0}, Enterprise: {1}", productDuplicate, enterpriseId);
                }

                var categoryDuplicates = menu.Categories.GroupBy(c => c.Id.ToUpper()).SelectMany(grp => grp.Skip(1));
                foreach (var categoryDuplicate in categoryDuplicates)
                {
                    _logger.Info("Duplicate in categories found: Name: {0}, Id: {1}, Enterprise: {2}", categoryDuplicate.Name, categoryDuplicate.Id, enterpriseId);
                    categoryDuplicate.Id = GeneralHelper.GetGuid();
                }
            }
            catch (Exception ex)
            {
                _logger.Fatal("ValidateMenu, duplicate check!", ex);
            }
        }
Example #28
0
 // We work with uninstantiated sigma rho sets so that we can pass them on whenever we loop through the collection of all sets
 public static SigmaRhoInstance Instantiate(Abstract type, int n)
 {
     switch (type)
     {
         case Abstract.StrongStableSet: return new StrongStableSet(n);
         case Abstract.PerfectCode: return new PerfectCode(n);
         case Abstract.TotallyNearlyPerfectSet: return new TotallyNearlyPerfectSet(n);
         case Abstract.WeaklyPerfectDominatingSet: return new WeaklyPerfectDominatingSet(n);
         case Abstract.TotalPerfectDominatingSet: return new TotalPerfectDominatingSet(n);
         case Abstract.InducedMatching: return new InducedMatching(n);
         case Abstract.DominatingInducedMatching: return new DominatingInducedMatching(n);
         case Abstract.PerfectDominatingSet: return new PerfectDominatingSet(n);
         case Abstract.IndependentSet: return new IndependentSet(n);
         case Abstract.DominatingSet: return new DominatingSet(n);
         case Abstract.IndependentDominatingSet: return new IndependentDominatingSet(n);
         case Abstract.TotalDominatingSet: return new TotalDominatingSet(n);
         default: throw new Exception("Inexhaustive operation enumeration.");
     }
 }
Example #29
0
        private void BlockShape_OnMouseUp(object sender, MouseEventArgs e)
        {
            PointF p = new PointF(e.X - Site.AutoScrollPosition.X, e.Y - Site.AutoScrollPosition.Y);

            if (LinkRectangle.Contains(p))
            {
                if (m_linkedLayer != null)
                {
                    Abstract.ActiveLayer(m_linkedLayer.Name);
                }
                else
                {
                    m_linkedLayer = GenerateLayer(UID.ToString().Trim());
                    Abstract.Layers.Add(m_linkedLayer);
                    Abstract.ActiveLayer(m_linkedLayer.Name);
                }
                Site.Invalidate();
            }
        }
Example #30
0
        private List <Abstract> DTtoAbstracts1(System.Data.DataTable dt)
        {
            List <Abstract> abstracts = new List <Abstract>();

            foreach (DataRow dr in dt.Rows)
            {
                string   taskname = dr["任务名称"].ToString();
                Abstract ab       = new Abstract()
                {
                    AttorneyNum = dr["我方文号"].ToString(),
                    TaskID      = dr["案件任务ID"].ToString(),
                    CaseID      = dr["Tasks.案件ID"].ToString(),
                    CaseType    = dr["申请类型"].ToString() + ":" + dr["任务名称"].ToString() + ":" + dr["任务属性"].ToString(),
                    Applicant   = dr["客户名称"].ToString(),
                    DocName     = dr["开案名称"].ToString(),
                    CaseStatus  = dr["代理人处理状态"].ToString(),
                    Infosss     = dr["案件备注"].ToString()
                };
                if (taskname == "OA答复" || taskname == "答复补正" || taskname == "驳回提复审(先请客户确认)")
                {
                    try
                    {
                        ab.Deadline = (DateTime)dr["官方期限"];
                    }
                    catch
                    { }
                }
                else
                {
                    try
                    {
                        ab.Deadline = (DateTime)dr["定稿期限(内)"];
                    }
                    catch
                    { }
                }

                abstracts.Add(ab);
            }

            return(abstracts);
        }
        public async Task <ActionResult> Review(NewAbstractViewModel model)
        {
            Database     db           = new Database();
            Notification notification = db.FindOne <Notification>(Notification.MongoCollectionName, doc => doc.Id == model.NotificationId);

            notification.Resolve(User.Identity.GetUserName());
            notification.UpdateInDb();

            Abstract reviewedAbstract = db.FindOne <Abstract>("Abstracts", doc => doc.Id == model.AttachmentId);

            reviewedAbstract.Review(User.Identity.GetUserName(), model.Approved, model.Rationale);
            reviewedAbstract.UpdateInDb();

            EmailModel email = new EmailModel(reviewedAbstract.UserName);

            email.MakeAbstractReviewedEmail(model.Approved, model.Rationale);
            await email.Send();

            return(View("Index"));
        }
        public void SerialisationAbstractObjects()
        {
            var nk = new NonKitClass()
            {
                TestProp = "Hello", Numbers = new List <int>()
                {
                    1, 2, 3, 4, 5
                }
            };
            var abs = new Abstract(nk);

            var transport = new MemoryTransport();

            var abs_serialized      = Operations.Serialize(abs);
            var abs_deserialized    = Operations.Deserialize(abs_serialized);
            var abs_se_deserializes = Operations.Serialize(abs_deserialized);

            Assert.AreEqual(abs.GetId(), abs_deserialized.GetId());
            Assert.AreEqual([email protected](), ((Abstract)abs_deserialized)[email protected]());
        }
Example #33
0
        public void AbstractHashing()
        {
            var nk1  = new NonKitClass();
            var abs1 = new Abstract(nk1);

            var nk2 = new NonKitClass()
            {
                TestProp = "HEllo"
            };
            var abs2 = new Abstract(nk2);

            var abs1H = abs1.GetId();
            var abs2H = abs2.GetId();

            Assert.AreNotEqual(abs1H, abs2H);

            nk1.TestProp = "Wow";

            Assert.AreNotEqual(abs1H, abs1.GetId());
        }
Example #34
0
            private void doMove(float length)
            {
                if (mode_ == null || mode_.isOver ()) {
                    if(length - length_  >= _step){
                        length_ = length;
                        ++paragraph_;
                        if(paragraph_ >= 5){
                            paragraph_ = 0;
                            ++chapters_;
                        }

                    }
                    if(mode_ != null){
                        mode_.end ();
                    }
                    mode_ = next();
                    mode_.begin(length, chapters_, paragraph_);
                }

                mode_.doMove (length);
                _vText.text = Mathf.FloorToInt(length).ToString()+ "M";
            }
 public CustomerSubscriptionAccess(Abstract.IAccess access)
     : base(access)
 {
 }
Example #36
0
 public Submission(Abstract.BBCS.Request req, string endpoint, string authHeader)
 {
     _request = req;
     _endpoint = endpoint;
     _authHeader = authHeader;
 }
Example #37
0
 public void AddToComplexLine(Abstract.Shape shape)
 {
     _complexLine.add(shape);
 }
Example #38
0
        public static Enterprise CreateFakeEnterprise(Abstract.Db.IDb Db,bool modified)
        {
            var enterprise = new Enterprise
                                 {
                                     Id = EnterpriseHelper.GetId(GeneralHelper.GetGuid()),
                                     Name = RandomString(),
                                     Categories = RandomListString(),
                                     LastUpdated = DateTime.Now,
                                     Coordinates = RandomCoordinates(),
                                     StreetRoute = RandomString(),
                                     County = "Stockholm"
                                 };
            var menu = new Menu();
            var categories = new List<Category>();

            var products = new List<Product>();

            for (var i = 0; i < _random.Next(35, 40); i++)
            {
                var category = new Category
                                      {
                                          Id = GeneralHelper.GetGuid(),
                                          Name = RandomString(),
                                          Products = new List<string>()
                                      };
                for (var j = 0; j < _random.Next(1, 2); j++)
                {
                    var product = NewProduct(enterprise.Id,modified);


                    products.Add(product);
                    category.Products.Add(product.Id);
                }
                categories.Add(category);
            }


            menu.Categories = categories;


            if(!modified)
            {
                enterprise.IsNew = true; 
            }

            enterprise.Menu = menu;
            
            Db.Enterprises.CreateEnterprise(enterprise);
            Db.Products.AddProductsToDb(products);

            if(modified)
            {
                Thread.Sleep(1000);
                var categoryCount = enterprise.Menu.Categories.Count;

                //Remove random products
                for (var i = 0; i < _random.Next(1, 4); i++)
                {
                    var randomCategory = enterprise.Menu.Categories[_random.Next(categoryCount)];
                    var productCountForCategory = randomCategory.Products.Count;
                    enterprise.Menu.Categories[_random.Next(categoryCount)].Products.RemoveAt(_random.Next(productCountForCategory));
                }

                //Create new products
                var newProducts = new List<Product>();
                for (var i = 0; i < _random.Next(1, 8);i++ )
                {
                    newProducts.Add(NewProduct(enterprise.Id,false));
                }

                //Add the new products to random categories in random places
                foreach (var newProduct in newProducts)
                {
                    var randomCategory = enterprise.Menu.Categories[_random.Next(categoryCount)];
                    var productCountForCategory = randomCategory.Products.Count;
                    randomCategory.Products.Insert(_random.Next(productCountForCategory),newProduct.Id);
                }

                Db.Products.AddProductsToDb(newProducts);
                Thread.Sleep(1000);
                Db.Enterprises.UpdateEnterprise(enterprise.Id, enterprise.Menu);
            }

            return enterprise;
        }
Example #39
0
 public DataSource(Abstract.Initializer initializer)
 {
     Initializer = initializer;
 }
 public PublisherAccess(Abstract.IAccess access)
     : base(access)
 {
 }
 public StoreAccess(Abstract.IAccess access)
     : base(access)
 {
 }
 public ComicBookSeriesAccess(Abstract.IAccess access)
     : base(access)
 {
 }
Example #43
0
 public Transactional(Abstract.BBCS.Request req, string endpoint, string authHeader)
 {
     base._request = req;
     base._endpoint = endpoint;
     base._authHeader = authHeader;
     base._method = "POST";
 }
 public CustomerAccess(Abstract.IAccess access)
     : base(access)
 {
 }
Example #45
0
 public BulkProcess(Abstract.BBCS.Request req, string endpoint, string authHeader)
 {
     base._request = req;
     base._endpoint = endpoint;
     base._authHeader = authHeader;
     base._method = "POST";
 }