Ejemplo n.º 1
0
 // Simple method (send text and click)
 public void SignIn(String userName, String password, String database)
 {
     Field1.SendKeys(userName);
     Field2.SendKeys(password);
     DropDown.SendKeys(database);
     Button.Click();
 }
Ejemplo n.º 2
0
 // Simple method with Assert (send text, verify data and click)
 public void SignInWithAssert(String userName, String password, String database)
 {
     Field1.SendKeys(userName);
     Field2.SendKeys(password);
     Assert.AreEqual(DropDown.Text, database);
     Button.Click();
 }
Ejemplo n.º 3
0
 public string ToLine()
 {
     return("H1"
            + $"{Field1.ToFixedString(10)}"
            + $"{Field2.ToFixedString(10)}"
            + $"{Field3.ToFixedString(10)}"
            + "");
 }
Ejemplo n.º 4
0
        public string ToOldString()
        {
            string content = "当前状态 : " + FaultTitle + "\r\n太阳能电压 : " + Field1.ToString("0.00") + " V\r\n超容电压 : " + Field2.ToString("0.00") + " V\r\n超容电流 : " + Field3.ToString("0.00") + " A\r\n功率 : " + Field4.ToString("0.00") + " W\r\n温度 : " + Field5.ToString("0.00") + " ℃";

            content += "\r\n更新时间 : " + CreateTime;

            return(content);
        }
Ejemplo n.º 5
0
 //Simple method with ExpectedConditions (send text, wait for element and click)
 public void SignInWithEC(String userName, String password, String database)
 {
     Field1.SendKeys(userName);
     this._wait.Until(ExpectedConditions.ElementToBeClickable(Field2));
     Field2.SendKeys(password);
     DropDown.SendKeys(database);
     Button.Click();
 }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            int hash1 = Field1.GetHashCode();
            int hash2 = Field2.GetHashCode();

            // https://en.wikipedia.org/wiki/Pairing_function
            return(((hash1 + hash2) * (hash1 + hash2 + 1) / 2) + Math.Min(hash1, hash2));
        }
Ejemplo n.º 7
0
 public string ToLine()
 {
     return("D1"
            + $"{Field1.ToFixedString(10)}"
            + $"{Field2.ToFixedString(10)}"
            + $"{Field3.ToFixedString(10)}"
            + $"{Field4.ToFixedString(10)}"
            + $"{Field5.ToFixedStringRight(10, '0')}"
            + "");
 }
        protected override void Execute(CodeActivityContext context)
        {
            //Channel Details
            var writeKey = Write_API_Key.Get(context);

            //Field Values
            var f1 = Field1.Get(context) != null ? "&field1=" + Field1.Get(context) : "";
            var f2 = Field2.Get(context) != null ? "&field2=" + Field2.Get(context) : "";
            var f3 = Field3.Get(context) != null ? "&field3=" + Field3.Get(context) : "";
            var f4 = Field4.Get(context) != null ? "&field4=" + Field4.Get(context) : "";
            var f5 = Field5.Get(context) != null ? "&field5=" + Field5.Get(context) : "";
            var f6 = Field6.Get(context) != null ? "&field6=" + Field6.Get(context) : "";
            var f7 = Field7.Get(context) != null ? "&field7=" + Field7.Get(context) : "";
            var f8 = Field8.Get(context) != null ? "&field8=" + Field8.Get(context) : "";

            var chosenFormat = Format.GetHashCode() == 0 ? "" : "." + Format.ToString();

            //Optional Parameters
            var lat        = Lat.Get(context) == 0 ? "" : "&lat=" + Lat.Get(context).ToString();
            var lon        = Long.Get(context) == 0 ? "" : "&long=" + Long.Get(context).ToString();
            var elevation  = Elevation.Get(context) == 0 ? "" : "&elevation=" + Elevation.Get(context).ToString();
            var status     = Status.Get(context) == null ? "" : "&status=" + Status.Get(context);
            var twitter    = Twitter.Get(context) == null ? "" : "&twitter=" + Twitter.Get(context);
            var tweet      = Tweet.Get(context) == null ? "" : "&tweet=" + Tweet.Get(context);
            var created_at = Created_at.Get(context) == null ? "" : "&created_at=" + Created_at.Get(context);


            //Http Request URL
            string URL = "https://api.thingspeak.com/update" + chosenFormat + "?api_key=" + writeKey;

            URL = URL + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + lat + lon + elevation + status + twitter + tweet + created_at;

            //Creating GET Http Request
            WebRequest   wrGETURL  = WebRequest.Create(URL);
            Stream       objStream = wrGETURL.GetResponse().GetResponseStream();
            StreamReader objReader = new StreamReader(objStream);

            //Capturing the response
            string sLine        = "";
            string httpResponse = "";

            while (sLine != null)
            {
                sLine = objReader.ReadLine();
                if (sLine != null)
                {
                    httpResponse = httpResponse + sLine + "\n";
                }
            }
            objStream.Close();
            //objReader.Close();
            Response.Set(context, httpResponse);
        }
