コード例 #1
0
ファイル: Table.cs プロジェクト: curiousTauseef/warehouse-2
        protected override void OnBeforeAllocateSize()
        {
            if (string.IsNullOrEmpty(sourceTable))
            {
                foreach (FormDrawableContainer row in Children)
                {
                    while (row.Children.Count > columns.Count)
                    {
                        TableColumn column = new TableColumn();
                        column.HeaderTemplate.Add(DocumentHelper.FormObjectCreator.CreateTextBox());
                        column.ItemTemplate.Add(DocumentHelper.FormObjectCreator.CreateTextBox());
                        column.FooterTemplate.Add(DocumentHelper.FormObjectCreator.CreateTextBox());
                        columns.Add(column);
                    }
                }

                foreach (TableRow row in Children)
                {
                    while (columns.Count > row.Children.Count)
                    {
                        row.CreateCell(columns [row.Children.Count], bindableFields, false);
                    }
                }
            }

            foreach (TableRow row in Children)
            {
                row.MinimalSize.LoadFromStyle(row.Style);

                foreach (TableCell cell in row.Children)
                {
                    cell.MinimalSize.LoadFromStyle(cell.Style);
                }
            }
        }
コード例 #2
0
        private void ItemColumnChoose(string filter)
        {
            using (ChooseEditItem dialog = new ChooseEditItem(true, filter)) {
                if (dialog.Run() != ResponseType.Ok)
                {
                    EditGridCell(grid.EditedCell.Row, 0);
                    return;
                }

                for (int i = selectedDetails.Count - 1; i >= 0; i--)
                {
                    if (selectedDetails [i].ItemId == -1)
                    {
                        selectedDetails.RemoveAt(i);
                    }
                }

                foreach (Item item in dialog.SelectedItems)
                {
                    OperationDetail saleDetail;
                    if (grid.EditedCell.Row >= selectedDetails.Count)
                    {
                        saleDetail = new SaleDetail();
                        selectedDetails.Add((SaleDetail)saleDetail);
                    }
                    else
                    {
                        saleDetail = selectedDetails [grid.EditedCell.Row];
                    }
                    saleDetail.ItemEvaluate(item, PriceGroup.RegularPrice);
                }
            }

            EditGridCell(grid.EditedCell.Row, 1);
        }
コード例 #3
0
ファイル: Window.cs プロジェクト: cpdean/di
 public Window(Main _controller, Model.Buffer _model)
 {
     Controller = _controller;
     Model = new Bind<Model.Buffer>(_model);
     CurrentMode = new BindList<WindowMode>();
     CurrentMode.Event.Changed += (list) => { CurrentKeyMap = list.FoldLeft(EmptyKeyMap, (a, b) => a + b.KeyMap); };
     CurrentMode.Add(Controller.WindowModes[0]);
     CurrentMode.Add(Controller.WindowModes[2]);
     CurrentMode.Add(Controller.WindowModes[3]);
     Parser = new CommandParser();
 }
コード例 #4
0
        protected override void InitializeFormStrings()
        {
            base.InitializeFormStrings();

            btnOK.SetChildLabelText(Translator.GetString("OK"));
            btnCancel.SetChildLabelText(Translator.GetString("Cancel"));

            chkUseAdvances.Label = Translator.GetString("Use Advance Payments");
            lblDueDate.SetText(string.Format("{0}:", Translator.GetString("Due Date")));
            lblRemainingDays.SetText(string.Format("{0}:", Translator.GetString("Remaining Days")));
            lblTotal.SetText(Translator.GetString("Total"));
            lblChange.SetText(Translator.GetString("Change"));
            dlgEditNewPayment.Title = Translator.GetString("Payment");

            lblTotalValue.SetText(Currency.ToString(total, operation.TotalsPriceType));

            paymentWidget.SetSelectedPaymentType(paymentType);

            double remainder = total;

            IList <Payment> oprPayments = Payment.GetForOperation(operation, PaymentMode.Paid);

            if (oprPayments.Count > 0)
            {
                foreach (Payment payment in oprPayments)
                {
                    Payment currentPayment = payment;
                    if (operation.Payments.Find(p => p.Id == currentPayment.Id) == null)
                    {
                        operation.Payments.Add(payment);
                    }

                    currentPayment.ParentOperation = operation;
                    payments.Add((Payment)currentPayment.Clone());
                }
                paymentWidget.Received = 0;
            }
            else
            {
                paymentWidget.Received = remainder;
            }

            RecalculateChange(paymentWidget.Received);

            chkPrintCashReceipt.Label = Translator.GetString("Print cash receipt");
            chkChangeIsReturned.Label = Translator.GetString("Change is returned");
            chkPrintDocument.Label    = Translator.GetString("Print payment document");
        }
