Example #1
0
        public void RaiseOnCopyActionsDescriptionClick_SelectedOnCopyOptionDescriptionIsValid_CallsShowOnCopyAddDescription()
        {
            SetUp();
            ComboBoxOption option = new ComboBoxOption {
                Description = "dfgdfgdfgfd"
            };

            _viewModelMock.SetupGet(x => x.SelectedOnCopyOption).Returns(option);
            _viewMock.Setup(x => x.ShowOnCopyAddDescription(option.Description));

            _viewMock.Raise(x => x.OnBeforeViewShown             += null);
            _viewMock.Raise(x => x.OnCopyActionsDescriptionClick += null);

            _viewMock.Verify(x => x.ShowOnCopyAddDescription(option.Description), Times.Once);
        }
        public virtual void Initialize()
        {
            Step2Settings settings = _settingsService.LoadSettings <Step2Settings>("Step2Settings");

            if (settings != null && settings.SaveSettings)
            {
                _pathTo = settings.PathTo;
                _selectedOnCopyOption = OnCopyOptions.SingleOrDefault(x => x.ID == settings.OnCopyActionID);
                _saveSettings         = settings.SaveSettings;
            }
            else
            {
                _selectedOnCopyOption = OnCopyOptions.First();
            }
        }
        private bool ValidateFormInputs()
        {
            string subject     = subjectTextBox.Text;
            string description = descriptionTextBox.Text;

            ComboBoxOption typeOfIncidentOption = (ComboBoxOption)typeOfIncidentComboBox.SelectedItem;
            ComboBoxOption priorityOption       = (ComboBoxOption)priorityComboBox.SelectedItem;
            ComboBoxOption deadlineOption       = (ComboBoxOption)deadlineComboBox.SelectedItem;
            ComboBoxOption openStatusOption     = (ComboBoxOption)statusComboBox.SelectedItem;

            if (subject.Length == 0)
            {
                return(false);
            }
            if (description.Length == 0)
            {
                return(false);
            }
            if (typeOfIncidentOption == null)
            {
                return(false);
            }
            if (priorityOption == null)
            {
                return(false);
            }
            if (deadlineOption == null)
            {
                return(false);
            }
            if (openStatusOption == null)
            {
                return(false);
            }
            if (selectedUser == null)
            {
                return(false);
            }

            return(true);
        }
Example #4
0
        public virtual void Initialize()
        {
            Step3Settings settings = _settingsService.LoadSettings <Step3Settings>("Step3Settings");

            if (settings != null)
            {
                _selectedOnDuplicateOption = OnDuplicateOptions.SingleOrDefault(x => x.ID == settings.OnDuplicateOptionID);
                _selectedSortOption        = SortOptions.SingleOrDefault(x => x.ID == settings.SortOptionID);

                if (_selectedSortOption == null)
                {
                    _selectedSortOption = SortOptions.First();
                }

                _showRandomizedFiles = settings.ShowRandomizedFiles;
                _saveSettings        = settings.SaveSettings;
            }
            else
            {
                _selectedOnDuplicateOption = OnDuplicateOptions.First();
                _selectedSortOption        = SortOptions.First();
            }
        }
        private void ConfirmButtonOnClick(object sender, EventArgs e)
        {
            DateTime reportedAt = dateTimeReportedPicker.Value;
            string   subject    = subjectTextBox.Text;

            // Get the combo box options
            ComboBoxOption typeOfIncidentOption = (ComboBoxOption)typeOfIncidentComboBox.SelectedItem;
            ComboBoxOption priorityOption       = (ComboBoxOption)priorityComboBox.SelectedItem;
            ComboBoxOption deadlineOption       = (ComboBoxOption)deadlineComboBox.SelectedItem;
            ComboBoxOption openStatusOption     = (ComboBoxOption)statusComboBox.SelectedItem;

            // Get the values from the combo box options
            IncidentType incidentType = (IncidentType)typeOfIncidentOption.Value;
            Priority     priority     = (Priority)priorityOption.Value;
            Deadline     deadline     = (Deadline)deadlineOption.Value;
            OpenState    openState    = (OpenState)openStatusOption.Value;

            string description = descriptionTextBox.Text;

            // Construct the ticket. If ticketId is null, MongoDB will create a new id
            Ticket ticket = new Ticket()
            {
                Id             = ticketId,
                DateReported   = reportedAt,
                Deadline       = deadline,
                Priority       = priority,
                Subject        = subject,
                TypeOfIncident = incidentType,
                Description    = description,
                ReportedByUser = selectedUser,
                OpenStatus     = openState,
            };

            // Trigger callback
            OnConfirm(ticket);
        }