Ejemplo n.º 9
0
        private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            bool isNumPadNumeric = (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9);
            bool isNumeric       = (e.Key >= Key.D0 && e.Key <= Key.D9);

            Key[] keysToFilter = { Key.Delete, Key.Back, Key.Left, Key.Right, Key.Tab };
            if (!isNumeric && !isNumPadNumeric && !keysToFilter.Contains(e.Key))
            {
                e.Handled = true;
                return;
            }

            if ((e.Key == Key.Right && (sender as TextBox).CaretIndex == (sender as TextBox).Text.Length))
            {
                if (sender == Field1)
                {
                    Field2.Focus();
                }
                else if (sender == Field2)
                {
                    Field3.Focus();
                }
                else if (sender == Field3)
                {
                    Field4.Focus();
                }

                e.Handled = true;
            }
            else if (e.Key == Key.Left && (sender as TextBox).CaretIndex == 0)
            {
                if (sender == Field4)
                {
                    Field3.Focus();
                }
                else if (sender == Field3)
                {
                    Field2.Focus();
                }
                else if (sender == Field2)
                {
                    Field1.Focus();
                }

                e.Handled = true;
            }
            else if (e.Key == Key.OemMinus)
            {
                e.Handled = true;
            }
        }
Ejemplo n.º 10
0
        public override string ToString()
        {
            string content = "当前状态 : " + FaultTitle + "\r\n太阳能电压 : " + Field1.ToString("0.00") + " V\r\n超容电压 : " + Field2.ToString("0.00") + " V\r\n超容电流 : " + Field3.ToString("0.00") + " A\r\n功率 : " + Field4.ToString("0.00") + " W\r\n温度 : " + Field5.ToString("0.00") + " ℃";

            if (Field6 > 100)
            {
                content += "\r\n更新时间 : " + CreateTime;
            }
            else
            {
                content += "\r\n超容余量 : " + Field6.ToString("0.00") + " %\r\n更新时间 : " + CreateTime;
            }
            return(content);
        }
        /// <summary>
        /// Update species fact fields with latest red list values.
        /// </summary>
        protected override void SetReadListValues()
        {
            if (AllowAutomaticUpdate)
            {
                Factor factor;

                if (RedListCalculator.IsEvaluationStatusSet)
                {
                    factor = FactorManager.GetFactor((Int32)FactorId.RedListCategoryAutomatic);
                    foreach (FactorFieldEnumValue enumValue in factor.FactorDataType.Fields[0].FactorFieldEnum.Values)
                    {
                        if (enumValue.KeyInt == ((Int32)Category))
                        {
                            Field1.SetValueAutomatic(enumValue);
                            break;
                        }
                    }
                    Field2.SetValueAutomatic(RedListCalculator.IsGraded);
                    if (RedListCalculator.IsGraded &&
                        ((Category == RedListCategory.CR) ||
                         (Category == RedListCategory.EN) ||
                         (Category == RedListCategory.VU) ||
                         (Category == RedListCategory.NT) ||
                         (Category == RedListCategory.LC)) &&
                        !(((RedListCalculator.CategoryProbableNoGrading == RedListCategory.NT) ||
                           (RedListCalculator.CategoryProbableNoGrading == RedListCategory.LC)) &&
                          (RedListCalculator.CategoryProbableGraded == RedListCategory.LC) &&
                          (Category == RedListCategory.NT) &&
                          RedListCalculator.IsConservationDependent))
                    {
                        Field4.SetValueAutomatic(Category.ToString() + "°");
                    }
                    else
                    {
                        Field4.SetValueAutomatic(Category.ToString());
                    }
                }
                else
                {
                    // Reset values to nothing.
                    Field1.SetValueAutomatic(null);
                    Field2.SetValueAutomatic(null);
                    Field4.SetValueAutomatic(null);
                }
            }
        }
        private void Field_SelectionChanged(object sender, RoutedEventArgs e)
        {
            var index = Field1.SelectionStart + Field1.SelectionLength - 1;

            if (index >= 0)
            {
                var rect     = Field1.GetRectFromCharacterIndex(Field1.SelectionStart + Field1.SelectionLength - 1, false);
                var position = rect.X / Field1.ActualWidth;

                _stop = (int)(20 + (Math.Min(1, Math.Max(0, position)) * 140));
                Walkthrough.Header.Play(Walkthrough.Header.Index > _stop);
            }
            else
            {
                _stop = 0;
                Walkthrough.Header.Play(true);
            }
        }
