public void RemoveColumns(List <int> columnIndexes) { ArrayOfInt ai = new ArrayOfInt(); ai.AddRange(columnIndexes); m_dbClient.RemoveLogColumns(ai); }
public bool RemoveTableItems(string appGuid, string tableGuid, List <int> colIndexes) { ArrayOfInt ai = new ArrayOfInt(); ai.AddRange(colIndexes); return(m_dbClient.RemoveTableItems(appGuid, tableGuid, ai)); }
/// <summary> /// Upload CSV file to an EM list. This process is not thread safe. Use DMListImport for concurrent uploading. /// </summary> public void Upload(int listId) { using (var em = new EMWebServicesClientExtension(Auth.GetToken(), Settings.Default.EndPoint)) { // Upload data into a list string fileNameFull = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data\\data.csv"); // set EM field id order to be identical to CSV file column order ArrayOfInt fieldOrder = new ArrayOfInt { em.GetField("email").ID, em.GetField("firstname").ID }; em.ListManager.InitializeListImport(em.Token, listId, fieldOrder, false); // read and import CSV file // a header row is not required in CSV file using (var tStream = new StreamReader(fileNameFull)) { string data = tStream.ReadToEnd(); em.ListManager.UploadDataCSV(em.Token, ",", null, data); } em.ListManager.InsertListData(em.Token); em.ListManager.FinalizeListImport(em.Token); } }
public void __LoadDataInTable__(ArrayList arr_data, int data_columns, ArrayList arr_joints, ArrayOfInt widths, ArrayOfInt heights, int headerLinesUp, int headerLinesLeft, int data_height) { // Таблица DATA__arr = arr_data; DATA__columns = data_columns; // Объединения DATA__joints = arr_joints; // Отображение таблицы PAINT__columns_widths = widths; PAINT__columns_heights = heights; PAINT__data_height = data_height; PAINT__headerLinesUp = headerLinesUp; PAINT__headerLinesLeft = headerLinesLeft; // Определение размеров total_width = 0; for (int i = 0; i < PAINT__columns_widths.Count; i++) total_width += (PAINT__columns_widths[i] + 2 * 1); total_width += (DATA__columns - 1) * PAINT__border_delay + 2 * (PAINT__border_delay + 1); total_height = 0; for (int i = 0; i < DATA__arr.Count; i++) total_height += (i < PAINT__columns_heights.Count ? PAINT__columns_heights[i] : PAINT__data_height) + 2 * 1; total_height += (DATA__arr.Count - 1) * PAINT__border_delay + 2 * (PAINT__border_delay + 1); // Новые размеры: this.Width = total_width; this.Height = total_height; }
public static List <int> CompareTheTripletsHackerRank() { //SOAP call ederken List'i ArrayOfInt'e çevirmen gerekti. var client = new AlgorithmsWebServiceSoapClient(); ArrayOfInt arrayOfInt1 = new ArrayOfInt(); ArrayOfInt arrayOfInt2 = new ArrayOfInt(); Console.WriteLine("Array size'ları ne olsun?"); int sizeOfArrays = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("1.array'in elemanlarını girin."); List <int> firstList = new List <int>(); //objeyi yaratman gerekiyor. List <int> secondList = new List <int>(); for (int i = 0; i < sizeOfArrays; i++) { int value1 = Convert.ToInt16(Console.ReadLine()); firstList.Add(value1); int value2 = Convert.ToInt16(Console.ReadLine()); secondList.Add(value2); } //Console.WriteLine(firstList); --> objeyi yazar, elemanlarını değil. arrayOfInt1.AddRange(firstList); arrayOfInt2.AddRange(secondList); //bool isArrayListCorrect = false; //TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true); //int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), aTemp => Convert.ToInt32(aTemp)); return(client.CompareTheTriplets(arrayOfInt1, arrayOfInt2, sizeOfArrays)); }
private static ArrayOfInt CreateArrayOfInt(IEnumerable <int> integers) { var arrayOfInt = new ArrayOfInt(); arrayOfInt.AddRange(integers); return(arrayOfInt); }
public bool UpdateTableItemsSequence(string tableGuid, List <int> lstColIndexes) { ArrayOfInt ai = new ArrayOfInt(); ai.AddRange(lstColIndexes); return(m_dbClient.UpdateTableItemsSequence(tableGuid, ai)); }
private ArrayOfInt GetAnswer() { var result = new ArrayOfInt(); result.AddRange(mTextBoxes .Select(tb => Convert.ToInt32(tb.Text)) .ToArray()); return(result); }
static void Main(string[] args) { WebServiceSoapClient c = new WebServiceSoapClient(); ArrayOfInt ids = c.GetProductIds(); foreach (int id in ids) { Console.WriteLine(id); Product p = c.GetProduct(id); Console.WriteLine(p.ProductName); } }
private void PlayerHandler(object sender, IrcEventArgs e) { var sendto = (string.IsNullOrEmpty(e.Data.Channel)) ? e.Data.Nick : e.Data.Channel; if (e.Data.MessageArray.Length < 2) { return; } RecordValue[][] values; // *** hard coded query *** const bool cacheFlag = false; var ownerIds = new ArrayOfInt(); var queryFields = new ArrayOfString { "row", "Nick", "Pure_PlayerDM_ELO", "Pure_PlayerDM_EVENT_KILLS", "Pure_PlayerDM_EVENT_DEATHS" }; const int surrounding = 0; const int limit = 0; const int offset = 0; const string targetFilter = ""; const string orderBy = "Pure_PlayerDM_ELO desc"; var filter = "Nick LIKE '" + e.Data.MessageArray[1] + "'"; // *** end hard coded query *** EnsureTicket(); try { var searchForRecordsRequest = new SearchForRecordsRequest(new SearchForRecordsRequestBody(Ut3GameId, ticket, StatsTable, queryFields, filter, orderBy, offset, limit, targetFilter, surrounding, ownerIds, cacheFlag)); var recordsResponse = gsStorage.SearchForRecords(searchForRecordsRequest); values = recordsResponse.Body.values; if (recordsResponse.Body.SearchForRecordsResult == Result.Success) { Log.Instance.Log("Webservice returned '" + recordsResponse + "' instead of success.", Level.Fail); return; } } catch (Exception exception) { Log.Instance.Log(exception); return; } foreach (string msg in values.Select(perPlayerValues => RecordValueToString(perPlayerValues[0]) + ". " + RecordValueToString(perPlayerValues[1]) + " ELO: " + RecordValueToString(perPlayerValues[2]) + " Kills: " + RecordValueToString(perPlayerValues[3]) + " Deaths: " + RecordValueToString(perPlayerValues[4]))) { BotMethods.SendMessage(SendType.Notice, sendto, msg); } }
static void Main(string[] args) { WebServiceSoapClient c = new WebServiceSoapClient(); // This is a client-side proxy which reads the XML data and interprets into C# code ArrayOfInt ids = c.GetProductIds(); foreach (int id in ids) { Console.WriteLine(id); Product p = c.GetProduct(id); Console.WriteLine(p.ProductName); } }
static void Main(string[] args) { WebServiceSoapClient c = new WebServiceSoapClient(); ArrayOfInt ids = c.GetMovieIds(); foreach (int i in ids) { Console.WriteLine(i); Movie m = c.GetMovie(i); Console.WriteLine(m.MovieTitle); } }
void showNextOpenInfo() { var idList = new ArrayOfInt(); idList.Add(LotteryId); var next = Tools.client.GetLotteryNextInfo(LogGuid, idList); if (next != null && next.Count > 0) { if (NextOpenInfo == null || NextOpenInfo.Expect != next[0].Expect) { NextOpenInfo = next[0]; } else { return; } lblNextExceptInfo.Text = string.Format("{0}-{1} 距离开奖时间还剩", NextOpenInfo.Expect.Substring(0, 8), NextOpenInfo.Expect.Substring(8)); dtNow = Tools.client.GetDateTimeNow(); betweenExcept = (next[0].ScheduleOpenTime - dtNow); showDJS(); tmDJS.Start(); } }
private static void ReSendNoSendRequestThreads(DateTime startDate, DateTime endDate, int reyTryCount, SortedList <string, int> multiWebSites) { ThreadPool.SetMaxThreads(15, 15); System.Threading.WaitCallback waitCallback = new WaitCallback(SendRequest); ArrayOfInt clientChannleIDs = client.GetGetAllClientChannelIDNeed(startDate.Date, endDate.Date); List <SendTask> allSendTask = new List <SendTask>(); Hashtable hashtable = new Hashtable(); foreach (int clientChannleID in clientChannleIDs) { if (sendClientChannelID != 0) { if (clientChannleID != sendClientChannelID) { continue; } } string host = ""; try { host = client.GetAllClientChannelSendWebDomain(clientChannleID); } catch (Exception ex) { logger.Error("获取host失败!", ex); } if (!hashtable.ContainsKey(host)) { SendTask sendTask = new SendTask(); sendTask.IsEnd = false; sendTask.StartDate = startDate.Date; sendTask.EndDate = endDate.Date; sendTask.ChanneClientIds = new List <int>(); sendTask.Host = host; allSendTask.Add(sendTask); hashtable.Add(host, sendTask); } ((SendTask)hashtable[host]).ChanneClientIds.Add(clientChannleID); } foreach (DictionaryEntry dictionaryEntry in hashtable) { //if (multiWebSites.ContainsKey(dictionaryEntry.Key.ToString()) && multiWebSites[dictionaryEntry.Key.ToString()]<=0) //{ // ThreadPool.QueueUserWorkItem(SendRequest, dictionaryEntry.Value); // multiWebSites[dictionaryEntry.Key.ToString()] = multiWebSites[dictionaryEntry.Key.ToString()] - 1; // Thread.Sleep(60000); // continue; //} ThreadPool.QueueUserWorkItem(SendRequest, dictionaryEntry.Value); Thread.Sleep(10000); } while (allSendTask.Exists(p => !p.IsEnd)) { Thread.Sleep(2000); } if (startDate.Date != endDate.Date) { //update report } }
void REFLECT_DEPENDENCES(int line, ArrayOfInt poss) { if (REFLECT_DEPENDENCES_BUSY) return; REFLECT_DEPENDENCES_BUSY = true; // Создание цепочки: ArrayList ChainOfInfluences = new ArrayList(); for (int i = 0; i < poss.Count; i++) { BuildChainForLink(ChainOfInfluences, new coord(line, poss[i])); //цепочка по горизонтали } if (isRobber) BuildChainInVertical(ChainOfInfluences, line); //и по вертикали if (reflect_debug_msg) { string s = "REFLECT from "; for (int i = 0; i < poss.Count; i++) s += debug_dataname(line, poss[i]); s += ":\n"; for (int j = 0; j < ChainOfInfluences.Count; j++) s += (j > 0 ? " => " : "") + debug_dataname(((coord)ChainOfInfluences[j]).line, ((coord)ChainOfInfluences[j]).pos); MessageBox.Show(s); } // Ввызов всех ф-ий по цепочке: for (int i = 0; i < ChainOfInfluences.Count; i++) { try { REFLECT_CALL_FUNCTION(((coord)ChainOfInfluences[i]).line, ((coord)ChainOfInfluences[i]).pos); } catch (Exception e) { // REFLECT DEBUG MESSAGEBOX string s = "ОШИБКА при изменении данных по цепочке от "; for (int j = 0; j < poss.Count; j++) { if (j > 0) s += ", "; s += debug_dataname(line, poss[j]); } s += ":\n"; for (int j = 0; j < ChainOfInfluences.Count; j++) s += (j > 0 ? " => " : "") + debug_dataname(((coord)ChainOfInfluences[j]).line, ((coord)ChainOfInfluences[j]).pos); s += "\nОШИБКА на этапе выполнения Ф-ий для " + debug_dataname(((coord)ChainOfInfluences[i]).line, ((coord)ChainOfInfluences[i]).pos); MessageBox.Show(s); throw; } } REFLECT_DEPENDENCES_BUSY = false; ChainOfInfluences.Clear(); }
void LOAD_GAME_SETTINGS___4_SimpleIMP() { isRobber = false; isSplit = false; canbeNoContract = true; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB_Deals_TableName = "Deals_Sport"; DB_Deals_ColumnsNames.Add(1, "CardsDistribution"); DB_Deals_ColumnsNames.Add(3, "Pair"); DB_Deals_ColumnsNames.Add(4, "Contract"); DB_Deals_ColumnsNames.Add(5, "Result"); columnsDataClasses = new ArrayOfTypes(); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(CardsDistribution)); columnsDataClasses.Add(typeof(ZoneSwitcher)); columnsDataClasses.Add(typeof(PairSwitcher)); columnsDataClasses.Add(typeof(Contract)); columnsDataClasses.Add(typeof(Result)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(QuarterSwitcher)); ID_NAMES.Add(0, "NO"); ID_NAMES.Add(1, "DISTRIBUTION"); ID_NAMES.Add(2, "ZONE"); ID_NAMES.Add(3, "PAIR"); ID_NAMES.Add(4, "CONTRACT"); ID_NAMES.Add(5, "RESULT"); ID_NAMES.Add(6, "SCORE"); ID_NAMES.Add(7, "IMP"); ID_NAMES.Add(8, "DEALER"); REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR", "CONTRACT" }) }); REFLECT_Depends.Add(3, new int[] { 3, 4 }); REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "MDEAL_NO" }) }); REFLECT_Constructors.Add(0, new string[] { "true" }); REFLECT_Depends.Add(0, new int[] { -1 }); REFLECT_Functions.Add(2, new FuncInfo[] { new FuncInfo("DefineSportZone", new string[] { "ZONE", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", GameSettings_3Sports_ZoneSwims.ToString() }) }); REFLECT_Depends.Add(2, new int[] { -1 }); REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT", "CONTRACT", "0" }) }); REFLECT_Depends.Add(5, new int[] { 4 }); REFLECT_Constructors.Add(5, new string[] { "CONTRACT" }); REFLECT_Functions.Add(6, new FuncInfo[] { new FuncInfo("SportScore", new string[] { "SCORE", "PAIR", "ZONE", "CONTRACT", "RESULT" }) }); REFLECT_Depends.Add(6, new int[] { 2, 3, 4, 5 }); REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("ConvertToIMPs", new string[] { "IMP", "SCORE" }) }); REFLECT_Depends.Add(7, new int[] { 6 }); REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("DefineSportDealer", new string[] { "DEALER", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", "FIRST_DEALER", GameSettings_3Sports_ZoneSwims.ToString() }) }); REFLECT_Depends.Add(8, new int[] { -1 }); //new for match: REFLECT_Functions.Add((int)CONST.MATCH_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetMatchScore", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO", "7" }), new FuncInfo("TotalScore_MatchMode", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO__REAL" }) }); REFLECT_Depends.Add((int)CONST.MATCH_TOTAL_SCORE, new int[] { 7 }); REFLECT_InsideFunctionsList.Add("SetMatchScore"); REFLECT_InsideFunctionsList.Add("TotalScore_MatchMode"); NotNecessaryValues.Add(new int[] { 1 }); ContractColumns.Add(new int[] { 4 }); NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt()); NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 3 }); columnsControlsClasses = new ArrayOfTypes(); columnsControlsClasses.Add(typeof(DealInfoControl)); columnsControlsClasses.Add(typeof(ShowTextControl_Center)); columnsControlsClasses.Add(typeof(ShowTextControl)); columnsControlsClasses.Add(typeof(SwitcherControl_Orange_Center)); columnsControlsClasses.Add(typeof(ContractSelectControl)); columnsControlsClasses.Add(typeof(ResultSelectControl)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); arrHeadersNames = new ArrayOfString(); arrHeadersNames.Add("#"); arrHeadersNames.Add("Сда-\nющий"); arrHeadersNames.Add("Зона"); arrHeadersNames.Add("Па\nра"); arrHeadersNames.Add("Контракт"); arrHeadersNames.Add("Рез-т"); arrHeadersNames.Add("Очки"); arrHeadersNames.Add("IMP"); arrHeadersNames_FULL = new ArrayOfString(); arrHeadersNames_FULL.Add("#"); arrHeadersNames_FULL.Add("Сдающий"); arrHeadersNames_FULL.Add("Зона"); arrHeadersNames_FULL.Add("Пара"); arrHeadersNames_FULL.Add("Контракт"); arrHeadersNames_FULL.Add("Рез-т"); arrHeadersNames_FULL.Add("Очки"); arrHeadersNames_FULL.Add("IMP"); arrHeadersWidths = new ArrayOfInt(); arrHeadersWidths.Add(new int[] { 22+8, 42+3, 55+14, 28+14, 71+14, 47+14, 47+14, 30+14 }); CoVa_Dependences = new ArrayOfArrayOfInt(); for (int i = 0; i < arrHeadersNames.Count; i++) CoVa_Dependences.Add(new ArrayOfInt()); CoVa_Dependences[0].Add(new int[] { 0, 1 }); CoVa_Dependences[1].Add(8); CoVa_Dependences[2].Add(2); CoVa_Dependences[3].Add(3); CoVa_Dependences[4].Add(4); CoVa_Dependences[5].Add(5); CoVa_Dependences[6].Add(new int[] { 6 }); //относительно заданной пары CoVa_Dependences[7].Add(new int[] { 7 }); //относительно заданной пары }
public void AddNewDeal(MenuItem _mi_) { //_mi_.MenuItems.Clear(); // Сначала просканировать линии на наличие незаконченных и неопределенных сдач ArrayOfInt NotDefinedLines = new ArrayOfInt(); for (int i = 0; i < VALUES.Count; i++) { for(int j = 0 ; j < VALUES[i].Count ; j++) { if(VALUES[i, j] != null && !NotNecessaryValues.Contains(j) && VALUES[i, j].GetType().IsSubclassOf(typeof(BaseChangedData)) && (VALUES[i, j] as BaseChangedData).IsDefined() == false) { // пропускать пустые значения из-за "нет контракта" bool skip_if_no_contract = false; for (int k = 0; k < ContractColumns.Count; k++) { if (VALUES[i, ContractColumns[k]] != null && (VALUES[i, ContractColumns[k]] as Contract).NoContract) if (NotNecessaryValues_NOCONTRACT[k].Contains(j)) skip_if_no_contract = true; } if (skip_if_no_contract) continue; // если нет в списке пропущенных столбцов, значит линия НЕЗАПОЛНЕНА if (!NotDefinedLines.Contains(i)) NotDefinedLines.Add(i); } } } if(NotDefinedLines.Count != 0) { String s = "Сначала введите все данные в сдачи:\n"; for(int i = 0 ; i < NotDefinedLines.Count ; i++) { if(i > 0) s += ", "; if (this.isRobber) s += (PAGE__VIEW ? "" : (ROBBERS.GetRobberNo(NotDefinedLines[i]) + 1 + (PAGE__VIEW ? PAGE__NO : 0)).ToString() + ".") + (ROBBERS.GetRobDealNo(NotDefinedLines[i]) + 1).ToString(); else s += (PAGE__VIEW ? "" : (MATCHES_GetMatchNo(NotDefinedLines[i]) + 1 + (PAGE__VIEW ? PAGE__NO : 0)).ToString() + ".") + (MATCHES_GetMDealNo(NotDefinedLines[i]) + 1).ToString(); } MessageBox.Show(s); return; } if (this.isRobber) { ArrayOfInt arrNotCompletedRobbers = new ArrayOfInt(); if (ROBBERS.Count > 1) { for (int i = 0; i < (ROBBERS.Count - 1); i++) if (ROBBERS[i].IsCompleted() == false) arrNotCompletedRobbers.Add(i); } if (arrNotCompletedRobbers.Count == 0) //нет незаконченных робберов { NewDealMenu_NewRDeal(null, null); } else //в меню возможность закончить робберы { ContextMenu ContMenu = new ContextMenu(); for (int i = 0; i < arrNotCompletedRobbers.Count; i++) { MenuItem_RDeal mi = new MenuItem_RDeal(); mi.robNo = arrNotCompletedRobbers[i]; mi.Text = "Продолжить роббер " + (mi.robNo + 1 + (PAGE__VIEW ? PAGE__NO : 0)).ToString(); mi.Click += NewDealMenu_InsertRDeal; ContMenu.MenuItems.Add(mi); } MenuItem mi2 = new MenuItem(); mi2.Text = (ROBBERS.Count == 0 || ROBBERS[ROBBERS.Count - 1].IsCompleted()) ? "Новый роббер" : "Текущий роббер"; mi2.Click += NewDealMenu_NewRDeal; ContMenu.MenuItems.Add(mi2); ContMenu.Show(Program.MainForm, new Point(0, Program.MainForm.Height - MENUHEIGHT - 1)); // Удалить конт.меню ContMenu.MenuItems.Clear(); ContMenu.Dispose(); ContMenu = null; } } else if (this.isSplit) { ArrayList arrNotCompletedDeals = new ArrayList(); for (int i = 0; i < VALUES.Count; i++) { for (int j = 0; j < SUBDEALS.Count; j++) { if (VALUES[i, SUBDEALS[j, 0]] == null) { arrNotCompletedDeals.Add(new subdeal(i, j)); } } } if (arrNotCompletedDeals.Count == 0) //нет незаконченных сдач { NewDealMenu_NewMDeal(null, null); } else //в меню возможность закончить сдачу под всеми столами { ContextMenu ContMenu = new ContextMenu(); for (int i = 0; i < arrNotCompletedDeals.Count; i++) { MenuItem_SubDeal mi = new MenuItem_SubDeal(); mi.subdeal = (subdeal)arrNotCompletedDeals[i]; mi.Text = "Сдача "; if (this.isRobber) mi.Text += (PAGE__VIEW ? "" : (ROBBERS.GetRobberNo(mi.subdeal.line) + 1 + (PAGE__VIEW ? PAGE__NO : 0)).ToString() + ".") + (ROBBERS.GetRobDealNo(mi.subdeal.line) + 1).ToString(); else mi.Text += (PAGE__VIEW ? "" : (MATCHES_GetMatchNo(mi.subdeal.line) + 1 + (PAGE__VIEW ? PAGE__NO : 0)).ToString() + ".") + (MATCHES_GetMDealNo(mi.subdeal.line) + 1).ToString(); mi.Text += " за столом " + (mi.subdeal.level + 1).ToString(); mi.Click += NewDealMenu_NewSubDeal; ContMenu.MenuItems.Add(mi); } MenuItem mi2 = new MenuItem(); mi2.Text = "Новая сдача"; mi2.Click += NewDealMenu_NewMDeal; ContMenu.MenuItems.Add(mi2); ContMenu.Show(Program.MainForm, new Point(0, Program.MainForm.Height - MENUHEIGHT - 1)); // Удалить конт.меню ContMenu.MenuItems.Clear(); ContMenu.Dispose(); ContMenu = null; } } else { NewDealMenu_NewMDeal(null, null); } }
void LOAD_GAME_SETTINGS___3_Compensat() { isRobber = false; isSplit = false; canbeNoContract = true; // ОПЦИИ GameSettings_Comp_Type = (BridgeGameScoring.TypeOfCompensation)(GameSettings_Options & 3); //2 bits GameSettings_Comp_10CardsIs2Fits = ((GameSettings_Options & 4) > 0); //3rd bit GameSettings_Comp_LessCompFor2Fits23PC = ((GameSettings_Options & 8) > 0); //4th bit // Скрыть ли сдающего в меню? if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) hide_dealer_in_menu = true; else hide_dealer_in_menu = false; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB_Deals_TableName = "Deals_Sport"; DB_Deals_ColumnsNames.Add(1, "CardsDistribution"); DB_Deals_ColumnsNames.Add(3, "Pair"); DB_Deals_ColumnsNames.Add(4, "Contract"); DB_Deals_ColumnsNames.Add(5, "Result"); DB_Deals_ColumnsNames.Add(7, "Figures"); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { DB_Deals_ColumnsNames.Add(12, "Fits"); DB_Deals_ColumnsNames.Add(13, "StrongestPair"); } columnsDataClasses = new ArrayOfTypes(); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(CardsDistribution)); columnsDataClasses.Add(typeof(ZoneSwitcher)); columnsDataClasses.Add(typeof(PairSwitcher)); columnsDataClasses.Add(typeof(Contract)); columnsDataClasses.Add(typeof(Result)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(QuarterSwitcher)); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { columnsDataClasses.Add(typeof(FitsSwitcher)); columnsDataClasses.Add(typeof(BoolData)); } ID_NAMES.Add(0, "NO"); ID_NAMES.Add(1, "DISTRIBUTION"); ID_NAMES.Add(2, "ZONE"); ID_NAMES.Add(3, "PAIR"); ID_NAMES.Add(4, "CONTRACT"); ID_NAMES.Add(5, "RESULT"); ID_NAMES.Add(6, "SCORE"); ID_NAMES.Add(7, "FIG"); ID_NAMES.Add(8, "COMPENS"); ID_NAMES.Add(9, "DIFF"); ID_NAMES.Add(10, "IMP"); ID_NAMES.Add(11, "DEALER"); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { ID_NAMES.Add(12, "FITS"); ID_NAMES.Add(13, "STRONGEST"); } REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR", "CONTRACT" }) }); REFLECT_Depends.Add(3, new int[] { 3, 4 }); REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "MDEAL_NO" }) }); REFLECT_Constructors.Add(0, new string[] { "true" }); REFLECT_Depends.Add(0, new int[] { -1 }); REFLECT_Functions.Add(2, new FuncInfo[] { new FuncInfo("DefineSportZone", new string[] { "ZONE", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", GameSettings_3Sports_ZoneSwims.ToString() }) }); REFLECT_Depends.Add(2, new int[] { -1 }); REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT", "CONTRACT", "0" }) }); REFLECT_Depends.Add(5, new int[] { 4 }); REFLECT_Constructors.Add(5, new string[] { "CONTRACT" }); REFLECT_Functions.Add(6, new FuncInfo[] { new FuncInfo("SportScore", new string[] { "SCORE", "PAIR", "ZONE", "CONTRACT", "RESULT" }) }); REFLECT_Depends.Add(6, new int[] { 2, 3, 4, 5 }); //fig REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("FiguresPoints", new string[] { "FIG", "DISTRIBUTION", "TRUE", /*not use*/ "PAIR" }) }); REFLECT_Depends.Add(7, new int[] { 7, 1 }); REFLECT_Constructors.Add(7, new string[] { "true", "0", "true", "40" }); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { // strongest REFLECT_Functions.Add(13, new FuncInfo[] { new FuncInfo("WhoIsStrongest20", new string[] { "STRONGEST", "FIG", "DISTRIBUTION", "LOADING_FROM_DB" }) }); REFLECT_Depends.Add(13, new int[] { 1, 7 }); //fits REFLECT_Functions.Add(12, new FuncInfo[] { new FuncInfo("FitsPoints", new string[] { "FITS", "DISTRIBUTION", (GameSettings_Comp_10CardsIs2Fits ? "TRUE" : "FALSE") }) }); REFLECT_Depends.Add(12, new int[] { 12, 1 }); } if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { //comp with fits REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("GetCompensation_WithFits", new string[] { "COMPENS", "DISTRIBUTION", "FIG", "ZONE", "TRUE", /*not use*/"PAIR", /* ||||| */ "FITS", "STRONGEST", (GameSettings_Comp_10CardsIs2Fits ? "TRUE" : "FALSE"), (GameSettings_Comp_LessCompFor2Fits23PC ? "TRUE" : "FALSE") }) }); REFLECT_Depends.Add(8, new int[] { 7, 2, 1, 12, 13 }); } else { //comp REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("GetCompensation", new string[] { "COMPENS", "DISTRIBUTION", "FIG", "ZONE", "TRUE", /*not use*/"PAIR", ((int)GameSettings_Comp_Type).ToString() }) }); REFLECT_Depends.Add(8, new int[] { 7, 2, 1 }); } REFLECT_Functions.Add(9, new FuncInfo[] { new FuncInfo("ScoreSumm", new string[] { "DIFF", "SCORE", "COMPENS" }) }); REFLECT_Depends.Add(9, new int[] { 6, 8 }); REFLECT_Functions.Add(10, new FuncInfo[] { new FuncInfo("ConvertToIMPs", new string[] { "IMP", "DIFF" }) }); REFLECT_Depends.Add(10, new int[] { 9 }); REFLECT_Functions.Add(11, new FuncInfo[] { new FuncInfo("DefineSportDealer", new string[] { "DEALER", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", "FIRST_DEALER", GameSettings_3Sports_ZoneSwims.ToString() }) }); REFLECT_Depends.Add(11, new int[] { -1 }); //new for match: REFLECT_Functions.Add((int)CONST.MATCH_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetMatchScore", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO", "10" }), new FuncInfo("TotalScore_MatchMode", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO__REAL" }) }); REFLECT_Depends.Add((int)CONST.MATCH_TOTAL_SCORE, new int[] { 10 }); REFLECT_InsideFunctionsList.Add("SetMatchScore"); REFLECT_InsideFunctionsList.Add("TotalScore_MatchMode"); NotNecessaryValues.Add(new int[] { 1 }); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { NotNecessaryValues.Add(new int[] { 13 }); //!!!!!!!!!!! указать сильную сторону все-таки обязательно, если фигур=20 !!!!!!!!!!!! } ContractColumns.Add(new int[] { 4 }); NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt()); NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 3 }); columnsControlsClasses = new ArrayOfTypes(); columnsControlsClasses.Add(typeof(DealInfoControl)); if (!hide_dealer_in_menu) { columnsControlsClasses.Add(typeof(ShowTextControl_Center)); //1... } columnsControlsClasses.Add(typeof(ShowTextControl)); columnsControlsClasses.Add(typeof(SwitcherControl_Orange)); columnsControlsClasses.Add(typeof(ContractSelectControl)); columnsControlsClasses.Add(typeof(ResultSelectControl)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); columnsControlsClasses.Add(typeof(TextBoxInTable)); //6 if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { columnsControlsClasses.Add(typeof(SwitcherControl_Orange)); //7 } columnsControlsClasses.Add(typeof(ShowSimpleScore)); //7-8 columnsControlsClasses.Add(typeof(ShowSimpleScore)); //8-9 columnsControlsClasses.Add(typeof(ShowSimpleScore)); //9-10 arrHeadersNames = new ArrayOfString(); arrHeadersNames.Add("#"); if (!hide_dealer_in_menu) { arrHeadersNames.Add("Сда\nющ."); } arrHeadersNames.Add("Зона"); arrHeadersNames.Add("Па\nра"); arrHeadersNames.Add("Контракт"); arrHeadersNames.Add("Рез-т"); arrHeadersNames.Add("Очки"); arrHeadersNames.Add("Фи\nгур"); //6 if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { arrHeadersNames.Add("Фи\nты"); //7 } arrHeadersNames.Add("Комп."); //7-8 arrHeadersNames.Add("Раз-\nница"); //8-9 arrHeadersNames.Add("IMP"); //9-10 arrHeadersNames_FULL = new ArrayOfString(); arrHeadersNames_FULL.Add("#"); if (!hide_dealer_in_menu) { arrHeadersNames_FULL.Add("Сдающий"); } arrHeadersNames_FULL.Add("Зона"); arrHeadersNames_FULL.Add("Пара"); arrHeadersNames_FULL.Add("Контракт"); arrHeadersNames_FULL.Add("Рез-т"); arrHeadersNames_FULL.Add("Очки"); arrHeadersNames_FULL.Add("Фигуры (NS)"); //6 if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { arrHeadersNames_FULL.Add("Фиты"); //7 } arrHeadersNames_FULL.Add("Компенсация"); //7-8 arrHeadersNames_FULL.Add("Разница"); //8-9 arrHeadersNames_FULL.Add("IMP"); //9-10 arrHeadersWidths = new ArrayOfInt(); arrHeadersWidths.Add(22); if (!hide_dealer_in_menu) { arrHeadersWidths.Add(33); } arrHeadersWidths.Add(new int[] { 51, 26, 69, 45, 45, 26 }); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) arrHeadersWidths.Add(25); arrHeadersWidths.Add(new int[] { 45, 45, 28 }); int hidden_dealer_offset = (!hide_dealer_in_menu) ? 1 : 0; //сдвиг индексов на 1 (после #), если сдающего все-таки показывать CoVa_Dependences = new ArrayOfArrayOfInt(); for (int i = 0; i < arrHeadersNames.Count; i++) CoVa_Dependences.Add(new ArrayOfInt()); if (hide_dealer_in_menu) { CoVa_Dependences[0].Add(new int[] { 0, 1, 11 }); } else { CoVa_Dependences[0].Add(new int[] { 0, 1 }); CoVa_Dependences[1].Add(11); } CoVa_Dependences[1 + hidden_dealer_offset].Add(2); CoVa_Dependences[2 + hidden_dealer_offset].Add(3); CoVa_Dependences[3 + hidden_dealer_offset].Add(4); CoVa_Dependences[4 + hidden_dealer_offset].Add(5); CoVa_Dependences[5 + hidden_dealer_offset].Add(new int[] { 6 }); //относительно static CoVa_Dependences[6 + hidden_dealer_offset].Add(7); if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe) { CoVa_Dependences[7 + hidden_dealer_offset].Add(new int[] { 12 }); // относительно СИЛЬНОЙ пары, так что ПОХУЙ // CoVa_Dependences[8 + hidden_dealer_offset].Add(new int[] { 8 }); //относительно static CoVa_Dependences[9 + hidden_dealer_offset].Add(new int[] { 9 }); //относительно static CoVa_Dependences[10 + hidden_dealer_offset].Add(new int[] { 10 }); //относительно static } else { CoVa_Dependences[7 + hidden_dealer_offset].Add(new int[] { 8 }); //относительно static CoVa_Dependences[8 + hidden_dealer_offset].Add(new int[] { 9 }); //относительно static CoVa_Dependences[9 + hidden_dealer_offset].Add(new int[] { 10 }); //относительно static } }
void LOAD_GAME_SETTINGS___2_Sport() { isRobber = false; isSplit = true; canbeNoContract = true; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB_Deals_TableName = "Deals_Double"; DB_Deals_ColumnsNames.Add(1, "CardsDistribution"); DB_Deals_ColumnsNames.Add(5, "Pair1"); DB_Deals_ColumnsNames.Add(6, "Contract1"); DB_Deals_ColumnsNames.Add(7, "Result1"); DB_Deals_ColumnsNames.Add(9, "Pair2"); DB_Deals_ColumnsNames.Add(10, "Contract2"); DB_Deals_ColumnsNames.Add(11, "Result2"); columnsDataClasses = new ArrayOfTypes(); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(CardsDistribution)); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(ZoneSwitcher)); columnsDataClasses.Add(typeof(PairSwitcher)); columnsDataClasses.Add(typeof(Contract)); columnsDataClasses.Add(typeof(Result)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(PairSwitcher)); columnsDataClasses.Add(typeof(Contract)); columnsDataClasses.Add(typeof(Result)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(QuarterSwitcher)); SUBDEALS = new ArrayOfArrayOfInt(); SUBDEALS.Add(new ArrayOfInt()); SUBDEALS[0].Add(new int[] { 2, 5, 6, 7, 8 }); SUBDEALS.Add(new ArrayOfInt()); SUBDEALS[1].Add(new int[] { 3, 9, 10, 11, 12 }); ID_NAMES.Add(0, "NO"); ID_NAMES.Add(1, "DISTRIBUTION"); ID_NAMES.Add(2, "SUBNO1"); ID_NAMES.Add(3, "SUBNO2"); ID_NAMES.Add(4, "ZONE"); ID_NAMES.Add(5, "PAIR1"); ID_NAMES.Add(6, "CONTRACT1"); ID_NAMES.Add(7, "RESULT1"); ID_NAMES.Add(8, "SCORE1"); ID_NAMES.Add(9, "PAIR2"); ID_NAMES.Add(10, "CONTRACT2"); ID_NAMES.Add(11, "RESULT2"); ID_NAMES.Add(12, "SCORE2"); ID_NAMES.Add(13, "DIFF"); ID_NAMES.Add(14, "IMP"); ID_NAMES.Add(15, "DEALER"); REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR1", "CONTRACT1" }) }); REFLECT_Depends.Add(5, new int[] { 5, 6 }); REFLECT_Functions.Add(9, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR2", "CONTRACT2" }) }); REFLECT_Depends.Add(9, new int[] { 9, 10 }); REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "MDEAL_NO" }) }); REFLECT_Constructors.Add(0, new string[] { "true" }); REFLECT_Depends.Add(0, new int[] { -1 }); REFLECT_Functions.Add(2, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "SUBNO1", "0" }) }); REFLECT_Constructors.Add(2, new string[] { "true" }); REFLECT_Depends.Add(2, new int[] { -1 }); REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "SUBNO2", "1" }) }); REFLECT_Constructors.Add(3, new string[] { "true" }); REFLECT_Depends.Add(3, new int[] { -2 }); REFLECT_Functions.Add(4, new FuncInfo[] { new FuncInfo("DefineSportZone", new string[] { "ZONE", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", GameSettings_3Sports_ZoneSwims.ToString() }) }); REFLECT_Depends.Add(4, new int[] { -1 }); REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT1", "CONTRACT1", "0" }) }); REFLECT_Depends.Add(7, new int[] { 6 }); REFLECT_Constructors.Add(7, new string[] { "CONTRACT1" }); REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("SportScore", new string[] { "SCORE1", "PAIR1", "ZONE", "CONTRACT1", "RESULT1" }) }); REFLECT_Depends.Add(8, new int[] { 4, 5, 6, 7 }); REFLECT_Functions.Add(11, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT2", "CONTRACT2", "0" }) }); REFLECT_Depends.Add(11, new int[] { 10 }); REFLECT_Constructors.Add(11, new string[] { "CONTRACT2" }); REFLECT_Functions.Add(12, new FuncInfo[] { new FuncInfo("SportScoreInvert", new string[] { "SCORE2", "PAIR2", "ZONE", "CONTRACT2", "RESULT2" }) }); REFLECT_Depends.Add(12, new int[] { 4, 9, 10, 11 }); REFLECT_Functions.Add(13, new FuncInfo[] { new FuncInfo("ScoreSumm", new string[] { "DIFF", "SCORE1", "SCORE2" }) }); REFLECT_Depends.Add(13, new int[] { 8, 12 }); REFLECT_Functions.Add(14, new FuncInfo[] { new FuncInfo("ConvertToIMPs", new string[] { "IMP", "DIFF" }) }); REFLECT_Depends.Add(14, new int[] { 13 }); REFLECT_Functions.Add(15, new FuncInfo[] { new FuncInfo("DefineSportDealer", new string[] { "DEALER", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", "FIRST_DEALER", GameSettings_3Sports_ZoneSwims.ToString() }) }); REFLECT_Depends.Add(15, new int[] { -1 }); //new for match: REFLECT_Functions.Add((int)CONST.MATCH_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetMatchScore", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO", "14" }), new FuncInfo("TotalScore_MatchMode", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO__REAL" }) }); REFLECT_Depends.Add((int)CONST.MATCH_TOTAL_SCORE, new int[] { 14 }); REFLECT_InsideFunctionsList.Add("SetMatchScore"); REFLECT_InsideFunctionsList.Add("TotalScore_MatchMode"); NotNecessaryValues.Add(new int[] { 1, 13, 14 }); ContractColumns.Add(new int[] { 6, 10 }); NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt()); NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt()); NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 5 }); NotNecessaryValues_NOCONTRACT[1].Add(new int[] { 9 }); columnsControlsClasses = new ArrayOfTypes(); columnsControlsClasses.Add(typeof(DealInfoControl_split)); columnsControlsClasses.Add(typeof(ShowTextControl_Center)); columnsControlsClasses.Add(typeof(ShowTextControl_Center)); columnsControlsClasses.Add(typeof(ShowTextControl)); columnsControlsClasses.Add(typeof(SwitcherControl_Orange_Center)); columnsControlsClasses.Add(typeof(ContractSelectControl)); columnsControlsClasses.Add(typeof(ResultSelectControl)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); arrHeadersNames = new ArrayOfString(); arrHeadersNames.Add("#"); arrHeadersNames.Add("Ст\nол"); arrHeadersNames.Add("Сда\nющ."); arrHeadersNames.Add("Зона"); arrHeadersNames.Add("Па\nра"); arrHeadersNames.Add("Контракт"); arrHeadersNames.Add("Рез-т"); arrHeadersNames.Add("Очки"); arrHeadersNames.Add("Раз-\nница"); arrHeadersNames.Add("IMP"); arrHeadersNames_FULL = new ArrayOfString(); arrHeadersNames_FULL.Add("#"); arrHeadersNames_FULL.Add("Стол"); arrHeadersNames_FULL.Add("Сдающий"); arrHeadersNames_FULL.Add("Зона"); arrHeadersNames_FULL.Add("Пара"); arrHeadersNames_FULL.Add("Контракт"); arrHeadersNames_FULL.Add("Рез-т"); arrHeadersNames_FULL.Add("Очки"); arrHeadersNames_FULL.Add("Разница"); arrHeadersNames_FULL.Add("IMP"); // Какие контролы разделены? SUBDEALS_CONTROLS_ISSPLIT = new ArrayList(); SUBDEALS_CONTROLS_ISSPLIT.Add(false); SUBDEALS_CONTROLS_ISSPLIT.Add(true); SUBDEALS_CONTROLS_ISSPLIT.Add(false); SUBDEALS_CONTROLS_ISSPLIT.Add(false); SUBDEALS_CONTROLS_ISSPLIT.Add(true); SUBDEALS_CONTROLS_ISSPLIT.Add(true); SUBDEALS_CONTROLS_ISSPLIT.Add(true); SUBDEALS_CONTROLS_ISSPLIT.Add(true); SUBDEALS_CONTROLS_ISSPLIT.Add(false); SUBDEALS_CONTROLS_ISSPLIT.Add(false); arrHeadersWidths = new ArrayOfInt(); arrHeadersWidths.Add(new int[] { 22+4, 22, 33, 51+7, 26+7, 69+6, 45+6, 45+7, 45+7, 28+6 }); CoVa_Dependences = new ArrayOfArrayOfInt(); for (int i = 0; i < arrHeadersNames.Count; i++) CoVa_Dependences.Add(new ArrayOfInt()); CoVa_Dependences[0].Add(new int[] { 0, 1 }); CoVa_Dependences[2].Add(15); CoVa_Dependences[3].Add(4); CoVa_Dependences[8].Add(new int[] { 13 }); //относительно static CoVa_Dependences[9].Add(new int[] { 14 }); //относительно static CoVa_Dependences_SPLIT = new ArrayOfArrayOfInt(); for (int i = 0; i < arrHeadersNames.Count; i++) CoVa_Dependences_SPLIT.Add(new ArrayOfInt()); CoVa_Dependences_SPLIT[1].Add(new int[] { 2, 3 }); CoVa_Dependences_SPLIT[4].Add(new int[] { 5, 9 }); CoVa_Dependences_SPLIT[5].Add(new int[] { 6, 10 }); CoVa_Dependences_SPLIT[6].Add(new int[] { 7, 11 }); CoVa_Dependences_SPLIT[7].Add(new int[] { 8, 12 }); //относительно static (было 5,9,8,12) }
void LOAD_GAME_SETTINGS___1_Robber() { isRobber = true; isSplit = false; canbeNoContract = true; // ОПЦИИ GameSettings_Rob_BonusForOners = ((GameSettings_Options & 1) > 0); GameSettings_Rob_BonusForWholeRobber = ((GameSettings_Options & 2) > 0); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB_Deals_TableName = "Deals_Rob"; DB_Deals_ColumnsNames.Add(6, "CardsDistribution"); DB_Deals_ColumnsNames.Add(1, "Pair"); DB_Deals_ColumnsNames.Add(2, "Contract"); DB_Deals_ColumnsNames.Add(3, "Result"); if (GameSettings_Rob_BonusForOners) DB_Deals_ColumnsNames.Add(8, "Oners"); columnsDataClasses = new ArrayOfTypes(); columnsDataClasses.Add(typeof(ZoneSwitcher)); columnsDataClasses.Add(typeof(PairSwitcher)); columnsDataClasses.Add(typeof(Contract)); columnsDataClasses.Add(typeof(Result)); columnsDataClasses.Add(typeof(SimpleScore)); columnsDataClasses.Add(typeof(IntData)); columnsDataClasses.Add(typeof(CardsDistribution)); columnsDataClasses.Add(typeof(QuarterSwitcher)); if (GameSettings_Rob_BonusForOners) columnsDataClasses.Add(typeof(OnersSwitcher)); ID_NAMES.Add(0, "ZONE"); ID_NAMES.Add(1, "PAIR"); ID_NAMES.Add(2, "CONTRACT"); ID_NAMES.Add(3, "RESULT"); ID_NAMES.Add(4, "RDEAL_LIGHTSCORE"); ID_NAMES.Add(5, "NO"); ID_NAMES.Add(6, "DISTRIBUTION"); ID_NAMES.Add(7, "DEALER"); if (GameSettings_Rob_BonusForOners) ID_NAMES.Add(8, "ONERS"); REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("DefineRobberZone", new string[] { "ZONE", "ROBBER", "RDEAL_NO" }) }); REFLECT_Depends.Add(0, new int[] { -1 }); REFLECT_Functions.Add(1, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR", "CONTRACT" }) }); REFLECT_Depends.Add(1, new int[] { 1, 2 }); REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT", "CONTRACT", "0" }) }); REFLECT_Depends.Add(3, new int[] { 2 }); REFLECT_Constructors.Add(3, new string[] { "CONTRACT" }); if (GameSettings_Rob_BonusForOners) { REFLECT_Functions.Add((int)CONST.RDEAL_FULLSCORE, new FuncInfo[] { new FuncInfo("RobberScore", new string[] { "RDEAL_FULLSCORE", "PAIR", "ZONE", "CONTRACT", "RESULT", (GameSettings_Rob_BonusForWholeRobber ? "TRUE" : "FALSE"), "ROBBER", "RDEAL_NO", "ONERS" }) }); REFLECT_Depends.Add((int)CONST.RDEAL_FULLSCORE, new int[] { 0, 1, 2, 3, 8 }); } else { REFLECT_Functions.Add((int)CONST.RDEAL_FULLSCORE, new FuncInfo[] { new FuncInfo("RobberScore", new string[] { "RDEAL_FULLSCORE", "PAIR", "ZONE", "CONTRACT", "RESULT", (GameSettings_Rob_BonusForWholeRobber ? "TRUE" : "FALSE"), "ROBBER", "RDEAL_NO" }) }); REFLECT_Depends.Add((int)CONST.RDEAL_FULLSCORE, new int[] { 0, 1, 2, 3 }); } REFLECT_Functions.Add(4, new FuncInfo[] { new FuncInfo("RobberScoreLight", new string[] { "RDEAL_LIGHTSCORE", "RDEAL_FULLSCORE" }) }); REFLECT_Depends.Add(4, new int[] { (int)CONST.RDEAL_FULLSCORE }); REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "RDEAL_NO" }) }); REFLECT_Constructors.Add(5, new string[] { "true" }); REFLECT_Depends.Add(5, new int[] { -1 }); REFLECT_Functions.Add((int)CONST.ROBBER, new FuncInfo[] { new FuncInfo("CleanUnnecessaryRDealsInRobber", new string[] { "ROBBER", "ROBBER_FIRSTLINE" }), new FuncInfo("InvalidateRobber", new string[] { "ROBBER" }) }); REFLECT_Depends.Add((int)CONST.ROBBER, new int[] { (int)CONST.RDEAL_FULLSCORE }); REFLECT_Recounts.Add((int)CONST.ROBBER, new int[] { 0, (int)CONST.RDEAL_FULLSCORE }); REFLECT_Functions.Add((int)CONST.ROBBER_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetRobberScore", new string[] { "ROBBER", "ROBBER_TOTAL_SCORE" }), new FuncInfo("TotalScore_RobberMode", new string[] { "ROBBER_TOTAL_SCORE", "ROBBER_NO__REAL" }) }); REFLECT_Depends.Add((int)CONST.ROBBER_TOTAL_SCORE, new int[] { (int)CONST.ROBBER }); REFLECT_InsideFunctionsList.Add("CleanUnnecessaryRDealsInRobber"); REFLECT_InsideFunctionsList.Add("InvalidateRobber"); REFLECT_InsideFunctionsList.Add("TotalScore_RobberMode"); REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("DefineRobberDealer", new string[] { "DEALER", "LINE_NO__REAL", "ROBBER_NO__REAL", "RDEAL_NO", "FIRST_DEALER" }) }); REFLECT_Depends.Add(7, new int[] { -1 }); if (GameSettings_Rob_BonusForOners) { REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("GetOners", new string[] { "ONERS", "CONTRACT", "DISTRIBUTION" }) }); REFLECT_Depends.Add(8, new int[] { 8, 2, 6 }); } NotNecessaryValues.Add(6); ContractColumns.Add(new int[] { 2 }); NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt()); NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 1 }); if (GameSettings_Rob_BonusForOners) NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 8 }); columnsControlsClasses = new ArrayOfTypes(); columnsControlsClasses.Add(typeof(DealInfoControl)); columnsControlsClasses.Add(typeof(ShowTextControl_Center)); columnsControlsClasses.Add(typeof(ShowTextControl)); columnsControlsClasses.Add(typeof(SwitcherControl_Orange_Center)); columnsControlsClasses.Add(typeof(ContractSelectControl)); if (GameSettings_Rob_BonusForOners) columnsControlsClasses.Add(typeof(SwitcherControl_Orange)); columnsControlsClasses.Add(typeof(ResultSelectControl)); columnsControlsClasses.Add(typeof(ShowSimpleScore)); arrHeadersNames = new ArrayOfString(); arrHeadersNames.Add("#"); arrHeadersNames.Add("Сда\nющ."); arrHeadersNames.Add("Зона"); arrHeadersNames.Add("Па\nра"); arrHeadersNames.Add("Контракт"); if (GameSettings_Rob_BonusForOners) arrHeadersNames.Add("Онеры"); arrHeadersNames.Add("Рез-т"); arrHeadersNames.Add("Очки"); arrHeadersNames_FULL = new ArrayOfString(); arrHeadersNames_FULL.Add("#"); arrHeadersNames_FULL.Add("Сдающий"); arrHeadersNames_FULL.Add("Зона"); arrHeadersNames_FULL.Add("Пара"); arrHeadersNames_FULL.Add("Контракт"); if (GameSettings_Rob_BonusForOners) arrHeadersNames_FULL.Add("Онеры"); arrHeadersNames_FULL.Add("Рез-т"); arrHeadersNames_FULL.Add("Очки"); arrHeadersWidths = new ArrayOfInt(); if (GameSettings_Rob_BonusForOners) { arrHeadersWidths.Add(new int[] { 22, 33, 51, 26, 69, /*oners*/51, 45, 45 }); } else { arrHeadersWidths.Add(new int[] { 22+8, 33, 51+9, 26+9, 69+8, 45+9, 45+9 }); } CoVa_Dependences = new ArrayOfArrayOfInt(); for (int i = 0; i < arrHeadersNames.Count; i++) CoVa_Dependences.Add(new ArrayOfInt()); CoVa_Dependences[0].Add(new int[] { 5, 6 }); CoVa_Dependences[1].Add(7); CoVa_Dependences[2].Add(0); CoVa_Dependences[3].Add(1); CoVa_Dependences[4].Add(2); if (GameSettings_Rob_BonusForOners) { CoVa_Dependences[5].Add(8); CoVa_Dependences[6].Add(3); CoVa_Dependences[7].Add(new int[] { 4 }); //относительно static } else { CoVa_Dependences[5].Add(3); CoVa_Dependences[6].Add(new int[] { 4 }); //относительно static } }
// Загрузить список матчей игры void DB_OpenGame() { loadingFromDB = true; Cursor.Current = Cursors.WaitCursor; // Загрузить ids матчей в DB_Matches_Ids_ALL System.Data.SqlServerCe.SqlCeCommand sqlQuery = DB.CreateQuery(); //sql_optimize //sqlQuery.CommandText = "SELECT Matches.id as mid, Matches.SCORE_NS, Matches.SCORE_EW, COUNT(" + DB_Deals_TableName + ".id) FROM Matches INNER JOIN " + DB_Deals_TableName + " ON (Matches.id = " + DB_Deals_TableName + ".fk_Match_id) WHERE (Matches.fk_Game_id=" + DB_Game_Id + ") GROUP BY Matches.id, Matches.SCORE_NS, Matches.SCORE_EW ORDER BY mid"; //sqlQuery.CommandText = "SELECT m.id as mid, Matches.SCORE_NS, Matches.SCORE_EW FROM (SELECT DISTINCT Matches.id FROM Matches INNER JOIN " + DB_Deals_TableName + " ON (Matches.id = " + DB_Deals_TableName + ".fk_Match_id) WHERE (Matches.fk_Game_id=" + DB_Game_Id + ")) m INNER JOIN Matches ON (m.id = Matches.id) ORDER BY mid"; sqlQuery.CommandText = "SELECT id as mid, SCORE_NS, SCORE_EW FROM Matches m WHERE fk_Game_id = " + DB_Game_Id + " AND EXISTS (SELECT id FROM " + DB_Deals_TableName + " WHERE fk_Match_id = m.id) ORDER BY mid"; System.Data.SqlServerCe.SqlCeDataReader sqlReader = DB.ExecuteReader(sqlQuery); DB_Matches_Ids_ALL = new ArrayOfInt(); while (sqlReader.Read()) { // Взять total-score из БД: if (sqlReader.IsDBNull(sqlReader.GetOrdinal("SCORE_NS")) || sqlReader.IsDBNull(sqlReader.GetOrdinal("SCORE_EW"))) { DB_Matches_TotalScores.Add(new DealScore(0, 0)); } else { DB_Matches_TotalScores.Add(new DealScore(sqlReader.GetInt32(sqlReader.GetOrdinal("SCORE_NS")), sqlReader.GetInt32(sqlReader.GetOrdinal("SCORE_EW")))); } // ids: DB_Matches_Ids_ALL.Add(sqlReader.GetInt32(sqlReader.GetOrdinal("mid"))); } sqlReader.Close(); // Загрузить ids матчей в селектор match_in_combo m = new match_in_combo(); m.isrob = isRobber; for (int i = 0; i < DB_Matches_Ids_ALL.Count; i++) { m.no = i; m.id = DB_Matches_Ids_ALL[i]; m.score_NS = ((DealScore)DB_Matches_TotalScores[i]).NS; m.score_EW = ((DealScore)DB_Matches_TotalScores[i]).EW; PAGE__ComboBox.Items.Add(m); } TS_SHOW(); Cursor.Current = Cursors.Default; loadingFromDB = false; }
bool AddNewMatch(bool loadFromDB) { // >>> Проверить, есть ли незаконченные матчи??? <<< if (!loadFromDB && PAGE__VIEW) { ArrayOfInt arrNotCompletedMatches = new ArrayOfInt(); for (int i = 0; i < DB_Matches_Ids_ALL.Count; i++) { if (((DealScore)DB_Matches_TotalScores[i]).IsEmpty()) arrNotCompletedMatches.Add(i); } if (arrNotCompletedMatches.Count > 0) { string s = (isRobber ? "Роббер" : "Матч"); if (arrNotCompletedMatches.Count > 1) s += (isRobber ? "ы" : "и"); s += " "; for (int i = 0; i < arrNotCompletedMatches.Count; i++) { if (i > 0) s += ", "; s += "#" + (arrNotCompletedMatches[i] + 1); } s += (" еще не закончен" + (arrNotCompletedMatches.Count > 1 ? "ы" : "") + "!\nВсе равно начать новый?"); if (MessageBox.Show(s, "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.No) return false; } } if (PAGE__VIEW) { return AddNewMatch_PAGE_MODE(loadFromDB); } else { return AddNewMatch_SIMPLE_MODE(loadFromDB); } }
public BridgeScoreTable(Form f, int GameId) { m_form = f; InitializeComponent(); // Для нормального авто-скролла fakeControlForAutoScroll = new Control(); fakeControlForAutoScroll.Size = new Size(0, 0); fakeControlForAutoScroll.Location = new Point(0, 0); this.Controls.Add(fakeControlForAutoScroll); // Создать селектор матчей: if (PAGE__VIEW) { PAGE__ComboBox = new ComboBox(); PAGE__ComboBox.DropDownStyle = ComboBoxStyle.DropDownList; PAGE__ComboBox.Location = new Point(4, 2); PAGE__ComboBox.Font = new Font("Tahoma", 6, FontStyle.Regular); PAGE__ComboBox.Size = new Size(250, 30); m_form.Controls.Add(PAGE__ComboBox); PAGE__ComboBox.SelectedIndexChanged += new EventHandler(PAGE_ComboBox_SelectedIndexChanged); } // Создать надпись total-score TS_SCore = new DealScore_CLASS(); TS_Label = new ShowTextControl(); TS_Label.Location = new Point(270, 2); TS_Label.Size = new Size(180, (PAGE__VIEW ? PAGE__ComboBox.Height : 30)); TS_Label.SetTextFormat(StringAlignment.Center, StringAlignment.Center, 0, 0); TS_Label.SetTextFonts(new Font[] { new Font("Tahoma", 7, FontStyle.Bold) }); //TS_Label.BackColor = Color.Aqua; TS_Label.AttachData(TS_SCore); m_form.Controls.Add(TS_Label); // Конструкторы для БД DB_Game_Id = GameId; DB_Matches_Ids = new ArrayOfInt(); DB_Deals_Ids = new ArrayOfArrayOfInt(); DB_Deals_ColumnsNames = new Dictionary<int, string>(); // ************** DB - загрузить параметры, важно сначала это сделать **************** DB_LoadGameParameters(); // Указать !НАШУ ПАРУ!, чтобы очки писались относительно нее (взыть из БД) ShowSimpleScore.RelativePair = Pairs.NS; BridgeGameScoring.RelativePair = Pairs.NS; // Конструкторы массивов для reflect: REFLECT_Functions = new Dictionary<int, FuncInfo[]>(); REFLECT_Depends = new Dictionary<int, int[]>(); REFLECT_Constructors = new Dictionary<int, string[]>(); REFLECT_Recounts = new Dictionary<int, int[]>(); REFLECT_InsideFunctionsList = new ArrayOfString(); NotNecessaryValues = new ArrayOfInt(); ContractColumns = new ArrayOfInt(); NotNecessaryValues_NOCONTRACT = new ArrayOfArrayOfInt(); // Общие ID для ф-ий reflect ID_NAMES = new Dictionary<int, string>(); ID_NAMES.Add((int)CONST.LINE_NO, "LINE_NO"); //for robber: ID_NAMES.Add((int)CONST.ROBBER_NO, "ROBBER_NO"); ID_NAMES.Add((int)CONST.RDEAL_NO, "RDEAL_NO"); ID_NAMES.Add((int)CONST.ROBBER, "ROBBER"); ID_NAMES.Add((int)CONST.ROBBER_TOTAL_SCORE, "ROBBER_TOTAL_SCORE"); ID_NAMES.Add((int)CONST.RDEAL_FULLSCORE, "RDEAL_FULLSCORE"); ID_NAMES.Add((int)CONST.ROBBER_FIRSTLINE, "ROBBER_FIRSTLINE"); //new for match: ID_NAMES.Add((int)CONST.MATCH_NO, "MATCH_NO"); ID_NAMES.Add((int)CONST.MDEAL_NO, "MDEAL_NO"); ID_NAMES.Add((int)CONST.MATCH_TOTAL_SCORE, "MATCH_TOTAL_SCORE"); ID_NAMES.Add((int)CONST.MATCH_FIRSTLINE, "MATCH_FIRSTLINE"); //first dealer: ID_NAMES.Add((int)CONST.FIRST_DEALER, "FIRST_DEALER"); //loading: ID_NAMES.Add((int)CONST.LOADING_FROM_DB, "LOADING_FROM_DB"); //for page mode: ID_NAMES.Add((int)CONST.LINE_NO__REAL, "LINE_NO__REAL"); ID_NAMES.Add((int)CONST.ROBBER_NO__REAL, "ROBBER_NO__REAL"); ID_NAMES.Add((int)CONST.MATCH_NO__REAL, "MATCH_NO__REAL"); // Загрузка всех необходимых настроек для данного типа игры: switch (GameSettings_GameType) { case GameType.Robber: LOAD_GAME_SETTINGS___1_Robber(); break; case GameType.Sport: LOAD_GAME_SETTINGS___2_Sport(); break; case GameType.Compensat: LOAD_GAME_SETTINGS___3_Compensat(); break; case GameType.SimpleIMP: LOAD_GAME_SETTINGS___4_SimpleIMP(); break; } // В зависимости от того, может ли быть "нет контракта", спрятать или показать кнопку [НЕТ КОНТРАКТА] на селекторе ContractSelector.ExtendedWidth(canbeNoContract); // Координаты этой таблицы + контрол роббера: int page_combo_height = 0; if (PAGE__VIEW) page_combo_height = PAGE__ComboBox.Height + 3; if (isRobber) { CONTROL_ROBBER = new RobberControl(); CONTROL_ROBBER.Location = new Point(2, 2 + page_combo_height); //промежуток должен быть CONTROL_ROBBER.Size = new Size(size_CONTROL_ROBBER.Width, m_form.Height - 2 * 2 - page_combo_height); m_form.Controls.Add(CONTROL_ROBBER); this.Location = new Point(2 + size_CONTROL_ROBBER.Width + 3, 2 + page_combo_height); //промежуток должен быть = 3 this.Width = f.Width - 2 * 2 - (size_CONTROL_ROBBER.Width + 3); } else { this.Location = new Point(2, 2 + page_combo_height); this.Width = f.Width - 2 * 2; } this.Height = f.Height - 2 * 2 - page_combo_height; // Обработка передвижений оранжевого курсора по таблице this.ActiveElementChanged += OnActiveElementChanged; // Конструкторы данных и контролов: VALUES = new ArrayOfArrayOfObject(); CONTROLS = new ArrayOfArrayOfControl(); CONTROLS_COVERS = new ArrayOfArrayOfControl(); if (isRobber) // для робберного бриджа: { // Создание массива робберов ROBBERS = new ArrayOfRobbers(); } // Создание массива заголовков с totalscore-ми (вверху каждого роббера/матча) и контролов для них HeadlinesScores = new ArrayList(); HeadlinesScores_Controls = new ArrayOfControl(); HeadlinesScores_CoverControls = new ArrayOfControl(); // ************** DB - построить таблицу **************** DB_Matches_TotalScores = new ArrayList(); if (PAGE__VIEW) DB_LoadIDs_BuildTable_v3(); else DB_LoadIDs_BuildTable_v2(); }
void CountScore() { bool ready = true; bool inzone = checkBox1.Checked; int contract_quantity = 0; if (comboBox1.SelectedIndex == -1) ready = false; else contract_quantity = int.Parse(comboBox1.Items[comboBox1.SelectedIndex] as string); CardTrump contract_trump = CardTrump.NotYetDefined; if (comboBox2.SelectedIndex == -1) { ready = false; } else { string trump_str = (string)comboBox2.Items[comboBox2.SelectedIndex]; switch (trump_str) { case "Hearts": contract_trump = CardTrump.Hearts; break; case "Diamonds": contract_trump = CardTrump.Diamonds; break; case "Clubs": contract_trump = CardTrump.Clubs; break; case "Spades": contract_trump = CardTrump.Spades; break; case "NT": contract_trump = CardTrump.NT; break; } } bool contract_double = checkBox2.Checked; bool contract_redouble = checkBox3.Checked; int result = -1; if (comboBox3.SelectedIndex == -1) ready = false; else result = int.Parse(comboBox3.Items[comboBox3.SelectedIndex] as string); //--------------------------------- int score = 0; int bonus = 0; if (ready) { int result_diff = result - (6 + contract_quantity); // ----------------------------- robber --------------------------- if (IsRobber) { // --- Если контракт сыгран --- if (result_diff >= 0) { // Очки за взятки: score = contract_quantity * (SmallHelper.WhatTrumpType(contract_trump) == TrumpType.Minor ? 20 : 30) + (contract_trump == CardTrump.NT ? 10 : 0); if (contract_double) score *= 2; else if (contract_redouble) score *= 4; // Премия за превышение взяток: ArrayOfInt bonuses = new ArrayOfInt(); if (result_diff > 0) { if (contract_double) bonuses.Add(result_diff * (inzone ? 200 : 100)); else if (contract_redouble) bonuses.Add(result_diff * (inzone ? 400 : 200)); else bonuses.Add(result_diff * (SmallHelper.WhatTrumpType(contract_trump) == TrumpType.Minor ? 20 : 30)); } if (contract_quantity == 6) //малый шлем { bonuses.Add(inzone ? 750 : 500); } else if (contract_quantity == 7) //большой шлем { bonuses.Add(inzone ? 1500 : 1000); } // Дополнительная премия за оскорбление: if (contract_double) bonuses.Add(50); else if (contract_redouble) bonuses.Add(100); // Посчитать сумму бонусов for (int i = 0; i < bonuses.Count; i++) bonus += bonuses[i]; } // --- Если контракт проигран --- else { int enemy_score = 0; for (int i = -1; i >= result_diff; i--) { if (i == -1) { if (contract_double) enemy_score += (inzone ? 200 : 100); else if (contract_redouble) enemy_score += (inzone ? 400 : 200); else enemy_score += (inzone ? 100 : 50); } else { if (contract_double) enemy_score += (inzone ? 300 : 200); else if (contract_redouble) enemy_score += (inzone ? 600 : 400); else enemy_score += (inzone ? 100 : 50); } } bonus = -enemy_score; } } // ----------------------------- sport --------------------------- else { // --- Если контракт сыгран --- if (result_diff >= 0) { // Очки за взятки: score = contract_quantity * (SmallHelper.WhatTrumpType(contract_trump) == TrumpType.Minor ? 20 : 30) + (contract_trump == CardTrump.NT ? 10 : 0); if (contract_double) score *= 2; else if (contract_redouble) score *= 4; // Премия за превышение взяток: if (result_diff > 0) { if (contract_double) bonus += result_diff * (inzone ? 200 : 100); else if (contract_redouble) bonus += result_diff * (inzone ? 400 : 200); else bonus += result_diff * (SmallHelper.WhatTrumpType(contract_trump) == TrumpType.Minor ? 20 : 30); } if (contract_quantity == 6) //малый шлем { bonus += (inzone ? 750 : 500); } if (contract_quantity == 7) //большой шлем { bonus += (inzone ? 1500 : 1000); } if (score >= 100) //за гейм { bonus += (inzone ? 500 : 300); } else //за частичную запись { bonus += 50; } // Дополнительная премия: if (contract_double) bonus += 50; else if (contract_redouble) bonus += 100; } // --- Если контракт проигран --- else { int enemy_score = 0; for (int i = -1; i >= result_diff; i--) { if (i == -1) { if (contract_double) enemy_score += (inzone ? 200 : 100); else if (contract_redouble) enemy_score += (inzone ? 400 : 200); else enemy_score += (inzone ? 100 : 50); } else if (i == -2 || i == -3) { if (contract_double) enemy_score += (inzone ? 300 : 200); else if (contract_redouble) enemy_score += (inzone ? 600 : 400); else enemy_score += (inzone ? 100 : 50); } else { if (contract_double) enemy_score += (inzone ? 300 : 300); else if (contract_redouble) enemy_score += (inzone ? 600 : 600); else enemy_score += (inzone ? 100 : 50); } } bonus = -enemy_score; } } } //--------------------------------- if (IsRobber) { label6.Text = score.ToString(); label7.Text = bonus.ToString(); } else { label6.Text = (score + bonus).ToString(); } }
/// <summary> /// Query on EM list /// </summary> public string Query() { using (var em = new EMWebServicesClientExtension(Auth.GetToken(), Settings.Default.EndPoint)) { DMListCriteria criteria = new DMListCriteria(); // Set lists to query against. The lists needs to share the same primary key. int listID = 1192; var listIds = new ArrayOfInt { listID }; // Add more lists as needed // listIds.Add(2); // listIds.Add(3); criteria.IncludeLists = listIds; // Set conditions var dmFieldCriteriaList = new List <DMFieldCriteria>(); // e.g. condition for 'subscribed' recipients DMFieldCriteria dmFieldCriteria = new DMFieldCriteria { QueryType = DMFieldQueryType.DMQT_ENABLED, Parameter = 1, Operator = DMSQLOperator.DMSQ_EQUAL, Combine = DMCombine.DMCM_AND }; dmFieldCriteriaList.Add(dmFieldCriteria); // e.g. condition for 'created' 7 days ago. dmFieldCriteria = new DMFieldCriteria { QueryType = DMFieldQueryType.DMQT_MODIFIED, Parameter = 0, Operator = DMSQLOperator.DMSQ_GREATERTHAN, Combine = DMCombine.DMCM_NONE, Date1 = DateTime.Now.AddDays(-365 * 10) // dmFieldCriteria.Date2 = DateTime.Today.AddDays(1); // Not need for now, but will be needed when used with data range option. }; dmFieldCriteriaList.Add(dmFieldCriteria); criteria.FieldCriteria = dmFieldCriteriaList.ToArray(); // Run query int countRecipients = em.ListManager.ExecuteListQuery(em.Token, criteria); // Set field IDs to download var fields = new ArrayOfInt { em.GetField("email").ID, em.GetField("firstname").ID }; // Download list int startIndex = 0; int endIndex = 999999999; int count; var result = em.ListManager.GetQueryResultsCSV(em.Token, fields, startIndex, endIndex, false, out count); return(result); } }
static void R13ddCard(int erid) { MCNSService.MCNSServiceSoapClient client = new MCNSServiceSoapClient(); //RoomInfo[] rinfos= client.GetAllRoom(); //foreach (RoomInfo info in rinfos) // Console.WriteLine(info.ERID + " " + info.ERName); System.IO.StreamReader rd=new StreamReader( System.IO.File.OpenRead("card.csv")); string s = rd.ReadToEnd(); //int[] erids=(from n in rinfos select n.ERID).ToArray(); string[] cards = s.Split(new char[]{'\r','\n'}, StringSplitOptions.RemoveEmptyEntries); test.MCNSService.ArrayOfInt ait = new ArrayOfInt(); ait.Add(erid); System.Collections.Generic.List<AddCardInfo> list = new List<AddCardInfo>(); foreach (string ss in cards) { Console.WriteLine(ss); AddCardInfo addcard = new AddCardInfo() { CardNo=ss, ERIDs=ait, StartDate=DateTime.Now,EndDate=DateTime.Now.AddMonths(24), MCNSID="test", Name="david" }; list.Add(addcard); Console.WriteLine( client.AddCardWithoutNotify(addcard)); } // client.NotifyDbChange(); // client.AddCard(list.ToArray()); }
void ActivateNewDeal(int newline, int level, bool loadFromDB, SqlCeDataReader sqlReader) { // ----------- 1. Создание сдачи в БД / загрузка сдачи из БД + REFLECT -------------- if (!loadFromDB) { // !!! Выполнить инициализацию данных, помеченных в REFLECT_Depends со значением {-1} // !!! Обычно это зона и порядковые номера // !!! При sub-deal для 1 стола -1, для 2 стола -2 и т.д. REFLECT_DEPENDENCES(newline, (this.isSplit ? -(level + 1) : -1)); } else { ArrayOfInt poss = new ArrayOfInt(); //колонки, в которые будут загружены данные; список всегда начинается с -1 (-2) poss.Add((this.isSplit ? -(level + 1) : -1)); for (int i = 0; i < DB_Deals_ColumnsNames.Keys.Count; i++) { int colPos = DB_Deals_ColumnsNames.Keys.ElementAt(i); //VALUES[newline, colPos] if (this.isSplit) { if (SUBDEALS_WhatLevel(colPos) == level || SUBDEALS_WhatLevel(colPos) == -1 && level == 0) { //ok } else continue; } // *** Загрузить из БД *** poss.Add(colPos); object val = sqlReader.GetValue(sqlReader.GetOrdinal(DB_Deals_ColumnsNames[colPos])); (VALUES[newline, colPos] as ISQLSerialize)._FromDataBase(val); } // Одним махом REFLECT для poss[] - т.е. для начала (-1, -2 для subdeal) и для загруженных данных REFLECT_DEPENDENCES(newline, poss); } // -------------- 2. Активация изменений данных: Changed -> SAVE, REFLECT ---------------- for (int i = 0; i < columnsDataClasses.Count; i++) { if (this.isSplit) { if (SUBDEALS_WhatLevel(i) == level || SUBDEALS_WhatLevel(i) == -1 && level == 0) { //ok } else continue; } // >>>>>>>>> Сначала SAVE, потом REFLECT <<<<<<<<<<<<<< // delme!!! if (DB_Deals_ColumnsNames.Keys.Contains(i)) (VALUES[newline, i] as BaseChangedData).Changed += OnInputChanged_SaveToDataBase; (VALUES[newline, i] as BaseChangedData).Changed += OnInputChanged; } // ----------------- 3. Присоединение данных к контролам ----------------- int startControlIndex; int endControlIndex; if (!this.isSplit || this.isSplit && level == 0) { startControlIndex = 0; endControlIndex = columnsControlsClasses.Count - 1; } else { startControlIndex = columnsControlsClasses.Count + (level - 1) * SUBDEALS_CONTROLS_GetSpliColumnsCount(); endControlIndex = startControlIndex + SUBDEALS_CONTROLS_GetSpliColumnsCount() - 1; } for (int i = startControlIndex; i <= endControlIndex; i++) { int columnIndex = (!this.isSplit ? i : SUBDEALS_CONTROLS_Get_Split_Coordinates(i).column); MethodInfo method; Type[] types; object[] parameters; int params_count = 0; //для sub-deal if (!this.isSplit) { types = new Type[CoVa_Dependences[columnIndex].Count]; for (int j = 0; j < CoVa_Dependences[columnIndex].Count; j++) types[j] = VALUES[newline, CoVa_Dependences[columnIndex, j]].GetType(); } else { params_count = CoVa_Dependences[columnIndex].Count + (CoVa_Dependences_SPLIT[columnIndex].Count / SUBDEALS.Count); types = new Type[params_count]; int ind = 0; for (int j = 0; j < CoVa_Dependences[columnIndex].Count; j++) { types[ind++] = VALUES[newline, CoVa_Dependences[columnIndex, j]].GetType(); } for (int j = 0; j < CoVa_Dependences_SPLIT[columnIndex].Count; j++) { int l = SUBDEALS_WhatLevel(CoVa_Dependences_SPLIT[columnIndex, j]); if (l == level) types[ind++] = VALUES[newline, CoVa_Dependences_SPLIT[columnIndex, j]].GetType(); } } method = CONTROLS[newline, i].GetType().GetMethod("AttachData", types); if (method != null) { if (!this.isSplit) { parameters = new object[CoVa_Dependences[columnIndex].Count]; for (int j = 0; j < CoVa_Dependences[columnIndex].Count; j++) parameters[j] = VALUES[newline, CoVa_Dependences[columnIndex, j]]; } else { parameters = new object[params_count]; int ind = 0; for (int j = 0; j < CoVa_Dependences[columnIndex].Count; j++) { parameters[ind++] = VALUES[newline, CoVa_Dependences[columnIndex, j]]; } for (int j = 0; j < CoVa_Dependences_SPLIT[columnIndex].Count; j++) { int l = SUBDEALS_WhatLevel(CoVa_Dependences_SPLIT[columnIndex, j]); if (l == level) parameters[ind++] = VALUES[newline, CoVa_Dependences_SPLIT[columnIndex, j]]; } } method.Invoke(CONTROLS[newline, i], parameters); } } }
private void TopTenHandler(object sender, IrcEventArgs e) { string sendto = (string.IsNullOrEmpty(e.Data.Channel)) ? e.Data.Nick : e.Data.Channel; RecordValue[][] values; // *** hard coded query *** const bool cacheFlag = false; var ownerIds = new ArrayOfInt(); var queryFields = new ArrayOfString { "row", "Nick", "Pure_PlayerDM_ELO", "Pure_PlayerDM_EVENT_KILLS", "Pure_PlayerDM_EVENT_DEATHS" }; const int surrounding = 0; const int limit = 10; const int offset = 0; const string targetFilter = ""; const string orderBy = "Pure_PlayerDM_ELO desc"; const string filter = "NUM_Pure_PlayerDM > 0"; // *** end hard coded query *** EnsureTicket(); try { var searchForRecordsRequest = new SearchForRecordsRequest(new SearchForRecordsRequestBody(Ut3GameId, ticket, StatsTable, queryFields, filter, orderBy, offset, limit, targetFilter, surrounding, ownerIds, cacheFlag)); var recordsResponse = gsStorage.SearchForRecords(searchForRecordsRequest); values = recordsResponse.Body.values; if (recordsResponse.Body.SearchForRecordsResult == Result.Success) { Log.Instance.Log("Webservice returned '" + recordsResponse.Body.SearchForRecordsResult + "' instead of success."); return; } } catch (Exception exception) { Log.Instance.Log(exception); return; } foreach (var msg in values.Select(perPlayerValues => RecordValueToString(perPlayerValues[0]) + ". " + RecordValueToString(perPlayerValues[1]) + " ELO: " + RecordValueToString(perPlayerValues[2]) + " Kills: " + RecordValueToString(perPlayerValues[3]) + " Deaths: " + RecordValueToString(perPlayerValues[4]))) { BotMethods.SendMessage(SendType.Notice, sendto, msg); } }