Example #6
0
        // GET: Warehouse/CertificationSelectedReturnedInvoiceDetails/?invoiceSerial={invoiceSerial}&rows={rows}
        public ActionResult CertificationSelectedReturnedInvoiceDetails(int invoiceSerial, string rows)
        {
            ViewBag.Title         = "تایید برگشتی قابل فروش و غیر قابل فروش";
            ViewBag.InvoiceSerial = invoiceSerial;
            string[] sRows = ViewBag.SaleableRows = rows.Split(',');

            #region Table Data

            var tableData = Connections.SaleBranch.SqlConn.ExecuteReader(
                "sp_GetSaleReturnInvoiceDetailsTable", new { SerialNo = invoiceSerial },
                commandType: CommandType.StoredProcedure).ToDataTable();

            // creates a copy of the schema (columns)only.
            DataTable lstSaleable   = tableData.Clone(),
                      lstUnSaleable = tableData.Clone();

            // check row id for saleable list
            foreach (DataRow row in tableData.Rows)
            {
                if (sRows.Contains(row[0].ToString())) // row[0] = row["Id"]
                {
                    lstSaleable.Rows.Add(row.ItemArray);
                }
                else
                {
                    lstUnSaleable.Rows.Add(row.ItemArray);
                }
            }

            var modelSaleable = new TableOption()
            {
                Id   = "saleable",
                Data = lstSaleable,
                DisplayRowsLength = -1,
                Orders            = new[] { Tuple.Create(0, OrderType.asc) },
                Checkable         = false
            };

            var modelUnSaleable = new TableOption()
            {
                Id   = "unsaleable",
                Data = lstUnSaleable,
                DisplayRowsLength = -1,
                Orders            = new[] { Tuple.Create(0, OrderType.asc) }
            };

            var reasons        = Connections.SaleCore.SqlConn.Query("SELECT ReasonID, ReasonName FROM Reason");
            var reasonComboOpt = new ComboBoxOption()
            {
                Placeholder       = "انتخاب علت برگشتی",
                MenuHeaderText    = "علت برگشتی را انتخاب کنید",
                ShowOptionSubText = false,
                DataStyle         = Core.Enums.DataStyleType.warning,
                ShowTick          = true,
                DataLiveSearch    = true,
                DataSize          = "8",
                Data = reasons.Select(x => new ComboBoxDataModel()
                {
                    Value = ((object)x.ReasonID).ToString(), Text = x.ReasonName
                }).ToList()
            };
            modelUnSaleable.InputColumnsDataMember["4"] = reasonComboOpt;

            var multipleStepOpt = new MultipleStepProgressTabOption()
            {
                Steps            = _saleReturnedSteps,
                CurrentStepIndex = 3
            };

            var model = Tuple.Create(modelSaleable, modelUnSaleable, multipleStepOpt);

            #endregion

            return(View("SaleReturnedInvoice/CertificationSelectedReturnedInvoiceDetails", model));
        }
Example #7
0
 public ComboBoxOptionUI(ComboBoxOption option) :
     base(option.PropertyName, option.PropertyType, option.Owner, option.SelectedItemPropertyName, option.DisplayPath)
 {
 }