Ejemplo n.º 13
0
        public void SetFromClone(GameState clone)
        {
            VictoryPoints         = clone.VictoryPoints;
            Money                 = clone.Money;
            NumberOfRounds        = clone.NumberOfRounds;
            ResidualMoney         = clone.ResidualMoney;
            RemainingBonusActions = clone.RemainingBonusActions;
            Round                 = clone.Round;

            Hand.SetFromClone(clone.Hand, Entities);

            VineDeck.SetFromClone(clone.VineDeck, Entities);
            OrderDeck.SetFromClone(clone.OrderDeck, Entities);
            AutomaDeck.SetFromClone(clone.AutomaDeck, Entities);
            SummerVisitorDeck.SetFromClone(clone.SummerVisitorDeck, Entities);
            WinterVisitorDeck.SetFromClone(clone.WinterVisitorDeck, Entities);

            Yoke.SetFromClone(clone.Yoke, Entities);
            Trellis.SetFromClone(clone.Trellis, Entities);
            Cottage.SetFromClone(clone.Cottage, Entities);
            Windmill.SetFromClone(clone.Windmill, Entities);
            Irigation.SetFromClone(clone.Irigation, Entities);
            LargeCellar.SetFromClone(clone.LargeCellar, Entities);
            TastingRoom.SetFromClone(clone.TastingRoom, Entities);
            MediumCellar.SetFromClone(clone.MediumCellar, Entities);

            Field1.SetFromClone(clone.Field1, Entities);
            Field2.SetFromClone(clone.Field2, Entities);
            Field3.SetFromClone(clone.Field3, Entities);

            Grande.SetFromClone(clone.Grande, Entities);
            NeutralWorker.SetFromClone(clone.NeutralWorker, Entities);

            for (var i = 0; i < 5; i++)
            {
                _workers[i].SetFromClone(clone.Workers.ElementAt(i), Entities);
            }

            for (int i = 0; i < 9; i++)
            {
                _redGrapes[i].SetFromClone(clone._redGrapes[i], Entities);
            }

            for (int i = 0; i < 9; i++)
            {
                _whiteGrapes[i].SetFromClone(clone._whiteGrapes[i], Entities);
            }

            for (int i = 0; i < 9; i++)
            {
                _redWines[i].SetFromClone(clone._redWines[i], Entities);
            }

            for (int i = 0; i < 9; i++)
            {
                _whiteWines[i].SetFromClone(clone._whiteWines[i], Entities);
            }
            for (int i = 0; i < 6; i++)
            {
                _blushWines[i].SetFromClone(clone._blushWines[i], Entities);
            }
            for (int i = 0; i < 3; i++)
            {
                _sparklingWines[i].SetFromClone(clone._sparklingWines[i], Entities);
            }
        }