コード例 #5
0
        public ComplexRecipe(ComplexProduction production)
            : this()
        {
            locationId      = production.LocationId;
            location        = production.Location;
            location2       = production.Location2;
            partnerId       = production.PartnerId;
            partnerName     = production.PartnerName;
            partnerName2    = production.PartnerName2;
            userId          = production.UserId;
            userName        = production.UserName;
            userName2       = production.UserName2;
            loggedUserId    = production.LoggedUserId;
            loggedUserName  = production.LoggedUserName;
            loggedUserName2 = production.LoggedUserName2;

            foreach (ComplexProductionDetail detail in production.DetailsMat)
            {
                detailsMat.Add(new ComplexRecipeDetail(detail));
            }

            detailsMat = GetCombinedDetails(false, true, detailsMat);

            foreach (ComplexProductionDetail detail in production.DetailsProd)
            {
                detailsProd.Add(new ComplexRecipeDetail(detail));
            }

            detailsProd = GetCombinedDetails(false, true, detailsProd);
        }
コード例 #6
0
        /// <summary>
        /// 为DataGridView添加行
        /// 仅仅适用DataGridCRUDHelper类下操作
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <param name="model">是否添加成功</param>
        /// <returns>操作是否成功</returns>
        public static bool AddObject <T>(this DataGridView gridView, T model)
            where T : class
        {
            bool _result = true;

            try
            {
                BindList <T> _bindList = gridView.ToBindList <T>();

                if (_bindList == null)
                {
                    _bindList = new BindList <T>();
                    _bindList.Add(model);
                    SetDataSource <T>(gridView, _bindList);
                }
                else
                {
                    _bindList.Add(model);
                }
            }
            catch (Exception)
            {
                _result = false;
            }

            return(_result);
        }
コード例 #7
0
        private void AddItemShortcut(IntPtr data, string accelPath, uint accelKey, ModifierType accelMods, bool changed)
        {
            long itemId;

            if (IsKeyForItem(accelPath, out itemId) && accelKey != 0 && accelKey != (uint)Key.VoidSymbol)
            {
                ItemShortcut itemShortcut = new ItemShortcut();
                if (!itemShortcut.ItemEvaluate(Item.GetById(itemId), PriceGroup.RegularPrice))
                {
                    return;
                }

                itemShortcut.Shortcut = new AccelKey((Key)accelKey, KeyShortcuts.GetAllowedModifier(accelMods), AccelFlags.Visible);
                itemShortcuts.Add(itemShortcut);
            }
        }
