Ejemplo n.º 1
0
 /// <summary>
 /// Returns a System.Net.Http.Headers.AuthenticationHeaderValue that represents the current TokenInfo.
 /// </summary>
 /// <param name="schemeCase">The scheme case.</param>
 /// <param name="parameterCase">The parameter case.</param>
 /// <returns>A System.Net.Http.Headers.AuthenticationHeaderValue that represents the current TokenInfo.</returns>
 public AuthenticationHeaderValue ToAuthenticationHeaderValue(Cases schemeCase = Cases.Original, Cases parameterCase = Cases.Original)
 {
     return(AccessToken != null
         ? new AuthenticationHeaderValue(
                StringExtensions.ToSpecificCaseInvariant(TokenType, schemeCase),
                StringExtensions.ToSpecificCaseInvariant(AccessToken, parameterCase))
         : new AuthenticationHeaderValue(
                StringExtensions.ToSpecificCaseInvariant(TokenType, schemeCase)));
 }
 public ActionResult Save(Cases cases)
 {
     if (cases != null)
     {
         cases.CaseType = (int)CaseType;
     }
     cases = CasesService.SaveCase(cases);
     return(RedirectToAction("Edit", new RouteValueDictionary(new { id = cases.CaseId })));
 }
Ejemplo n.º 3
0
 public CaseWindow(Cases pCase)
 {
     InitializeComponent();
     ModelContainerHolder.UpdateModel();
     m_case = pCase;
     ModelContainerHolder.Model.Cases.Attach(m_case);
     this.Title = pCase.Id.ToString() + " - " + pCase.Customer.Name;
     InitBindings();
 }
Ejemplo n.º 4
0
        public override void UpdateCases(Cases cases)
        {
            if (cases != null && cases.ID > 0)
            {
                ResetCache(cases.ID);
            }

            base.UpdateCases(cases);
        }
Ejemplo n.º 5
0
        public ActionResult CaseDetails(int id)
        {
            var cases = new Cases();
            var cs    = _cr.GetCase(id);

            cases.Case          = cs;
            cases.personelModel = _pr.GetUserById(cs.UserId);
            return(View(cases));
        }
Ejemplo n.º 6
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("YES or No?", "Are you sure you want to Update this Information? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                foreach (var s in typeListBx.CheckedItems)
                {
                    TypeDictionary.Add(s.ToString(), true);
                }
                foreach (var s in placeListBx.CheckedItems)
                {
                    PlaceDictionary.Add(s.ToString(), true);
                }

                var TypeJson  = JsonConvert.SerializeObject(TypeDictionary);
                var PlaceJson = JsonConvert.SerializeObject(PlaceDictionary);

                Cases i = new Cases(CaseID, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, providerNoTxt.Text, coverageID, CustomerID, PractitionerID, practictionerTypeCbx.Text, roleTypeCbx.Text, TypeJson, PlaceJson, informationTxt.Text, DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Convert.ToDateTime(reqStart.Text).ToString("dd-MM-yyyy"), Convert.ToDateTime(reqEnd.Text).ToString("dd-MM-yyyy"), Convert.ToDateTime(reqStart.Text).ToString("dd-MM-yyyy"), Convert.ToDateTime(reqEnd.Text).ToString("dd-MM-yyyy"), "false", Helper.CompanyID);
                DBConnect.UpdateMySql(i, CaseID);
                if (MessageBox.Show("YES or NO?", "Would you like to add these products to your case list ?  ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    string Query = "DELETE from caseCaseTransaction WHERE caseID ='" + CaseID + "'";
                    MySQL.Query(Query);
                    Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                    MySQL.Insert(q);

                    foreach (CaseTransaction t in GenericCollection.caseTransactions)
                    {
                        CaseTransaction c = new CaseTransaction(t.Id, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, t.ItemID, CaseID, "", t.Qty, t.Cost, t.Units, t.Total, t.Tax, t.Coverage, t.Self, t.Payable, t.Limits, t.Setting, t.Period, t.Height, t.Weight, t.Instruction, t.Created, "false", Helper.CompanyID);

                        DBConnect.UpdateMySql(c, t.Id);
                    }
                }
                if (MessageBox.Show("YES or NO?", "Would you like to add these products to your case list ?  ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    //string Query = "DELETE from icd10 WHERE caseID ='" + CaseID + "'";
                    //MySQL.Query(Query);

                    //Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                    //MySQL.Insert(q);
                    //foreach (ICD10 t in GenericCollection.icd10)
                    //{
                    //    ICD10 c = new ICD10(t.Id, CaseID, t.Code, t.Name, t.Created, "false", Helper.CompanyID);
                    //    string sv = DBConnect.UpdateMySql(c, t.Id);

                    //    Queries qy = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(sv), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                    //    MySQL.Insert(qy);
                    //}
                }

                // foreach (ItemCoverage t in GenericCollection.itemCoverage)
                // {

                // }
                MessageBox.Show("Information Saved");
                this.Close();
            }
        }
Ejemplo n.º 7
0
        public CasesWrapper CreateCases(
            string title,
            IEnumerable <int> members,
            IEnumerable <ItemKeyValuePair <int, string> > customFieldList,
            bool isPrivate,
            IEnumerable <Guid> accessList)
        {
            if (string.IsNullOrEmpty(title))
            {
                throw new ArgumentException();
            }

            var casesID = DaoFactory.GetCasesDao().CreateCases(title);

            var cases = new Cases
            {
                ID       = casesID,
                Title    = title,
                CreateBy = SecurityContext.CurrentAccount.ID,
                CreateOn = DateTime.UtcNow
            };

            var accessListLocal = accessList != null?accessList.ToList() : new List <Guid>();

            if (isPrivate && accessListLocal.Any())
            {
                CRMSecurity.SetAccessTo(cases, accessListLocal);
            }
            else
            {
                CRMSecurity.MakePublic(cases);
            }

            var membersList = members != null?members.ToList() : new List <int>();

            if (membersList.Any())
            {
                var contacts = DaoFactory.GetContactDao().GetContacts(membersList.ToArray()).Where(CRMSecurity.CanAccessTo).ToList();
                membersList = contacts.Select(m => m.ID).ToList();
                DaoFactory.GetCasesDao().SetMembers(cases.ID, membersList.ToArray());
            }

            if (customFieldList != null)
            {
                var existingCustomFieldList = DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Case).Select(fd => fd.ID).ToList();
                foreach (var field in customFieldList)
                {
                    if (string.IsNullOrEmpty(field.Value) || !existingCustomFieldList.Contains(field.Key))
                    {
                        continue;
                    }
                    DaoFactory.GetCustomFieldDao().SetFieldValue(EntityType.Case, cases.ID, field.Key, field.Value);
                }
            }

            return(ToCasesWrapper(DaoFactory.GetCasesDao().GetByID(casesID)));
        }