Ejemplo n.º 14
0
        public async Task<IHttpActionResult> PutDirWarehouse(HttpRequestMessage request) //HttpPostedFileBase upload
        {
            #region Проверяем Логин и Пароль + Изменяем строку соединения + Права + Разные Функции

            //Получаем Куку
            System.Web.HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies["CookieIPOL"];

            // Проверяем Логин и Пароль
            field = await Task.Run(() => login.Return(authCookie, true));
            if (!field.Access) return Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg10));

            //Изменяем строку соединения
            db = new DbConnectionSklad(connectionString.Return(field.DirCustomersID, null, true));
            //dbRead = new DbConnectionSklad(connectionString.Return(field.DirCustomersID, null, true));

            //Права (1 - Write, 2 - Read, 3 - No Access)
            /*
            int iRight = await Task.Run(() => accessRight.Access(connectionString.Return(field.DirCustomersID, null, true), field.DirEmployeeID, "RightDocAccounts"));
            if (iRight == 3) return Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg57(0)));
            */
            if(field.DirEmployeeID != 1) return Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg57(0)));

            //Разные Функции
            function.NumberDecimalSeparator();

            //Получам настройки
            sysSetting = await db.SysSettings.FindAsync(1);

            //Получаем сотрудника: если к нему привязан Склад и/или Организация, то выбираем документы только по этим характеристикам
            Models.Sklad.Dir.DirEmployee dirEmployee = await db.DirEmployees.FindAsync(field.DirEmployeeID);

            #endregion

            #region Параметры

            //paramList -список параметров
            var paramList = request.GetQueryNameValuePairs();
            //Параметры
            sheetName = paramList.FirstOrDefault(kv => string.Compare(kv.Key, "sheetName", true) == 0).Value;
            DirContractorIDOrg = Convert.ToInt32(paramList.FirstOrDefault(kv => string.Compare(kv.Key, "DirContractorIDOrg", true) == 0).Value);
            DirContractorID = Convert.ToInt32(paramList.FirstOrDefault(kv => string.Compare(kv.Key, "DirContractorID", true) == 0).Value);
            DirWarehouseID = Convert.ToInt32(paramList.FirstOrDefault(kv => string.Compare(kv.Key, "DirWarehouseID", true) == 0).Value);

            #endregion


            #region Сохранение

            OleDbConnection OleDbConn = null;
            try
            {
                //Алгоритм:
                //0. Проверка
                //1. Генерируем ID-шник "SysGens"
                //2. Получаем файл и сохраняем в папаке "Uploads" с именем: authCookie["CookieB"] + "_" + sysGen.SysGenID

                //3. Считываем Эксель файл
                //   [Код товара], [Категория], [Товар]

                //Получаем категорию "APPLE/ iPhone 4S/  Распродажа/  Распродажа Swarovski /"
                //Разделитель "/" и убираем первый пробел
                //Проверяем каждую получиную категорию: есть ли связка (Sub, Name)
                //Если нет - вносим категорию, а потом товар: ([Код товара], [Товар])
                //Если есть - вносим товар: ([Код товара], [Товар])


                // *** Важно *** *** ***
                //1.Находим максимальный код группы
                //2.Создаём коды групп (Макс + 1)
                //3.Создаём коды товаров(из Эксель)



                #region 0. Проверка *** *** *** *** *** *** ***

                if (!Request.Content.IsMimeMultipartContent()) Ok(returnServer.Return(false, "{" + "'msgType':'1', 'msg':'" + Classes.Language.Sklad.Language.msg57(0) + "'}"));

                #endregion


                #region 1. Генерируем ID-шник "SysGens" *** *** *** *** *** *** ***

                Models.Sklad.Sys.SysGen sysGen = new Models.Sklad.Sys.SysGen(); sysGen.SysGenDisc = ""; sysGen.SysGenID = null;
                //if (!ModelState.IsValid) return Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg91)); //return BadRequest(ModelState);
                db.Entry(sysGen).State = EntityState.Added;
                await db.SaveChangesAsync();

                #endregion


                #region 2. Получаем файл и сохраняем в папаке "Uploads" с именем: authCookie["CookieB"] + "_" + sysGen.SysGenID *** *** *** *** *** *** *** 

                string filePatch = "";
                var provider = new MultipartMemoryStreamProvider();
                string root = System.Web.HttpContext.Current.Server.MapPath("~/UsersTemp/FileStock/");
                await Request.Content.ReadAsMultipartAsync(provider);
                foreach (var file in provider.Contents)
                {
                    if (file.Headers.ContentDisposition.FileName != null)
                    {
                        var filename = file.Headers.ContentDisposition.FileName.Trim('\"');
                        var ext = Path.GetExtension(filename);
                        filePatch = root + field.DirCustomersID + "_" + sysGen.SysGenID + ext;

                        byte[] fileArray = await file.ReadAsByteArrayAsync();

                        using (System.IO.FileStream fs = new System.IO.FileStream(filePatch, System.IO.FileMode.Create)) //root + filename
                        {
                            await fs.WriteAsync(fileArray, 0, fileArray.Length);
                        }
                    }
                }

                #endregion


                #region 3. Получаем максимальный код группы

                var queryMaxGroupID = await Task.Run(() =>
                    (
                        from x in db.DirNomens
                        where x.DirNomenCategoryID == null
                        select x
                    ).MaxAsync(x => x.DirNomenID));

                iMaxGroupID = queryMaxGroupID + 1;
                if (iMaxGroupID == null || iMaxGroupID == 0) iMaxGroupID = 1;

                #endregion


                #region 4. Считываем Эксель файл

                if (filePatch.Length > 0)
                {
                    //1. Получаем категорию "APPLE/ iPhone 4S/  Распродажа/  Распродажа Swarovski /"
                    //2. Разделитель "/" и убираем первый пробел
                    //3. Проверяем каждую получиную категорию: есть ли связка (Sub, Name)
                    //4. Если нет - вносим категорию, а потом товар: ([Код товара], [Товар])
                    //5. Если есть - вносим товар: ([Код товара], [Товар])

                    string sExcelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePatch + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1;\""; //8.0
                    using (OleDbConn = new OleDbConnection(sExcelConnectionString))
                    {
                        OleDbConn.Open();

                        using (OleDbCommand OleDbCmd = new OleDbCommand("", OleDbConn))
                        {
                            #region 1. Таблица "Товар"

                            OleDbCmd.CommandText = "SELECT * FROM [" + sheetName + "$]";
                            OleDbCmd.Parameters.Clear();
                            using (OleDbDataReader dr = OleDbCmd.ExecuteReader())
                            {
                                using (System.Data.Entity.DbContextTransaction ts = db.Database.BeginTransaction())
                                {
                                    while (dr.Read())
                                    {
                                        if (dr["Код товара"].ToString().Length == 5)
                                        {
                                            //Read
                                            string DirNomenID = dr["Код товара"].ToString();
                                            string GroupList = dr["Категория"].ToString();
                                            string DirNomenName = dr["Товар"].ToString();

                                            //Create Group in database
                                            await Task.Run(() => GroupCreate(Convert.ToInt32(DirNomenID), GroupList, DirNomenName));
                                        }
                                        else
                                        {
                                            alCodeNot.Add(dr["Код товара"].ToString() + "  -  " + dr["Категория"].ToString() + "  -  " + dr["Товар"].ToString());

                                            //...
                                        }
                                    }

                                    ts.Commit();
                                }
                            }

                            #endregion


                            #region 2. Таблицы: Характеристики, Приходная накладная (Шапка + Спецификация), Остатки, Партии. (Новый алгоритм алгоритм: одна приходная накладная)



                            //1. Надо получить все точки из Эксель (GROUP BY)
                            //2. И делать SELECT по точкам, что бы сформировать приходные накладные по точкам
                            OleDbCmd.CommandText = "SELECT [Точка] FROM [" + sheetName + "$] GROUP BY [Точка] ORDER BY [Точка]";
                            OleDbCmd.Parameters.Clear();
                            ArrayList alDirWarehouseID = new ArrayList();
                            using (OleDbDataReader dr = OleDbCmd.ExecuteReader())
                            {
                                while (dr.Read())
                                {
                                    alDirWarehouseID.Add(dr["Точка"].ToString());
                                }
                            }



                            //Формируем "Приходные накладные"
                            using (System.Data.Entity.DbContextTransaction ts = db.Database.BeginTransaction())
                            {
                                for (int i = 0; i < alDirWarehouseID.Count; i++)
                                {
                                    Models.Sklad.Doc.DocPurch docPurch = new Models.Sklad.Doc.DocPurch();


                                    ArrayList alWrite = new ArrayList();
                                    //OleDbCmd.CommandText = "SELECT * FROM [" + sheetName + "$] WHERE Дата=@pDate";
                                    OleDbCmd.CommandText = "SELECT * FROM [" + sheetName + "$] WHERE Точка=@Точка"; // ORDER BY [Код товара], [Дата] DESC
                                    OleDbCmd.Parameters.Clear();
                                    OleDbCmd.Parameters.AddWithValue("@Точка", alDirWarehouseID[i].ToString());

                                    using (OleDbDataReader dr = OleDbCmd.ExecuteReader())
                                    {
                                        while (dr.Read())
                                        {
                                            if (dr["Код товара"].ToString().Length == 5)
                                            {
                                                Field1 field1 = new Field1();
                                                field1.DirNomenID = Convert.ToInt32(dr["Код товара"].ToString());
                                                field1.DocDate = dr["Дата"].ToString();
                                                //field1.DirWarehouseID = ReturnDirWarehouseID(dr["Точка"].ToString());
                                                field1.DirWarehouseID = await Task.Run(() => ReturnDirWarehouseID(dr["Точка"].ToString()));
                                                field1.Quantity = Convert.ToInt32(dr["Остаток"].ToString());

                                                field1.PriceVAT = Convert.ToDouble(dr["Закуп цена за ед"].ToString());
                                                field1.PriceCurrency = Convert.ToDouble(dr["Закуп цена за ед"].ToString());

                                                field1.PriceRetailVAT = Convert.ToDouble(dr["Цена-1"].ToString());
                                                field1.PriceRetailCurrency = Convert.ToDouble(dr["Цена-1"].ToString());

                                                field1.PriceWholesaleVAT = Convert.ToDouble(dr["Цена-2"].ToString());
                                                field1.PriceWholesaleCurrency = Convert.ToDouble(dr["Цена-2"].ToString());

                                                field1.PriceIMVAT = Convert.ToDouble(dr["Цена-3"].ToString());
                                                field1.PriceIMCurrency = Convert.ToDouble(dr["Цена-3"].ToString());

                                                field1.DirCharColourID = ReturnDirCharColourID(dr["Поставщик"].ToString());
                                                field1.DirCharTextureID = ReturnDirCharTextureID(dr["Примечание"].ToString());

                                                alWrite.Add(field1);
                                            }
                                            else
                                            {
                                                //alCodeNot.Add(dr["Код товара"].ToString() + "  -  " + dr["Категория"].ToString() + "  -  " + dr["Товар"].ToString());

                                                //...
                                            }
                                        }
                                    }


                                    //Create Purchase documents and Remnants of goods in stock
                                    docPurch = await Task.Run(() => DocsCreate(alWrite));


                                    #region Чистим пустые партии товара, но только соотвутствующие Номеру документа, что бы НЕ удалить все пустые (0, 0)

                                    SQLiteParameter parDocID = new SQLiteParameter("@DocID", System.Data.DbType.Int32) { Value = docPurch.DocID };
                                    await db.Database.ExecuteSqlCommandAsync("DELETE FROM RemParties WHERE DocID=@DocID and Remnant=0; ", parDocID);

                                    #endregion

                                }


                                ts.Commit();
                            }

                            #endregion
                        }

                        OleDbConn.Close();
                    }

                }

                #endregion


                #region 5. Send

                dynamic collectionWrapper = new
                {
                    Msg = "Файл загружен!"
                };
                return Ok(returnServer.Return(true, collectionWrapper));

                #endregion

            }
            catch (Exception ex)
            {
                try { OleDbConn.Close(); OleDbConn.Dispose(); } catch { }
                return Ok(returnServer.Return(false, exceptionEntry.Return(ex) + i777.ToString()));
            }

            #endregion
        }