コード例 #8
0
        protected void LoadOperationDetailInfo(IEnumerable <OperationDetail> operationDetails)
        {
            int i = 1;

            foreach (OperationDetail detail in operationDetails)
            {
                Item item = Item.GetById(detail.ItemId);

                details.Add(new TDetail
                {
                    Number         = i.ToString(CultureInfo.InvariantCulture),
                    DetailId       = detail.DetailId,
                    ItemId         = item.Id,
                    ItemCode       = item.Code,
                    ItemName       = item.Name2,
                    MUnitName      = detail.MUnitName,
                    Quantity       = detail.Quantity,
                    LotId          = detail.LotId,
                    Lot            = detail.Lot,
                    SerialNumber   = detail.SerialNumber,
                    ExpirationDate = detail.ExpirationDate,
                    ProductionDate = detail.ProductionDate,
                    LotLocation    = detail.LotLocation,
                    PriceIn        = detail.PriceInDB,
                    VATIn          = detail.VATIn,
                    PriceOut       = detail.PriceOutDB,
                    VATOut         = detail.VATOut,
                    Discount       = detail.Discount,
                    DiscountValue  = detail.DiscountValue,
                    Total          = detail.Total
                });

                i++;
            }
        }
コード例 #9
0
        public ChooseItemsForPromotion(IEnumerable promotions)
        {
            selectedDetails = new BindList <SaleDetail> ();
            if (promotions != null)
            {
                foreach (SaleDetail promotion in promotions)
                {
                    selectedDetails.Add(promotion);
                }
            }
            else
            {
                selectedDetails.Add(new SaleDetail());
            }

            Initialize();
        }
コード例 #10
0
        private Payment AddPayment(double amountReceived)
        {
            Payment payment = new Payment
            {
                Quantity    = amountReceived,
                Sign        = alwaysReceive ? 1 : Math.Sign(debt),
                Mode        = PaymentMode.Paid,
                PartnerId   = partner.Id,
                PartnerName = partner.Name,
                TypeId      = paymentWidget.GetPaymentTypeId()
            };

            payments.Add(payment);
            paymentWidget.RefreshGrid();

            return(payment);
        }