Ejemplo n.º 8
0
        public Expression Update(Expression switchValue, IEnumerable <SwitchCase> cases, Expression defaultBody)
        {
            if (SwitchValue.Equals(switchValue) && Cases.Equals(cases) && ReferenceEquals(DefaultBody, defaultBody))
            {
                return(this);
            }

            return(AstExpression.Switch(_switchStatement, ParentScope, Visitor));
        }
Ejemplo n.º 9
0
 public void copy(PierceObject script)
 {
     goal       = script.goal;
     cases      = script.cases;
     go_time    = script.go_time;
     out_time   = script.out_time;
     tag_int    = script.tag_int;
     stay_first = script.stay_first;
 }
Ejemplo n.º 10
0
        public MainWindow()
        {
            InitializeComponent();

            LogHelper.WriteLog("<-------加载开始了!");
            LoadVectorMap(); //加载矢量地图
            LoadImageMap();  //加载影像地图-------考虑异步加载,节省程序加载时间

            PublicParams.pubMainMap      = mainMap;
            PublicParams.pubLayoutRoot   = LayoutRoot;
            PublicParams.pubInfoWin      = mainInfoWindow;
            PublicParams.pubCanvasChild1 = canvasChild1;

            if (PublicParams.IsInitLayers != "0")
            {
                MapLayers.InitMapLayers();//初始化地图所需的图层,静态方法
            }

            //ShowOneCrimePoint();//添加一个模拟的案件点

            //Task taskConnectDVCSServer = new Task(ConnectDVCSServerInTask);//DVCS服务器连接相关
            //taskConnectDVCSServer.Start();
            PublicParams.dvcsServerMain = new DVCSServer()
            {
                dvcsServerIP = PublicParams.DVCSIP, dvcsServerPort = PublicParams.DVCSPort, dvcsName = PublicParams.dvcsServerMainName
            };
            ConnectDVCSServerInTask(PublicParams.dvcsServerMain);
            PublicParams.dvcsServer2 = new DVCSServer()
            {
                dvcsServerIP = PublicParams.DVCSIP2, dvcsServerPort = PublicParams.DVCSPort2, dvcsName = PublicParams.dvcsServer2Name
            };
            ConnectDVCSServerInTask(PublicParams.dvcsServer2);

            PadHelper.InitPads();                //初始化信息窗
            WallVideosHelper.InitOpenedVideos(); //初始化已打开视频列表


            PoliceCarGPS gpsPoliceCar = new PoliceCarGPS(); //MQ相关,接收警车GPS信号
            Cases        cases        = new Cases();        //MQ相关,接收案件信息
            Traffic      traffic      = new Traffic();

            drawBuffer = new Draw(mainMap)
            {
                LineSymbol = App.Current.Resources["DrawLineSymbol"] as LineSymbol,
                FillSymbol = App.Current.Resources["DrawFillSymbol"] as FillSymbol
            };
            drawBuffer.DrawComplete += drawBuffer_DrawComplete;

            drawLenOrArea = new Draw(PublicParams.pubMainMap)
            {
                LineSymbol = App.Current.Resources["DrawLineSymbol"] as LineSymbol,
                FillSymbol = App.Current.Resources["DrawFillSymbol"] as FillSymbol
            };
            drawLenOrArea.DrawComplete += drawLenOrArea_DrawComplete;
            LogHelper.WriteLog("<-------加载完成了!");
        }
Ejemplo n.º 11
0
        //
        // GET: /Admin/Cases/Delete/5

        public ActionResult Delete(int id = 0)
        {
            Cases cases = db.Cases.Find(id);

            if (cases == null)
            {
                return(HttpNotFound());
            }
            return(View(cases));
        }
Ejemplo n.º 12
0
        public async Task <ActionResult <Cases> > EditCase(long id, Cases editCase)
        {
            var editableCase = await _context.cases.FindAsync(id);

            _context.cases.Update(editableCase).CurrentValues.SetValues(editCase);

            _context.SaveChanges();

            return(Ok());
        }
Ejemplo n.º 13
0
 public SwitchExtension(Binding to, CaseExtension item0, CaseExtension item1, CaseExtension item2, CaseExtension item3, CaseExtension item4, CaseExtension item5)
     : this(to)
 {
     Cases.Add(item0);
     Cases.Add(item1);
     Cases.Add(item2);
     Cases.Add(item3);
     Cases.Add(item4);
     Cases.Add(item5);
 }