Example #8
0
        private Control createControl
            (ref int index, TabPage page, FieldInfo field, Expandable exa, dynamic value)
        {
            Dictionary <string, string>   strRes      = exa.strRes;
            Dictionary <string, string[]> comboBoxRes = exa.comboBoxItemRes;

            string desc = field.Name;
            Type   type = field.FieldType;

            string[] comboBoxItems = null;
            decimal  maximun = 100, minimun = 0, increment = 1;
            int      decimalPlaces = 0;

            if (field.GetCustomAttributes(typeof(NonSettable), false).Length != 0)
            {
                return(null);
            }

            object[] oAttr = field.GetCustomAttributes(typeof(Description), false);
            if (oAttr.Length != 0)
            {
                Description attr = (Description)oAttr[0];
                desc = strRes[attr.strResId];
            }

            oAttr = field.GetCustomAttributes(typeof(NumericOption), false);
            if (oAttr.Length != 0)
            {
                NumericOption attr = (NumericOption)oAttr[0];
                maximun       = attr.maximun;
                minimun       = attr.minimun;
                increment     = attr.increment;
                decimalPlaces = attr.decimalPlaces;
            }

            oAttr = field.GetCustomAttributes(typeof(ComboBoxOption), false);
            if (oAttr.Length != 0)
            {
                ComboBoxOption attr = (ComboBoxOption)oAttr[0];
                comboBoxItems = comboBoxRes[attr.key];
            }

            Label lab = new Label
            {
                AutoSize = true,
                Size     = new Size(33, 12),
                Text     = desc
            };

            Control control = null;

            if (type.Equals(typeof(string)) && comboBoxItems != null)
            {
                ComboBox tmp = new ComboBox
                {
                    Anchor        = (AnchorStyles.Top | AnchorStyles.Right),
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Location      = new Point(valueBox_x, 6 + index * 28),
                    Size          = new Size(150, 22),
                };
                tmp.Items.AddRange(comboBoxItems);
                tmp.SelectedIndex = 0;
                for (int i = 0; i < comboBoxItems.Length; i++)
                {
                    if (value == comboBoxItems[i])
                    {
                        tmp.SelectedIndex = i;
                        break;
                    }
                }
                control      = tmp;
                lab.Location = new Point(8, 6 + index * 28 + 3);
            }
            else if (type.Equals(typeof(string)))
            {
                control = new TextBox
                {
                    Anchor   = (AnchorStyles.Top | AnchorStyles.Right),
                    Text     = value,
                    Location = new Point(valueBox_x, 6 + index * 28),
                    Size     = new Size(150, 22),
                };
                lab.Location = new Point(8, 6 + index * 28 + 5);
            }
            else if (type.Equals(typeof(bool)))
            {
                control = new CheckBox()
                {
                    Anchor   = (AnchorStyles.Top | AnchorStyles.Right),
                    Checked  = value,
                    Location = new Point(valueBox_x, 6 + index * 28),
                    Size     = new Size(15, 14),
                    Text     = ""
                };
                lab.Location = new Point(8, 6 + index * 28 + 1);
            }
            else if (NumericTypes.Contains(type))
            {
                control = new NumericUpDown()
                {
                    Anchor        = (AnchorStyles.Top | AnchorStyles.Right),
                    Value         = Convert.ToDecimal(value),
                    DecimalPlaces = decimalPlaces,
                    Maximum       = maximun,
                    Minimum       = minimun,
                    Increment     = increment,
                    TextAlign     = HorizontalAlignment.Right,
                    Location      = new Point(valueBox_x, 6 + index * 28),
                    Size          = new Size(100, 22),
                };
                lab.Location = new Point(8, 6 + index * 28 + 2);
            }

            if (control != null)
            {
                control.Tag = field;
            }
            page.Controls.Add(control);
            page.Controls.Add(lab);
            index++;

            return(control);
        }
        // GET: Warehouse/ChooseReturnedInvoiceDetails/?invoiceSerial={invoiceSerial}
        public async Task <ActionResult> ChooseReturnedInvoiceDetails(int invoiceSerial)
        {
            ViewBag.Title         = _saleReturnedSteps[1];
            ViewBag.InvoiceSerial = invoiceSerial;

            #region Insert in use Business Doc into temp

            // clear older data of this user
            await Connections.SaleCore.SqlConn.ExecuteAsync(
                "DELETE FROM SaleCore.dbo.TempBusinessDocInUse WHERE UserID = @UserID  AND BusinessDocTypeID = 16", new { UserID = CurrentUser.Id });

            await Connections.SaleCore.SqlConn.ExecuteAsync(
                "INSERT INTO SaleCore.dbo.TempBusinessDocInUse  VALUES (@UserID , @BusinessDocNo , @BusinessDocTypeID , @ModifyDate)",
                new
            {
                UserID            = CurrentUser.Id,
                BusinessDocNo     = invoiceSerial,
                BusinessDocTypeID = 16,
                ModifyDate        = DateTime.Now
            });

            #endregion

            var multipleStepOpt = new MultipleStepProgressTabOption()
            {
                Steps            = _saleReturnedSteps,
                CurrentStepIndex = 2
            };


            #region Warehouse List for Store Combo

            var customerStoreCode = Connections.SaleBranch.SqlConn.QueryFirst <int>(
                "SELECT dbo.fn_GetCustomerStoreCode(" +
                "(SELECT TOP(1) PersonID FROM dbo.udft_BusinessDoc(dbo.fn_GetLongDate()) " +
                "WHERE BusinessDocNo = dbo.fn_GetBusinessDocNo(@invoiceSerial, 16)))", new { invoiceSerial });

            var stores = DatabaseContext.GetWarehouses(true, false, customerStoreCode);

            var storesOpt = new ComboBoxOption()
            {
                AutoComplete      = true,
                Data              = stores,
                Checked           = true,
                AutoFocus         = true,
                MenuHeaderText    = "انبار برگشتی",
                MultipleSelection = false,
                Placeholder       = "انبار برگشتی",
                Name              = "WarehouseSelector",
                DataStyle         = DataStyleType.info,
                ShowOptionSubText = false,
                DataLiveSearch    = false,
                ShowSelectDeselectAllOptionsBox = true,
                DataWidth = "25%",
                ShowTick  = true
            };

            #endregion

            dynamic model = new ExpandoObject();
            model.MultipleStepOpt = multipleStepOpt;
            model.StoresComboOpt  = storesOpt;

            return(View("SaleReturnedInvoice/ChooseReturnedInvoiceDetails", model));
        }