コード例 #11
0
        public void getReportInfoByTm()
        {
            bool isY = false;

            for (int i = 0; i < BindList.Count; i++)
            {
                if (SMtextBox.Text.Trim().ToUpper() == BindList[i].TM)
                {
                    isY = true;
                }
            }
            if (isY)
            {
                ShowMeg(string.Format(q(Msg_Type.msgtmcf), SMtextBox.Text.Trim()));//
                SMtextBox.Clear();
                SMtextBox.Select();
                return;
            }


            MES_WLKCBS_GETWLZJ_IN model = new MES_WLKCBS_GETWLZJ_IN();

            model.MBLNR   = ZSL_BCS303_BS.MBLNR;
            model.XCBS    = ZSL_BCS303_BS.XCBS;
            model.MJAHR   = ZSL_BCS303_BS.MJAHR;
            model.LINE_ID = ZSL_BCS303_BS.LINE_ID;
            model.LIFNR   = ZSL_BCS303_BS.LIFNR;
            model.TM      = SMtextBox.Text.Trim().ToUpper();
            SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT_WLKCBS(model, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                for (int i = 0; i < res.MES_TM_TMINFO_LIST.Length; i++)
                {
                    BindList.Add(res.MES_TM_TMINFO_LIST[i]);
                }
                for (int i = 0; i < BindList.Count; i++)
                {
                    BindList[i].XH   = i + 1;
                    BindList[i].WLMS = BindList[i].WLH + "/" + BindList[i].WLMS;
                }
                dataGridView2.DataSource = new List <MES_TM_TMINFO_LIST>();
                dataGridView2.DataSource = BindList;
                dataGridView2.ClearSelection();
                Verify();
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
            SMtextBox.Clear();
            SMtextBox.Select();
        }
コード例 #12
0
        protected static void CreateChild(Hashtable boundFields, BindList <FormObject> children, XElement child)
        {
            FormObject childObj;

            switch (child.Name.LocalName.ToLowerInvariant())
            {
            case "hbox":
                childObj = DocumentHelper.FormObjectCreator.CreateHBox(child, boundFields);
                break;

            case "vbox":
                childObj = DocumentHelper.FormObjectCreator.CreateVBox(child, boundFields);
                break;

            case "textbox":
                childObj = DocumentHelper.FormObjectCreator.CreateTextBox(child, boundFields);
                break;

            case "picture":
                childObj = DocumentHelper.FormObjectCreator.CreatePicture(child, boundFields);
                break;

            case "rectangle":
                childObj = new Rectangle(child, boundFields);
                break;

            case "hline":
                childObj = DocumentHelper.FormObjectCreator.CreateHLine(child);
                break;

            case "vline":
                childObj = DocumentHelper.FormObjectCreator.CreateVLine(child);
                break;

            case "table":
                childObj = DocumentHelper.FormObjectCreator.CreateTable(child, boundFields);
                break;

            case "boxitem":
                childObj = DocumentHelper.FormObjectCreator.CreateBox(child, boundFields);
                break;

            case "barcode":
                childObj = DocumentHelper.FormObjectCreator.CreateLinearBarcode(child, boundFields);
                break;

            default:
                return;
            }

            children.Add(childObj);
        }
コード例 #13
0
 public EditQuickItems(MenuItemCollection mainMenu, AccelGroup accelGroup)
 {
     this.mainMenu   = mainMenu;
     this.accelGroup = accelGroup;
     itemShortcuts   = new BindList <ItemShortcut> ();
     changedMenus    = new List <string> ();
     AccelMap.Foreach(IntPtr.Zero, AddItemShortcut);
     if (itemShortcuts.Count == 0)
     {
         itemShortcuts.Add(new ItemShortcut());
     }
     Initialize();
 }
コード例 #14
0
        public TableColumn(string columnName, string caption)
        {
            const string styleString = "padding:4;halign:left;valign:center;width:10%;vfill:true;hfill:true;allowhbreak:false;allowvbreak:false;";

            SetDefaultStyle(styleString);

            TextBox headerTextBox = DocumentHelper.FormObjectCreator.CreateTextBox();

            headerTextBox.Text = caption;
            headerTemplate.Add(headerTextBox);
            headerStyle = new ObjectStyle(styleString);

            TextBox itemTextBox = DocumentHelper.FormObjectCreator.CreateTextBox();

            itemTextBox.SourceField = columnName;
            itemTemplate.Add(itemTextBox);
            itemStyle = new ObjectStyle(styleString);

            TextBox footerTextBox = DocumentHelper.FormObjectCreator.CreateTextBox();

            footerTextBox.Text = caption;
            footerTemplate.Add(footerTextBox);
            footerStyle = new ObjectStyle(styleString);
        }
コード例 #15
0
        private void AddMoney(double amount, int quantity, bool refreshGrid = true)
        {
            MoneyContainer mc = list.Find(m => m.Amount.IsEqualTo(amount));

            if (mc != null)
            {
                mc.Quantity += quantity;
            }
            else
            {
                list.Add(new MoneyContainer(amount, quantity));
            }

            if (refreshGrid)
            {
                RefreshGrid();
            }
        }
コード例 #16
0
ファイル: Main.cs プロジェクト: cpdean/di
        public Main(DirectoryInfo _dir)
        {
            while (!DirIsProjectRoot(_dir))
            {
                _dir = _dir.Parent;
                if (_dir == null)
                {
                    // TODO
                    // Create an exception class to throw here.
                    // It'll get caught somewhere and result in a special interaction with the user
                    // to determine which directory to create the project file in.
                    throw new InvalidOperationException();
                }
            }
            Root = _dir;
            Ini.IniParser.Parse(Path.Combine(Root.FullName, ConfigFileName), ref config);
            var m = new FileMatcher();
            m.ExcludeExecutableFiles = config[""].GetBoolWithDefault("exclude-exec", true);
            if (config.ContainsKey("include"))
            {
                foreach (var i in config["include"].Keys)
                {
                    m.IncludeGlob(i);
                }
            }
            if (config.ContainsKey("exclude"))
            {
                foreach (var e in config["exclude"].Keys)
                {
                    m.ExcludeGlob(e);
                }
            }
            files = m.MatchAll(Root).Select(f => new File(this, f)).ToList();
            Files = new ReadOnlyCollection<File>(files);

            buffers = new BindList<Buffer>();
            buffers.Add(new Buffer());
            Buffers = new ReadOnlyCollection<Buffer>(buffers);
        }
コード例 #17
0
ファイル: Table.cs プロジェクト: curiousTauseef/warehouse-2
        public override void CreateFromTemplate(XElement node, Hashtable boundFields)
        {
            XAttribute tempAttr = node.Attribute("sourceTable");

            if (tempAttr != null)
            {
                sourceTable = tempAttr.Value;
            }

            base.CreateFromTemplate(node, boundFields);

            tempAttr = node.Attribute("headerStyle");
            if (tempAttr != null)
            {
                headerStyle.LoadFromString(tempAttr.Value);
            }

            tempAttr = node.Attribute("itemStyle");
            if (tempAttr != null)
            {
                ItemStyle.LoadFromString(tempAttr.Value);
            }

            tempAttr = node.Attribute("hasHeader");
            if (tempAttr != null)
            {
                bool.TryParse(tempAttr.Value, out hasHeader);
            }

            tempAttr = node.Attribute("footerStyle");
            if (tempAttr != null)
            {
                footerStyle.LoadFromString(tempAttr.Value);
            }

            tempAttr = node.Attribute("sourceTableHasFooter");
            if (tempAttr != null)
            {
                bool.TryParse(tempAttr.Value, out sourceTableHasFooter);
            }

            tempAttr = node.Attribute("sourceTableHasFooterSource");
            if (tempAttr != null)
            {
                sourceTableHasFooterSource = tempAttr.Value;
                if (boundFields.ContainsKey(sourceTableHasFooterSource))
                {
                    bool.TryParse(boundFields [sourceTableHasFooterSource].ToString(), out sourceTableHasFooter);
                }
            }

            foreach (XElement child in node.Elements())
            {
                switch (child.Name.LocalName.ToLowerInvariant())
                {
                case "columns":
                    foreach (XElement column in child.Elements())
                    {
                        TableColumn tableColumn;
                        switch (column.Name.LocalName.ToLowerInvariant())
                        {
                        case "column":
                            tableColumn = new TableColumn(column, boundFields);
                            break;

                        default:
                            continue;
                        }

                        columns.Add(tableColumn);
                    }

                    CreateHeader(boundFields);
                    CreateFooter(boundFields);
                    break;

                case "rows":
                    if (sourceTable.Length == 0)
                    {
                        foreach (XElement row in child.Elements())
                        {
                            TableRow tableRow;
                            switch (row.Name.LocalName.ToLowerInvariant())
                            {
                            case "row":
                                tableRow = DocumentHelper.FormObjectCreator.CreateRow(row, boundFields);
                                break;

                            default:
                                continue;
                            }
                            if (tableRow.Style.ToString(tableRow.DefaultStyle) == tableRow.DefaultStyle.ToString(tableRow.DefaultStyle))
                            {
                                tableRow.Style = (ObjectStyle)itemStyle.Clone();
                            }
                            rows.Add(tableRow);

                            if (style.InnerVerticalBorder.HasValue)
                            {
                                tableRow.Style.InnerVerticalBorder = style.InnerVerticalBorder;
                            }

                            if (style.InnerHSpacing.HasValue)
                            {
                                tableRow.Style.InnerHSpacing = style.InnerHSpacing;
                            }
                        }
                    }
                    break;
                }
            }

            RefreshStructure(boundFields);
        }
コード例 #18
0
ファイル: Main.cs プロジェクト: cpdean/di
        public Main(Model.Main m)
        {
            Model = m;

            var windowModes = new List<WindowMode>();
            WindowModes = new ReadOnlyCollection<WindowMode>(windowModes);

            // Command mode bindings (0)
            var commandMode = new KeyMap() { Priority = 5 };
            commandMode.Add(Key.i, new Command.ClearWindowMode(), new Command.AddWindowMode(1));
            commandMode.Add(Key.h, new Command.Down());
            commandMode.Add(Key.t, new Command.Up());
            commandMode.Add(Key.d, new Command.Left());
            commandMode.Add(Key.n, new Command.Right());
            commandMode.Add(Key.Down, new Command.Down());
            commandMode.Add(Key.Up, new Command.Up());
            commandMode.Add(Key.Left, new Command.Left());
            commandMode.Add(Key.Right, new Command.Right());
            commandMode.Add(Key.o, new Command.OpenFile());
            commandMode.Add(Key.w, new Command.ClearWindowMode(), new Command.AddWindowMode(4), new Command.AddWindowMode(3));
            windowModes.Add(new WindowMode { Name = "Command", KeyMap = commandMode });

            // Insert mode bindings (1)
            var insertMode = new KeyMap();
            insertMode.SetDefault(new Command.InsertKey());
            insertMode.Add(Key.Return, new Command.InsertChar('\n'));
            insertMode.Add(Key.Escape,
                           new Command.DiscardInput(),
                           new Command.ClearWindowMode(),
                           new Command.AddWindowMode(0),
                           new Command.AddWindowMode(2),
                           new Command.AddWindowMode(3));
            insertMode.Add(Key.BackSpace, new Command.Delete(), new Command.Backspace());
            insertMode.Add(Key.Tab, new Command.Tab());
            insertMode.Add(Key.Down, new Command.Down());
            insertMode.Add(Key.Up, new Command.Up());
            insertMode.Add(Key.Left, new Command.Left());
            insertMode.Add(Key.Right, new Command.Right());
            insertMode.Add(Key.Delete, new Command.Delete(), new Command.Right());
            windowModes.Add(new WindowMode { Name = "Insert", KeyMap = insertMode });

            // Number mode bindings (2)
            var numberMode = new KeyMap();
            numberMode.Add(Key.Key_0, new NumCommand());
            numberMode.Add(Key.Key_1, new NumCommand());
            numberMode.Add(Key.Key_2, new NumCommand());
            numberMode.Add(Key.Key_3, new NumCommand());
            numberMode.Add(Key.Key_4, new NumCommand());
            numberMode.Add(Key.Key_5, new NumCommand());
            numberMode.Add(Key.Key_6, new NumCommand());
            numberMode.Add(Key.Key_7, new NumCommand());
            numberMode.Add(Key.Key_8, new NumCommand());
            numberMode.Add(Key.Key_9, new NumCommand());
            windowModes.Add(new WindowMode { Name = "Number", Hidden = true, KeyMap = numberMode });

            // Common bindings (3)
            var commonMode = new KeyMap();
            commonMode.Add(Key.Escape, new Command.DiscardInput());
            windowModes.Add(new WindowMode { Name = "Common", Hidden = true, KeyMap = commonMode });

            // Window mode bindings (4)
            var windowMode = new KeyMap();
            windowMode.Add(Key.a,
                           new Command.OpenFileInNewWindow(),
                           new Command.ClearWindowMode(),
                           new Command.AddWindowMode(0),
                           new Command.AddWindowMode(2),
                           new Command.AddWindowMode(3));
            windowMode.Add(Key.c,
                           new Command.CloseWindow(),
                           new Command.ClearWindowMode(),
                           new Command.AddWindowMode(0),
                           new Command.AddWindowMode(2),
                           new Command.AddWindowMode(3));
            windowModes.Add(new WindowMode { Name = "Window", KeyMap = windowMode });

            Windows = new BindList<Window>();
            if (Model.Buffers.HasAny())
            {
                var window = new Window(this, Model.Buffers.Item(0));
                Windows.Add(window);
                FocusedWindow.Value = window;
            }
            WindowsEvents = Windows.Event;
        }