Ejemplo n.º 14
0
 public ActionResult Edit([Bind(Include = "id,Title,Description,File,StartDate,EndDate")] Cases cases)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cases).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cases));
 }
 public SwitchExtension(Binding condition, CaseExtension item0, CaseExtension item1, CaseExtension item2, CaseExtension item3, CaseExtension item4, CaseExtension item5)
     : this(condition)
 {
     Cases.Add(item0);
     Cases.Add(item1);
     Cases.Add(item2);
     Cases.Add(item3);
     Cases.Add(item4);
     Cases.Add(item5);
 }
Ejemplo n.º 16
0
 public ActionResult Edit([Bind(Include = "CaseID,CaseName")] Cases cases)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cases).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cases));
 }
Ejemplo n.º 17
0
        public IEnumerable <Case> GetActiveCasesAtDate(DateTime refDate)
        {
            var activeCases = Cases
                              .Where(x => (!x.StartDate.HasValue || x.StartDate.Value <= refDate) &&
                                     (!x.EndDate.HasValue || x.EndDate.Value >= refDate) &&
                                     x.Active &&
                                     x.Case.Status > CaseStatus.History);

            return(activeCases.Select(x => x.Case).ToList());
        }
        public FileContentResult CasePhoto(int id)
        {
            Cases Case = context.Cases.Where(x => x.Id == id).First();

            if (Case != null && Case.Image != null)
            {
                return(new FileContentResult(Case.Image, "image/png"));
            }
            return(null);
        }
Ejemplo n.º 19
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                textBox1.Text = "";
                //checkedListBox2.Visible = false;
            }
            else
            {
                if (parentIndex.Count <= 0)
                {
                    parentIndex.Push(1);
                }
                if (currentCase != Cases.Floors)
                {
                    listBox1.Items.Clear();
                }
                switch (currentCase)
                {
                case Cases.Floors:
                    break;

                case Cases.Categories:
                    FillFloors();
                    currentCase = Cases.Floors;
                    checkedShops.Clear();
                    listBox1.SelectedIndex = parentIndex.First();
                    label2.Text            = "";
                    break;

                case Cases.Shops:
                    listBox1.Visible        = true;
                    checkedListBox1.Visible = false;

                    FillCategories();
                    currentCase            = Cases.Categories;
                    listBox1.SelectedIndex = parentIndex.First();
                    label3.Text            = "";
                    break;

                case Cases.ShopInfo:
                    //checkedListBox1.Items.Clear();
                    //FillShops();
                    checkedListBox1.Visible       = true;
                    listBox1.Visible              = false;
                    currentCase                   = Cases.Shops;
                    checkedListBox1.SelectedIndex = parentIndex.First();
                    break;
                }
                if (parentIndex.Count > 0)
                {
                    parentIndex.Pop();
                }
            }
        }
        protected override int GetHandledCaseNumber(SuperSlimBoard b, BreakerChoiceInfo bc)
        {
            var childBoard = new SuperSlimBoard(b._trace, bc.Alpha, bc.Beta, bc.Response, b._stackCount);

            if (Cases[0].Boards.Contains(childBoard))
            {
                return(1);
            }

            return(Cases.Skip(1).IndicesWhere(cc => cc.Boards.SelectMany(bb => new[] { bb }.Union(_permutationLinked[bb].Select(tup => tup.Item2))).Contains(childBoard)).First() + 2);
        }
Ejemplo n.º 21
0
        public override IEnumerable <ConfiguredActivity> Execute(object dataContext)
        {
            var paramValue = Parameter.ResolveValue(dataContext);

            if (paramValue != null && Cases.ContainsKey(paramValue))
            {
                return(Further(Cases[paramValue], dataContext));
            }

            return(Further(Default, dataContext));
        }
Ejemplo n.º 22
0
 public object CreatedofModied(Cases cases)
 {
     if (cases.Id == 0)
     {
         return(CreateCases(cases));
     }
     else
     {
         return(ModifiedCases(cases));
     }
 }
Ejemplo n.º 23
0
        public void GetStringTranscription_IncorrectNumber_Exception(char number, Cases caseVal, Genders genderVal)
        {
            //arrange
            var belowTenDict = new BelowTen();

            //act
            TestDelegate result = () => belowTenDict.GetStringTranscription(number, caseVal, genderVal);

            //assert
            Assert.Throws <InvalidDataException>(result);
        }
Ejemplo n.º 24
0
 public Cases GetCase(int caseId)
 {
     Cases cases = CasesData.GetCase(caseId);
     if (cases != null)
     {
         cases.CaseItems = CasesData.LoadCaseItemsByCaseId(caseId);
         cases.CaseItems = cases.CaseItems ?? new List<CaseItem>(0);
         LoadCaseItemAttachment(cases.CaseItems);
     }
     return cases;
 }
Ejemplo n.º 25
0
        private bool PhoneFilter(object obj)
        {
            Cases item = obj as Cases;

            if (item == null)
            {
                return(false);
            }

            return(TextSearchFilter(item.Customer.PhoneNumber, PhoneTextBox.Text));
        }
Ejemplo n.º 26
0
        private bool InfoTextFilter(object obj)
        {
            Cases item = obj as Cases;

            if (item == null)
            {
                return(false);
            }

            return(TextSearchFilter(item.Info, TextTextBox.Text));
        }
Ejemplo n.º 27
0
        private bool LocationFilter(object obj)
        {
            Cases item = obj as Cases;

            if (item == null)
            {
                return(false);
            }

            return(TextSearchFilter(item.Customer.Company.Location.Name, LocationTextBox.Text));
        }
