public override void DeleteECRReceipts(DataQuery dataQuery)
        {
            LazyListModel <int> model = ExecuteDataQuery <int> (
                dataQuery, string.Format("SELECT ID AS {0} FROM ecrreceipts", fieldsTable.GetFieldAlias(DataField.ECRReceiptID)));

            if (model.Count > 0)
            {
                ExecuteNonQuery(string.Format(
                                    "DELETE FROM ecrreceipts WHERE ID IN ({0})",
                                    string.Join(", ", model.Select(i => i.ToString(CultureInfo.InvariantCulture)))));
            }
        }
예제 #2
0
        private void InitializeEntries()
        {
            LazyListModel <MesUnit> units = MesUnit.GetAll();

            if (item == null)
            {
                item = new Item();

                if (defaultGroupId.HasValue)
                {
                    gEditPanel.SelectGroupId((int)defaultGroupId);
                }

                if (BusinessDomain.AppConfiguration.AutoGenerateItemCodes)
                {
                    item.AutoGenerateCode();
                }
            }
            else
            {
                gEditPanel.SelectGroupId(item.GroupId);
            }

            txtCode.Text               = item.Code;
            txtName.Text               = item.Name;
            txtDisplayName.Text        = item.Name2;
            txtCatalogNumber1.Text     = item.Catalog;
            txtCatalogNumber2.Text     = item.Catalog2;
            txtCatalogNumber3.Text     = item.Catalog3;
            txvDescription.Buffer.Text = item.Description;

            txtBarCode1.Text = item.BarCode;
            txtBarCode2.Text = item.BarCode2;

            barcodes.Clear();
            if (!string.IsNullOrWhiteSpace(item.BarCode3))
            {
                foreach (string barcode in item.BarCode3.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    barcodes.Add(barcode);
                }
            }

            if (barcodes.Count == 0)
            {
                barcodes.Add(string.Empty);
            }

            List <KeyValuePair <object, string> > barCodeTypes = Enum.GetValues(typeof(GeneratedBarcodeType))
                                                                 .Cast <object> ()
                                                                 .Select(value => new KeyValuePair <object, string> (value, value.ToString()))
                                                                 .OrderBy(p => p.Value).ToList();

            cboBarcodeType.Load(barCodeTypes, "Key", "Value", BusinessDomain.AppConfiguration.CustomGeneratedBarcodeType);
            txtBarcodeFormat.Text = BusinessDomain.AppConfiguration.CustomGeneratedBarcodeFormat;

            List <MesUnit> validUnits = units.Where(u => !string.IsNullOrWhiteSpace(u.Name)).ToList();

            cbeMesUnit.Load(validUnits, "Name", "Name");
            if (!string.IsNullOrWhiteSpace(item.MUnit))
            {
                cbeMesUnit.Entry.Text = item.MUnit;
            }
            txtMesRatio.Text = Number.ToEditString(item.MUnitRatio);
            cbeMesUnit2.Load(validUnits, "Name", "Name");
            if (!string.IsNullOrWhiteSpace(item.MUnit))
            {
                cbeMesUnit2.Entry.Text = item.MUnit2;
            }
            txtMinimalQty.Text = Quantity.ToEditString(item.MinimalQuantity);
            txtNominalQty.Text = Quantity.ToEditString(item.NominalQuantity);

            LazyListModel <VATGroup>            allGroups = VATGroup.GetAll();
            List <KeyValuePair <long, string> > vatList   = new List <KeyValuePair <long, string> > (allGroups
                                                                                                     .Select(vatGroup => new KeyValuePair <long, string> (vatGroup.Id,
                                                                                                                                                          string.Format("{0} ({1})", vatGroup.Name, Percent.ToString(vatGroup.VatValue)))));

            cboVATGroup.Load(vatList, "Key", "Value", item.VatGroupId);

            SetPrices(item);
        }