Ejemplo n.º 15
0
        //Create Purchase documents and Remnants of goods in stock
        private async Task<DocPurch> DocsCreate(ArrayList alWrite)
        {
            if (alWrite.Count == 0) return null;


            db.Configuration.AutoDetectChangesEnabled = false;

            //Во всех записях есть данные для Doc, DocPurch и DocPurchTab
            Field1 field10 = (Field1)alWrite[0];


            #region Таблица Doc *** *** ***

            Models.Sklad.Doc.DocPurch docPurch = new Models.Sklad.Doc.DocPurch();
            docPurch.DocID = null;
            docPurch.Base = "Создано на основании импорта из файла Excel";
            docPurch.Del = false;
            docPurch.DirEmployeeID = field.DirEmployeeID;
            docPurch.Discount = 0;
            docPurch.DocDate = DateTime.Now.AddDays(-30); //Convert.ToDateTime(field10.DocDate);
            docPurch.DocIDBase = null;
            docPurch.Held = true;
            docPurch.IsImport = true;
            docPurch.ListObjectID = 1;

            #endregion


            #region Таблица DocPurch *** *** ***

            docPurch.DocPurchID = null;
            docPurch.NumberInt = "";
            docPurch.NumberTT = "";
            docPurch.NumberTax = "";
            docPurch.DirContractorIDOrg = DirContractorIDOrg;
            docPurch.DirContractorID = DirContractorID;
            docPurch.DirWarehouseID = field10.DirWarehouseID;
            docPurch.DirVatValue = 0;
            docPurch.DirPaymentTypeID = 1;

            #endregion


            #region Таблица DocPurchTab *** *** ***

            //Создаём коллекцию спецификации
            Models.Sklad.Doc.DocPurchTab[] docPurchTabCollection = new Models.Sklad.Doc.DocPurchTab[alWrite.Count];
            for (int i = 0; i < alWrite.Count; i++)
            {
                Field1 field1 = (Field1)alWrite[i];

                Models.Sklad.Doc.DocPurchTab docPurchTab = new Models.Sklad.Doc.DocPurchTab();
                docPurchTab.DocPurchID = 0;
                docPurchTab.DocPurchTabID = null;

                docPurchTab.DirNomenID = ReturnDirNomenID(Convert.ToInt32(field1.DirNomenID));
                docPurchTab.DirCurrencyID = 1;
                docPurchTab.DirCurrencyMultiplicity = 1;
                docPurchTab.DirCurrencyRate = 1;
                //docPurchTab.DirVatValue = 0;

                if (field1.DirCharColourID > 0) docPurchTab.DirCharColourID = field1.DirCharColourID;
                if (field1.DirCharTextureID > 0) docPurchTab.DirCharTextureID = field1.DirCharTextureID;
                if (field1.DirCharSizeID > 0) docPurchTab.DirCharSizeID = field1.DirCharSizeID;

                docPurchTab.Quantity = field1.Quantity; //field1.Quantity;

                docPurchTab.PriceVAT = field1.PriceVAT;
                docPurchTab.PriceCurrency = field1.PriceVAT;

                docPurchTab.PriceRetailVAT = field1.PriceRetailVAT;
                docPurchTab.PriceRetailCurrency = field1.PriceRetailCurrency;

                docPurchTab.PriceWholesaleVAT = field1.PriceWholesaleVAT;
                docPurchTab.PriceWholesaleCurrency = field1.PriceWholesaleCurrency;

                docPurchTab.PriceIMVAT = field1.PriceIMVAT;
                docPurchTab.PriceIMCurrency = field1.PriceIMCurrency;

                docPurchTabCollection[i] = docPurchTab;
            }

            #endregion


            #region Save

            Doc.DocPurches.DocPurchesController docPurchesController = new Doc.DocPurches.DocPurchesController();
            docPurch = await Task.Run(() => docPurchesController.mPutPostDocPurch(db, db, "held", sysSetting, docPurch, EntityState.Added, docPurchTabCollection, field)); //await Task.Run(() => docPurchesController.mPutPostDocPurch(db, dbRead, "held", sysSetting, docPurch, EntityState.Added, docPurchTabCollection, field));

            #endregion


            return docPurch;
        }