Ejemplo n.º 28
0
        public ActionResult Create([Bind(Include = "CaseID,CaseName")] Cases cases)
        {
            if (ModelState.IsValid)
            {
                db.Cases.Add(cases);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cases));
        }
 public void SetCases(Cases cases)
 {
     flowLayoutPanel1.Controls.Clear();
     _attempts = 0;//если заполняем вариантами ответов, то это новый вопрос.
     foreach (var @case in cases.CaseList)
     {
         //Здесь добавляем нужный контрол. Вмето RadioButton добавляем CaseControl
         var cc = new CaseControl(@case);
         flowLayoutPanel1.Controls.Add(cc);
     }
 }
Ejemplo n.º 30
0
        private bool CustomerFilter(object obj)
        {
            Cases item = obj as Cases;

            if (item == null)
            {
                return(false);
            }

            return(TextSearchFilter(item.Customer.Name, CustomerTextBox.Text));
        }
Ejemplo n.º 31
0
        public Cases SaveCase(Cases cases)
        {
            SetDefaultTime(cases);
            cases = CasesData.SaveCase(cases);

            if (cases.CaseItems != null && cases.CaseItems.Count > 0)
            {
                cases.CaseItems.ForEach(SetDefaultTime);
                cases.CaseItems = CasesData.SaveCaseItems(cases.CaseItems);
            }

            return cases;
        }
Ejemplo n.º 32
0
 private void SetDefaultTime(Cases cases)
 {
     if (cases != null && cases.CreateDate == DateTime.MinValue) cases.CreateDate = DateTime.Now;
 }
Ejemplo n.º 33
0
            public static Cases Good1()
            {
                if (ms_instance == null)
                {
                    lock (ms_lock)
                    {
                        if (ms_instance == null)
                        {
                            ms_instance = new Cases();
                        }
                    }
                }

                return ms_instance;
            }