Ejemplo n.º 16
0
 public override string ToString()
 {
     return(Field1.ToLower() + Field2.ToString() + Field3.ToString());
 }
Ejemplo n.º 17
0
            public override int GetHashCode()
            {
                int result = string.IsNullOrEmpty(Field1) ? 0 : Field1.GetHashCode() + Field2.GetHashCode();

                return(result);
            }
Ejemplo n.º 18
0
        public GameState Clone()
        {
            var gameState = new GameState();

            gameState.VictoryPoints         = VictoryPoints;
            gameState.Money                 = Money;
            gameState.NumberOfRounds        = NumberOfRounds;
            gameState.ResidualMoney         = ResidualMoney;
            gameState.RemainingBonusActions = RemainingBonusActions;
            gameState.Round                 = Round;

            gameState.Hand = Hand.Clone() as Hand;

            gameState.VineDeck          = VineDeck.Clone();
            gameState.OrderDeck         = OrderDeck.Clone();
            gameState.AutomaDeck        = AutomaDeck.Clone();
            gameState.SummerVisitorDeck = SummerVisitorDeck.Clone();
            gameState.WinterVisitorDeck = WinterVisitorDeck.Clone();

            gameState.Yoke         = Yoke.Clone() as Yoke;
            gameState.Trellis      = Trellis.Clone() as Trellis;
            gameState.Cottage      = Cottage.Clone() as Cottage;
            gameState.Windmill     = Windmill.Clone() as Windmill;
            gameState.Irigation    = Irigation.Clone() as Irigation;
            gameState.LargeCellar  = LargeCellar.Clone() as LargeCellar;
            gameState.TastingRoom  = TastingRoom.Clone() as TastingRoom;
            gameState.MediumCellar = MediumCellar.Clone() as MediumCellar;

            gameState.Field1 = Field1.Clone() as Field;
            gameState.Field2 = Field2.Clone() as Field;
            gameState.Field3 = Field3.Clone() as Field;

            gameState.Grande        = Grande.Clone() as Grande;
            gameState.NeutralWorker = NeutralWorker.Clone() as Worker;

            gameState._workers = new List <Worker>();
            for (var i = 0; i < 5; i++)
            {
                gameState._workers.Add(_workers[i].Clone() as Worker);
            }

            gameState._redGrapes = new List <Grape>();
            foreach (var redGrape in _redGrapes)
            {
                gameState._redGrapes.Add(redGrape.Clone() as Grape);
            }

            gameState._whiteGrapes = new List <Grape>();
            foreach (var whiteGrape in _whiteGrapes)
            {
                gameState._whiteGrapes.Add(whiteGrape.Clone() as Grape);
            }

            gameState._redWines = new List <Wine>();
            foreach (var redWine in _redWines)
            {
                gameState._redWines.Add(redWine.Clone() as Wine);
            }

            gameState._whiteWines = new List <Wine>();
            foreach (var whiteWine in _whiteWines)
            {
                gameState._whiteWines.Add(whiteWine.Clone() as Wine);
            }

            gameState._blushWines = new List <Wine>();
            foreach (var blushWine in _blushWines)
            {
                gameState._blushWines.Add(blushWine.Clone() as Wine);
            }

            gameState._sparklingWines = new List <Wine>();
            foreach (var sparklingWine in _sparklingWines)
            {
                gameState._sparklingWines.Add(sparklingWine.Clone() as Wine);
            }

            return(gameState);
        }
Ejemplo n.º 19
0
        void ReleaseDesignerOutlets()
        {
            if (Field0 != null)
            {
                Field0.Dispose();
                Field0 = null;
            }

            if (Field1 != null)
            {
                Field1.Dispose();
                Field1 = null;
            }

            if (Field2 != null)
            {
                Field2.Dispose();
                Field2 = null;
            }

            if (Field3 != null)
            {
                Field3.Dispose();
                Field3 = null;
            }

            if (Field4 != null)
            {
                Field4.Dispose();
                Field4 = null;
            }

            if (Label0 != null)
            {
                Label0.Dispose();
                Label0 = null;
            }

            if (Label1 != null)
            {
                Label1.Dispose();
                Label1 = null;
            }

            if (Label2 != null)
            {
                Label2.Dispose();
                Label2 = null;
            }

            if (Label3 != null)
            {
                Label3.Dispose();
                Label3 = null;
            }

            if (Label4 != null)
            {
                Label4.Dispose();
                Label4 = null;
            }
        }