Ejemplo n.º 34
0
 public int CheckDoubleInter(int x, int y, Cases pawn)
 {
     int spaces = 0;
     int three = 0;
     int h = 0;
     if (x != 0 && x != 18 && map[x - 1][y] == pawn && map[x + 1][y] == pawn)
     {
         for (int i = 1; x + i < 18 && map[x + i][y] == pawn; ++i)
             ++h;
         for (int i = -1; x + i > 0 && map[x + i][y] == pawn; --i)
             ++h;
         if (h == 2)
             ++three;
         h = 0;
     }
     else
     {
         for (int i = 0; x + i < 18; ++i)
         {
             if (map[x + i][y] == pawn && i != 0)
                 ++h;
             else if (map[x + i][y] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y] != Cases.empty && map[x + i][y] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
         spaces = 0;
         h = 0;
         for (int i = 0; x + i > 0; --i)
         {
             if (map[x + i][y] == pawn && i != 0)
                 ++h;
             else if (map[x + i][y] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y] != Cases.empty && map[x + i][y] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
     }
     h = 0;
     spaces = 0;
     if (y != 0 && y != 18 && map[x][y - 1] == pawn && map[x][y + 1] == pawn)
     {
         for (int i = 1; y + i < 18 && map[x][y + i] == pawn; ++i)
             ++h;
         for (int i = -1; y + i > 0 && map[x][y + i] == pawn; --i)
             ++h;
         if (h == 2)
             ++three;
         h = 0;
     }
     else
     {
         for (int i = 0; y + i < 18; ++i)
         {
             if (map[x][y + i] == pawn && i != 0)
                 ++h;
             else if (map[x][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x][y + i] != Cases.empty && map[x][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
         spaces = 0;
         h = 0;
         for (int i = 0; y + i > 0; --i)
         {
             if (map[x][y + i] == pawn && i != 0)
                 ++h;
             else if (map[x][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x][y + i] != Cases.empty && map[x][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
     }
     spaces = 0;
     h = 0;
     if (x != 0 && x != 18 && y != 0 && y != 18 && map[x - 1][y - 1] == pawn && map[x + 1][y + 1] == pawn)
     {
         for (int i = 1; x + i < 18 && y + i < 18 && map[x + i][y + i] == pawn; ++i)
         {
             ++h;
         }
         for (int i = -1; x + i > 0 && y + i > 0 && map[x + i][y + i] == pawn; --i)
             ++h;
         if (h == 2)
             ++three;
         h = 0;
     }
     else
     {
         for (int i = 0; x + i < 18 && y + i < 18; ++i)
         {
             if (map[x + i][y + i] == pawn && i != 0)
                 ++h;
             else if (map[x + i][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y + i] != Cases.empty && map[x + i][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
         spaces = 0;
         h = 0;
         for (int i = 0; x + i > 0 && y + i > 0; --i)
         {
             if (map[x + i][y + i] == pawn && i != 0)
                 ++h;
             else if (map[x + i][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y + i] != Cases.empty && map[x + i][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
     }
     h = 0;
     spaces = 0;
     if (x != 0 && x != 18 && y != 0 && y != 18 && map[x - 1][y + 1] == pawn && map[x + 1][y - 1] == pawn)
     {
         for (int i = 1; x + i < 18 && y - i > 0 && map[x + i][y - i] == pawn; ++i)
             ++h;
         for (int i = -1; x + i > 0 && y - i < 18 && map[x + i][y - i] == pawn; --i)
             ++h;
         if (h == 2)
             ++three;
         h = 0;
     }
     else
     {
         for (int i = 0; x + i < 18 && y - i > 0; ++i)
         {
             if (map[x + i][y - i] == pawn && i != 0)
                 ++h;
             else if (map[x + i][y - i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y - i] != Cases.empty && map[x + i][y - i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
         spaces = 0;
         h = 0;
         for (int i = 0; x + i > 0 && y - i < 18; --i)
         {
             if (map[x + i][y - i] == pawn && i != 0)
                 ++h;
             else if (map[x + i][y - i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y - i] != Cases.empty && map[x + i][y - i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
             ++three;
     }
     return three;
 }
Ejemplo n.º 35
0
 private void CheckWin(int x, int y, Cases pawn)
 {
     if (usedPoint.Count == 361)
         gameUI.DrawScreen();
     if (captured[Convert.ToInt32(playTurn)] >= 10)
     {
         gameUI.WinScreen(Convert.ToInt32(playTurn) + 1);
         finish = true;
     }
     CheckFive(x, y, pawn);
     if (pWin.Count > 0)
     {
         foreach(ArrayList t in pWin)
         {
             ReCheck(t);
         }
     }
 }
Ejemplo n.º 36
0
    private bool isCapturable(int x, int y, Cases pawn)
    {
        int h = 0;

        if ((x == 0 || x == 18) && (y == 0 || y == 18))
            return false;
        for (int i = 1; y + i < 18 && map[x][y + i] == pawn && h < 2; ++i)
            ++h;
        for (int i = -1; y + i > 0 && map[x][y + i] == pawn && h < 2; --i)
            ++h;
        if (h == 1)
        {
            if (x == 0 || x == 18)
            {
                if ((y + 1 == 18 && map[x][y + 1] == pawn) || (y - 1 == 0 && map[x][y - 1] == pawn))
                    return false;
                if ((y + 2 <= 18 && map[x][y + 1] != Cases.empty && map[x][y + 1] != pawn && map[x][y + 1] == map[x][y - 2]) ||
                    (y - 2 >= 0 && map[x][y - 1] != Cases.empty && map[x][y - 1] != pawn && map[x][y - 1] == map[x][y + 2]))
                    return false;
            }
            return true;
        }
        h = 0;
        for (int i = 1; x + i < 18 && map[x + i][y] == pawn && h < 2; ++i)
            ++h;
        for (int i = -1; x + i > 0 && map[x + i][y] == pawn && h < 2; --i)
            ++h;
        if (h == 1)
        {
            if (y == 0 || y == 18)
            {
                if ((x + 1 == 18 && map[x + 1][y] == pawn) || (x - 1 == 0 && map[x - 1][y] == pawn))
                    return false;
                if ((x - 2 >= 0 && map[x + 1][y] != Cases.empty && map[x + 1][y] != pawn && map[x + 1][y] == map[x - 2][y]) ||
                    (x + 2 <= 18 && map[x - 1][y] != Cases.empty && map[x - 1][y] != pawn && map[x - 1][y] == map[x + 2][y]))
                    return false;
            }
            return true;
        }
        if (x != 0 && x != 18 && y != 0 && y != 18)
        {
            h = 0;
            int k = 1;
            int j = 1;
            while (x + k < 18 && y + j < 18 && map[x + k][y + j] == pawn && h < 2)
            {
                ++k;
                ++j;
                ++h;
                if (h >= 2)
                    break;
            }
            k = -1;
            j = -1;
            while (x + k > 0 && y + j > 0 && map[x + k][y + j] == pawn && h < 2)
            {
                --k;
                --j;
                ++h;
                if (h >= 2)
                    break;
            }
            if (h == 1)
            {
                if ((x + 1 != 18 && y + 1 != 18) && (x - 1 != 0 && y - 1 != 0))
                    if (!((x - 2 >= 0 && y - 2 >= 0 && map[x + 1][y + 1] != Cases.empty && map[x + 1][y + 1] != pawn && map[x + 1][y + 1] == map[x - 2][y - 2]) ||
                        (x + 2 <= 18 && y + 2 <= 18 && map[x - 1][y - 1] != Cases.empty && map[x - 1][y - 1] != pawn && map[x - 1][y - 1] == map[x + 2][y + 2])))
                            return true;
            }
            h = 0;
            k = 1;
            j = -1;
            while (x + k < 18 && y + j > 0 && map[x + k][y + j] == pawn && h < 2)
            {
                ++k;
                --j;
                ++h;
                if (h >= 2)
                    break;
            }
            k = -1;
            j = 1;
            while (x + k > 0 && y + j < 18 && map[x + k][y + j] == pawn && h < 2)
            {
                --k;
                ++j;
                ++h;
            }
            if (h == 1)
            {
                if ((x - 1 != 0 && y + 1 != 18) && (x + 1 != 18 && y - 1 != 0))
                    if (!((x - 2 >= 0 && y + 2 <= 18 && map[x - 1][y + 1] != Cases.empty && map[x - 1][y + 1] != pawn && map[x - 1][y + 1] == map[x + 2][y - 2]) ||
                        (x + 2 <= 18 && y - 2 >= 0 && map[x + 1][y - 1] != Cases.empty && map[x + 1][y - 1] != pawn && map[x + 1][y - 1] == map[x - 2][y + 2])))
                        return true;
            }
        }
        return false;
    }
Ejemplo n.º 37
0
    // Use this for initialization
    void Start()
    {
        int x;
        int y;

        firstTurn = true;
        finish = false;
        isPaused = false;
        playTurn = false;
        try
        {
            gameUI = GameObject.FindObjectOfType<GameUIManager>();
            if (gameUI == null)
                throw new NullReferenceException("Missing the gameUI");
        }
        catch (Exception e)
        {
            ErrorUI.error = e.Message;
            LevelManager.getInstance().LoadLevel("Error");
            Destroy(GameObject.Find("UIManager"));
        }
        usedPoint = new Dictionary<Vector2, ClickPoint>();
        pWin = new List<ArrayList>();
        map = new Cases[19][];
        captured = new int[2];
        captured[0] = 0;
        captured[1] = 0;
        for (x = 0; x != 19; ++x)
        {
            map[x] = new Cases[19];
            for (y = 0; y != 19; ++y)
            {
                map[x][y] = Cases.empty;
                Instantiate(clickPointPrefab, new Vector3(x, 0.5f, y), Quaternion.identity);
            }
        }
    }
Ejemplo n.º 38
0
 public Cases SaveCase(Cases cases)
 {
     return CasesManager.SaveCase(cases);
 }
Ejemplo n.º 39
0
            // silly
            public static Cases Bad3()
            {
                if (Thread.VolatileRead(ref ms_initialized) == 0)
                {
                    lock (ms_lock)
                    {
                        if (ms_instance == null)
                        {
                            ms_instance = new Cases();
                            ms_initialized = 1;
                        }
                    }
                }

                return ms_instance;
            }
Ejemplo n.º 40
0
 public ActionResult Save(Cases cases)
 {
     if (cases != null) cases.CaseType = (int)CaseType;
     cases = CasesService.SaveCase(cases);
     return RedirectToAction("Edit", new RouteValueDictionary(new { id = cases.CaseId }));
 }
Ejemplo n.º 41
0
            // incorrect
            public static Cases Bad2()
            {
                if (!ms_inited)
                {
                    lock (ms_lock)
                    {
                        if (ms_instance == null)
                        {
                            ms_inited = true;
                            ms_instance = new Cases();
                        }
                    }
                }

                return ms_instance;
            }
Ejemplo n.º 42
0
 private void CheckCapture(int x, int y, Cases pawn)
 {
     if (x <= 15 &&
         ((map[x + 1][y] != pawn && map[x + 1][y] != Cases.empty) &&
         (map[x + 2][y] != pawn && map[x + 2][y] != Cases.empty) &&
         map[x + 3][y] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x + 1, y)].OnCapture();
         usedPoint.Remove(new Vector2(x + 1, y));
         usedPoint[new Vector2(x + 2, y)].OnCapture();
         usedPoint.Remove(new Vector2(x + 2, y));
         map[x + 1][y] = Cases.empty;
         map[x + 2][y] = Cases.empty;
     }
     if (x >= 3 &&
         ((map[x - 1][y] != pawn && map[x - 1][y] != Cases.empty) &&
         (map[x - 2][y] != pawn && map[x - 2][y] != Cases.empty) &&
         map[x - 3][y] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x - 1, y)].OnCapture();
         usedPoint.Remove(new Vector2(x - 1, y));
         usedPoint[new Vector2(x - 2, y)].OnCapture();
         usedPoint.Remove(new Vector2(x - 2, y));
         map[x - 1][y] = Cases.empty;
         map[x - 2][y] = Cases.empty;
     }
     if (y <= 15 &&
         ((map[x][y + 1] != pawn && map[x][y + 1] != Cases.empty) &&
         (map[x][y + 2] != pawn && map[x][y + 2] != Cases.empty) &&
         map[x][y + 3] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x, y + 1)].OnCapture();
         usedPoint.Remove(new Vector2(x, y + 1));
         usedPoint[new Vector2(x, y + 2)].OnCapture();
         usedPoint.Remove(new Vector2(x, y + 2));
         map[x][y + 1] = Cases.empty;
         map[x][y + 2] = Cases.empty;
     }
     if (y >= 3 &&
         ((map[x][y - 1] != pawn && map[x][y - 1] != Cases.empty) &&
         (map[x][y - 2] != pawn && map[x][y - 2] != Cases.empty) &&
         map[x][y - 3] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x, y - 1)].OnCapture();
         usedPoint.Remove(new Vector2(x, y - 1));
         usedPoint[new Vector2(x, y - 2)].OnCapture();
         usedPoint.Remove(new Vector2(x, y - 2));
         map[x][y - 1] = Cases.empty;
         map[x][y - 2] = Cases.empty;
     }
     if (y <= 15 && x <= 15 &&
         ((map[x + 1][y + 1] != pawn && map[x + 1][y + 1] != Cases.empty) &&
         (map[x + 2][y + 2] != pawn && map[x + 2][y + 2] != Cases.empty) &&
         map[x + 3][y + 3] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x + 1, y + 1)].OnCapture();
         usedPoint.Remove(new Vector2(x + 1, y + 1));
         usedPoint[new Vector2(x + 2, y + 2)].OnCapture();
         usedPoint.Remove(new Vector2(x + 2, y + 2));
         map[x + 1][y + 1] = Cases.empty;
         map[x + 2][y + 2] = Cases.empty;
     }
     if (y >= 3  &&  x <= 15 &&
         ((map[x + 1][y - 1] != pawn && map[x + 1][y - 1] != Cases.empty) &&
         (map[x + 2][y - 2] != pawn && map[x + 2][y - 2] != Cases.empty) &&
         map[x + 3][y - 3] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x + 1, y - 1)].OnCapture();
         usedPoint.Remove(new Vector2(x + 1, y - 1));
         usedPoint[new Vector2(x + 2, y - 2)].OnCapture();
         usedPoint.Remove(new Vector2(x + 2, y - 2));
         map[x + 1][y - 1] = Cases.empty;
         map[x + 2][y - 2] = Cases.empty;
     }
     if (y <= 15 && x >= 3 &&
         ((map[x - 1][y + 1] != pawn && map[x - 1][y + 1] != Cases.empty) &&
         (map[x - 2][y + 2] != pawn && map[x - 2][y + 2] != Cases.empty) &&
         map[x - 3][y + 3] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x - 1, y + 1)].OnCapture();
         usedPoint.Remove(new Vector2(x - 1, y + 1));
         usedPoint[new Vector2(x - 2, y + 2)].OnCapture();
         usedPoint.Remove(new Vector2(x - 2, y + 2));
         map[x - 1][y + 1] = Cases.empty;
         map[x - 2][y + 2] = Cases.empty;
     }
     if (y >= 3 && x >= 3 &&
         ((map[x - 1][y - 1] != pawn && map[x - 1][y - 1] != Cases.empty) &&
         (map[x - 2][y - 2] != pawn && map[x - 2][y - 2] != Cases.empty) &&
         map[x - 3][y - 3] == pawn))
     {
         captured[(int)pawn] += 2;
         usedPoint[new Vector2(x - 1, y - 1)].OnCapture();
         usedPoint.Remove(new Vector2(x - 1, y - 1));
         usedPoint[new Vector2(x - 2, y - 2)].OnCapture();
         usedPoint.Remove(new Vector2(x - 2, y - 2));
         map[x - 1][y - 1] = Cases.empty;
         map[x - 1][y - 2] = Cases.empty;
     }
     gameUI.UpdateCount(captured);
 }
Ejemplo n.º 43
0
    private void CheckFive(int x, int y, Cases pawn)
    {
        int l = 0;
        int tx = 0;
        int ty = 0;
        int valid = 0;
        ArrayList points;

        points = new ArrayList();
        for (int i = 0; x + i < 18 && map[x + i][y] == pawn; ++i)
            ++l;
        tx = x + (l - 1);
        l = 0;
        for(int i = 0; tx + i > 0 && map[tx + i][y] == pawn; --i)
        {
            ++l;
            points.Add(new Vector2(tx + i, y));
            if (isCapturable(tx + i, y, pawn) == false)
                valid++;
            else
                valid = 0;
            if (valid >= 5)
            {
                gameUI.WinScreen(Convert.ToInt32(pawn) + 1);
                finish = true;
                return;
            }
        }
        if (l >= 5 && !pWin.Contains(points))
            pWin.Add((ArrayList)points.Clone());
        points.Clear();
        l = 0;
        valid = 0;
        for (int i = 0; y + i < 18 && map[x][y + i] == pawn; ++i)
            ++l;
        ty = y + (l - 1);
        l = 0;
        for (int i = 0; ty + i > 0 && map[x][ty + i] == pawn; --i)
        {
            ++l;
            points.Add(new Vector2(x, ty + i));
            if (isCapturable(x, ty + i, pawn) == false)
                valid++;
            else
                valid = 0;
            if (valid >= 5)
            {
                gameUI.WinScreen(Convert.ToInt32(pawn) + 1);
                finish = true;
                return;
            }
        }
        if (l >= 5 && !pWin.Contains(points))
            pWin.Add((ArrayList)points.Clone());
        points.Clear();
        l = 0;
        valid = 0;
        for (int i = 0; x + i < 18 && y + i < 18 && map[x + i][y + i] == pawn; ++i)
            ++l;
        tx = x + (l - 1);
        ty = y + (l - 1);
        l = 0;
        for (int i = 0; tx + i > 0 && ty + i > 0 && map[tx + i][ty + i] == pawn; --i)
        {
            ++l;
            points.Add(new Vector2(tx + i, ty + i));
            if (isCapturable(tx + i, ty + i, pawn) == false)
                valid++;
            else
                valid = 0;
            if (valid >= 5)
            {
                gameUI.WinScreen(Convert.ToInt32(pawn) + 1);
                finish = true;
                return;
            }
        }
        if (l >= 5 && !pWin.Contains(points))
            pWin.Add((ArrayList)points.Clone());
        points.Clear();
        valid = 0;
        l = 0;
        int k = 0;
        int j = 0;
        while (x + k > 0 && y + j < 18 && map[x + k][y + j] == pawn)
        {
            --k;
            ++j;
            ++l;
        }
        tx = x - (l - 1);
        ty = y + (l - 1);
        l = 0;
        k = 0;
        j = 0;
        while (tx + k < 18 && ty + j > 0 && map[tx + k][ty + j] == pawn)
        {
            ++l;
            ++k;
            --j;
            points.Add(new Vector2(tx + k, ty + j));
            if (isCapturable(tx + k, ty + j, pawn) == false)
                valid++;
            else
                valid = 0;
            if (valid >= 5)
            {
                gameUI.WinScreen(Convert.ToInt32(pawn) + 1);
                finish = true;
                return;
            }
        }
        if (l >= 5 && !pWin.Contains(points))
            pWin.Add((ArrayList)points.Clone());
        points.Clear();
    }
Ejemplo n.º 44
0
    /// <summary>
    /// Creates new custom formatter object with specified 
    /// case type.
    /// </summary>
    /// <param name="casing">
    /// Specified which casing format the rename shoul follow
    /// Default: Pascal (Sentence case)
    /// </param>
    public Formatter()
    {
      replacements = new Dictionary<string, string> { 
        { "\\", " "},
        { "/" , " "},
        { ":" , " "},
        { "*" , "" },
        { "?" , "" },
        { "<" , "" },
        { ">" , "" }
      };

      // Default all casing to PASCAL
      CurrentCase = Cases.PASCAL;
      AlbumCasing = Cases.PASCAL;
      SongCasing = Cases.PASCAL;
      FlatCasing = Cases.PASCAL;
      MetadataCasing = Cases.PASCAL;
    }
Ejemplo n.º 45
0
 public bool CheckDouble(int x, int y, Cases pawn)
 {
     int spaces = 0;
     int three = 0;
     int potThree = 0;
     int h = 0;
     if (x != 0 && x != 18 && map[x - 1][y] == pawn && map[x + 1][y] == pawn)
     {
         for (int i = 1; x + i < 18 && map[x + i][y] == pawn; ++i)
         {
             potThree += CheckDoubleInter(x + i, y, pawn);
             ++h;
         }
         for (int i = -1; x + i > 0 && map[x + i][y] == pawn; --i)
         {
             potThree += CheckDoubleInter(x + i, y, pawn);
             ++h;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         h = 0;
         potThree = 0;
     }
     else
     {
         for (int i = 0; x + i < 18; ++i)
         {
             if (map[x + i][y] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x + i, y, pawn);
             }
             else if (map[x + i][y] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y] != Cases.empty && map[x + i][y] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         spaces = 0;
         h = 0;
         potThree = 0;
         for (int i = 0; x + i > 0; --i)
         {
             if (map[x + i][y] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x + i, y, pawn);
             }
             else if (map[x + i][y] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y] != Cases.empty && map[x + i][y] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
     }
     potThree = 0;
     h = 0;
     spaces = 0;
     if (y != 0 && y != 18 && map[x][y - 1] == pawn && map[x][y + 1] == pawn)
     {
         for (int i = 1; y + i < 18 && map[x][y + i] == pawn; ++i)
         {
             ++h;
             potThree += CheckDoubleInter(x, y + i, pawn);
         }
         for (int i = -1; y + i > 0 && map[x][y + i] == pawn; --i)
         {
             ++h;
             potThree += CheckDoubleInter(x, y + i, pawn);
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         h = 0;
         potThree = 0;
     }
     else
     {
         for (int i = 0; y + i < 18; ++i)
         {
             if (map[x][y + i] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x, y + i, pawn);
             }
             else if (map[x][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x][y + i] != Cases.empty && map[x][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         spaces = 0;
         h = 0;
         potThree = 0;
         for (int i = 0; y + i > 0; --i)
         {
             if (map[x][y + i] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x, y + i, pawn);
             }
             else if (map[x][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x][y + i] != Cases.empty && map[x][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
     }
     spaces = 0;
     h = 0;
     potThree = 0;
     if (x != 0 && x != 18 && y != 0 && y != 18 && map[x - 1][y - 1] == pawn && map[x + 1][y + 1] == pawn)
     {
         for (int i = 1; x + i < 18 && y + i < 18 && map[x + i][y + i] == pawn; ++i)
         {
             ++h;
             potThree += CheckDoubleInter(x + i, y + i, pawn);
         }
         for (int i = -1; x + i > 0 && y + i > 0 && map[x + i][y + i] == pawn; --i)
         {
             ++h;
             potThree += CheckDoubleInter(x + i, y + i, pawn);
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         h = 0;
         potThree = 0;
     }
     else
     {
         for (int i = 0; x + i < 18 && y + i < 18; ++i)
         {
             if (map[x + i][y + i] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x + i, y + i, pawn);
             }
             else if (map[x + i][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y + i] != Cases.empty && map[x + i][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         spaces = 0;
         h = 0;
         potThree = 0;
         for (int i = 0; x + i > 0 && y + i > 0; --i)
         {
             if (map[x + i][y + i] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x + i, y + i, pawn);
             }
             else if (map[x + i][y + i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y + i] != Cases.empty && map[x + i][y + i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
     }
     h = 0;
     spaces = 0;
     potThree = 0;
     if (x != 0 && x != 18 && y != 0 && y != 18 && map[x - 1][y + 1] == pawn && map[x + 1][y - 1] == pawn)
     {
         for (int i = 1; x + i < 18 && y - i > 0 && map[x + i][y - i] == pawn; ++i)
         {
             ++h;
             potThree += CheckDoubleInter(x + i, y - i, pawn);
         }
         for (int i = -1; x + i > 0 && y - i < 18 && map[x + i][y - i] == pawn; --i)
         {
             ++h;
             potThree += CheckDoubleInter(x + i, y - i, pawn);
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         h = 0;
         potThree = 0;
     }
     else
     {
         for (int i = 0; x + i < 18 && y - i > 0; ++i)
         {
             if (map[x + i][y - i] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x + i, y - i, pawn);
             }
             else if (map[x + i][y - i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y - i] != Cases.empty && map[x + i][y - i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
         spaces = 0;
         h = 0;
         potThree = 0;
         for (int i = 0; x + i > 0 && y - i < 18; --i)
         {
             if (map[x + i][y - i] == pawn)
             {
                 ++h;
                 potThree += CheckDoubleInter(x + i, y - i, pawn);
             }
             else if (map[x + i][y - i] == Cases.empty && i != 0)
                 ++spaces;
             else if (map[x + i][y - i] != Cases.empty && map[x + i][y - i] != pawn && spaces == 0)
             {
                 h = 0;
                 break;
             }
             if (spaces > 1)
                 break;
         }
         if (h == 2)
         {
             ++three;
             three += potThree;
         }
     }
     if (three >= 2)
         return true;
     return false;
 }
Ejemplo n.º 46
0
 public Cases SaveCase(Cases cases)
 {
     using (var db = Db)
     {
         if (cases.CaseId > 0)
         {
             db.Execute(cases.GetUpdateSql(caseKeyField, insertUpdateIgnoreFileds), cases);
             return cases;
         }
         else
         {
             cases.CaseId = db.Query<int>(cases.GetSqliteInsertSql(insertUpdateIgnoreFileds), cases).FirstOrDefault();
             return cases;
         }
     }
 }