Пример #1
0
 private void appContextUOMBinding(string itemNumber)
 {
     try
     {
         ComboBoxBinding.BindEntityToCombobox(AppContext.UOMDDLBinding(itemNumber), this.cmbUOM, "Uom", "Uom", "");
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #2
0
 private void txtItemNumber_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         try
         {
             var itemResult = Calbee.WMS.Services.Count.CountServiceProxy.WS.GetCountDetail(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.cmbCountNumner.SelectedValue.ToString(), this.txtLocation.Text.Trim(), this.txtLPN.Text.Trim(), this.txtItemNumber.Text.Trim());
             if (itemResult != null)
             {
                 if (itemResult.Count() > 0)
                 {
                     this.txtDescription.Text = string.IsNullOrEmpty(itemResult.FirstOrDefault().ItemName) ? string.Empty : itemResult.FirstOrDefault().ItemName;
                     this.txtLotNumber.Text   = string.IsNullOrEmpty(itemResult.FirstOrDefault().LotNumber) ? string.Empty : itemResult.FirstOrDefault().LotNumber;
                     this.txtExpiryDate.Text  = string.IsNullOrEmpty(itemResult.FirstOrDefault().ExpiryDate) ? string.Empty : itemResult.FirstOrDefault().ExpiryDate;
                     this.txtQuantity.Text    = string.IsNullOrEmpty(itemResult.FirstOrDefault().CountQty.ToString()) ? string.Empty : itemResult.FirstOrDefault().CountQty.ToString();
                     ComboBoxBinding.BindEntityToCombobox(AppContext.UOMDDLBinding(this.txtItemNumber.Text.Trim()), this.cmbUOM, "Uom", "Uom", "");
                     this.cmbUOM.SelectedValue = string.IsNullOrEmpty(itemResult.FirstOrDefault().Uom) ? string.Empty : itemResult.FirstOrDefault().Uom;
                     defaultItemStatusBinding(string.IsNullOrEmpty(itemResult.FirstOrDefault().ItemStatus) ? string.Empty : itemResult.FirstOrDefault().ItemStatus);
                 }
                 else
                 {
                     MsgBox.DialogWarning("Not found item number : " + this.txtItemNumber.Text.Trim() + " in system");
                     this.txtItemNumber.Focus();
                     this.txtItemNumber.SelectAll();
                     return;
                 }
             }
             else
             {
                 MsgBox.DialogWarning("Not found item number : " + this.txtItemNumber.Text.Trim() + " in system");
                 this.txtItemNumber.Focus();
                 this.txtItemNumber.SelectAll();
                 return;
             }
         }
         catch (Exception ex)
         {
             if (ex.InnerException != null)
             {
                 MsgBox.DialogError(ex.InnerException.Message.ToString());
             }
             else
             {
                 if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
                 {
                     // Show error description detail
                     MsgBox.DialogError(ex.GetBaseException().ToString());
                 }
                 else
                 {
                     // Show message error
                     MsgBox.DialogError(ex.Message.ToString());
                 }
             }
         }
     }
 }
Пример #3
0
 private void defaultItemStatusBinding(string statusName)
 {
     try
     {
         List <Calbee.WMS.Services.MasterService.tbc_Status> _listItemStatus = new List <Calbee.WMS.Services.MasterService.tbc_Status>();
         Calbee.WMS.Services.MasterService.tbc_Status        _master;
         _listItemStatus = Calbee.WMS.Services.Masters.MasterServiceProxy.WS.GetStatus(Calbee.Infra.Common.Constants.WConstants.reciveItemStatusType).ToList();
         if (_listItemStatus != null)
         {
             /*แสดงแบบ ถ้ามีข้อมูลเพียง Record เดียวให้ แสดงค่ามาเลย*/
             if (string.IsNullOrEmpty(statusName))
             {
                 if (_listItemStatus.Count() > 1)
                 {
                     _master            = new Calbee.WMS.Services.MasterService.tbc_Status();
                     _master.StatusName = Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect;
                     _listItemStatus.Insert(0, _master);
                     ComboBoxBinding.BindEntityToCombobox(_listItemStatus, this.cmbItemStatus, "StatusName", "StatusName", "");
                 }
                 else
                 {
                     ComboBoxBinding.BindEntityToCombobox(_listItemStatus, this.cmbItemStatus, "StatusName", "StatusName", "");
                 }
             }
             else
             {
                 ComboBoxBinding.BindEntityToCombobox(_listItemStatus, this.cmbItemStatus, "StatusName", "StatusName", "");
                 this.cmbItemStatus.Text = statusName;
             }
         }
         else
         {
             this.cmbItemStatus.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
 public ChoiceSetting(string aName, string aCaption, List <string> values, string aDefaultValue = null)
 {
     Name         = aName;
     Caption      = aCaption;
     DefaultValue = aDefaultValue;
     Values       = values;
     if (DefaultValue == null && values.Count != 0)
     {
         DefaultValue = values[0];
     }
     _controlBinding = new ComboBoxBinding(this);
 }
Пример #5
0
 private void defaultItemStatusBinding(string itemNumber, string statusName)
 {
     try
     {
         List <string> _listItemStatus = new List <string>();
         _listItemStatus = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventoryStatuss(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.txtLocation.Text.Trim(), string.Empty, string.Empty, this.txtItemNumber.Text.Trim()).ToList();
         if (_listItemStatus != null)
         {
             /*แสดงแบบ ถ้ามีข้อมูลเพียง Record เดียวให้ แสดงค่ามาเลย*/
             if (string.IsNullOrEmpty(statusName))
             {
                 if (_listItemStatus.Count() > 1)
                 {
                     _listItemStatus.Insert(0, Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect);
                     ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus);
                 }
                 else
                 {
                     ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus);
                 }
             }
             else
             {
                 ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus);
                 this.cmbItemStatus.Text = statusName;
             }
         }
         else
         {
             this.cmbItemStatus.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #6
0
 private void itemNumberBinding(string warehouseCode, string countNumber, string locationCode)
 {
     try
     {
         List <string> _listItemNumber = new List <string>();
         _listItemNumber = Calbee.WMS.Services.Count.CountLocationServiceProxy.WS.GetCountItems(warehouseCode, countNumber, locationCode).ToList();
         if (_listItemNumber != null)
         {
             if (_listItemNumber.Count() == 0)
             {
                 this.cmbItemNumber.Text       = string.Empty;
                 this.cmbItemNumber.DataSource = null;
             }
             else if (_listItemNumber.Count() > 1)
             {
                 _listItemNumber.Insert(0, string.Empty); // Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect);
                 ComboBoxBinding.BindLStringToCombobox(_listItemNumber, this.cmbItemNumber);
             }
             else
             {
                 ComboBoxBinding.BindLStringToCombobox(_listItemNumber, this.cmbItemNumber);
             }
         }
         else
         {
             this.cmbItemNumber.Text       = string.Empty;
             this.cmbItemNumber.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #7
0
 private void ItemStatusBinding()
 {
     try
     {
         List <Calbee.WMS.Services.MasterService.tbc_Status> _listItemStatus = new List <Calbee.WMS.Services.MasterService.tbc_Status>();
         //Calbee.WMS.Services.MasterService.tbc_Status _master;
         _listItemStatus = Calbee.WMS.Services.Masters.MasterServiceProxy.WS.GetStatus(Calbee.Infra.Common.Constants.WConstants.reciveItemStatusType).ToList();
         if (_listItemStatus != null)
         {
             if (_listItemStatus.Count() == 1)
             {
                 // Default value ReceiveNumber
                 ComboBoxBinding.BindEntityToCombobox(_listItemStatus, this.cmbToItemStatus, "StatusName", "StatusName", "");
             }
             else if (_listItemStatus.Count() > 1)
             {
                 // Binding dropdowm
                 ComboBoxBinding.BindEntityToCombobox(_listItemStatus, this.cmbToItemStatus, "StatusName", "StatusName", "");
             }
             else
             {
                 this.cmbToItemStatus.DataSource = null;
             }
         }
         else
         {
             this.cmbToItemStatus.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #8
0
        private void ScanItemNumber(string itemNumber)
        {
            try
            {
                // var itemResult = Calbee.WMS.Services.Count.CountLocationServiceProxy.WS.GetCountDetail(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.cmbCountNumner.SelectedValue.ToString(), this.txtLocation.Text.Trim(), string.Empty, itemNumber);
                var itemResult = Calbee.WMS.Services.Count.CountLocationServiceProxy.WS.GetCountDetail(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.txtCountNumber.Text.Trim(), this.txtLocation.Text.Trim(), string.Empty, itemNumber);
                if (itemResult != null)
                {
                    this.txtDescription.Text = string.IsNullOrEmpty(itemResult.FirstOrDefault().ItemName) ? string.Empty : itemResult.FirstOrDefault().ItemName;
                    this.txtCtcCode.Text     = string.IsNullOrEmpty(itemResult.FirstOrDefault().CTCCode) ? string.Empty : itemResult.FirstOrDefault().CTCCode;
                    ComboBoxBinding.BindEntityToCombobox(AppContext.UOMDDLSingleBinding(this.cmbItemNumber.SelectedValue.ToString()), this.cmbUOM, "Uom", "Uom", "");
                    defaultItemStatusBinding(this.cmbItemNumber.SelectedValue.ToString(), string.Empty);

                    this.txtQuantity.Text = itemResult.FirstOrDefault().StockQty.HasValue == false ? "0" : itemResult.FirstOrDefault().StockQty.Value.ToString();

                    this.cmbUOM.Focus();
                }
                else
                {
                    this.cmbItemNumber.Text       = string.Empty;
                    this.cmbItemNumber.DataSource = null;

                    this.cmbUOM.Text       = string.Empty;
                    this.cmbUOM.DataSource = null;

                    this.cmbItemStatus.Text       = string.Empty;
                    this.cmbItemStatus.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    MsgBox.DialogError(ex.InnerException.Message.ToString());
                }
                else
                {
                    if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
                    {
                        // Show error description detail
                        MsgBox.DialogError(ex.GetBaseException().ToString());
                    }
                    else
                    {
                        // Show message error
                        MsgBox.DialogError(ex.Message.ToString());
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Builds a new binding.
        /// </summary>
        /// <typeparam name="TView">The type of the view the new binding binds to.</typeparam>
        /// <typeparam name="TControl">The type of the control the new binding binds to.</typeparam>
        /// <typeparam name="TViewModel">The type of the viewmodel the new binding binds to.</typeparam>
        /// <param name="view">The view to bind to.</param>
        /// <param name="control">The control to bind to.</param>
        /// <param name="viewProperty">The binding target property (the property on the control to bind to).</param>
        /// <param name="viewModel">The viewmodel to bind to.</param>
        /// <param name="viewModelProperty">The binding source property (the property on the viewmodel to bind to).</param>
        /// <returns>A new binding.</returns>
        internal static Binding <TView> Build <TView, TControl, TViewModel>(TView view,
                                                                            TControl control, Expression <Func <TControl, object> > viewProperty, TViewModel viewModel, Expression <Func <TViewModel, object> > viewModelProperty) where TViewModel : INotifyPropertyChanged
        {
            Binding <TView> result = null;

            // special cases are handled by type and property name
            if (typeof(TControl) == typeof(TextBox) && control.GetPropertyInfo(viewProperty).Name == "Text")
            {
                result = new TextBoxBinding <TView, TViewModel>(view, control as TextBox,
                                                                viewProperty as Expression <Func <TextBox, object> >, viewModel, viewModelProperty);
            }

            if (typeof(TControl) == typeof(CheckBox) && control.GetPropertyInfo(viewProperty).Name == "Checked")
            {
                result = new CheckBoxBinding <TView, TViewModel>(view, control as CheckBox,
                                                                 viewProperty as Expression <Func <CheckBox, object> >, viewModel, viewModelProperty);
            }

            if (typeof(TControl) == typeof(ComboBox) && control.GetPropertyInfo(viewProperty).Name == "SelectedIndex")
            {
                result = new ComboBoxBinding <TView, TViewModel>(view, control as ComboBox,
                                                                 viewProperty as Expression <Func <ComboBox, object> >, viewModel, viewModelProperty);
            }


            if (typeof(TControl) == typeof(DateTimePicker) && control.GetPropertyInfo(viewProperty).Name == "Value")
            {
                result = new DateTimePickerBinding <TView, TViewModel>(view, control as DateTimePicker,
                                                                       viewProperty as Expression <Func <DateTimePicker, object> >, viewModel, viewModelProperty);
            }


            if (typeof(TControl) == typeof(RadioButton) && control.GetPropertyInfo(viewProperty).Name == "Checked")
            {
                result = new RadioBinding <TView, TViewModel>(view, control as RadioButton,
                                                              viewProperty as Expression <Func <RadioButton, object> >, viewModel, viewModelProperty);
            }

            if (result != null)
            {
                result.HookEvents();
                return(result);
            }

            // generic one-way binding
            return(new SimpleBinding <TView, TControl, TViewModel>(view, control,
                                                                   viewProperty, viewModel, viewModelProperty));
        }
Пример #10
0
        private void ScanItemNumber()
        {
            try
            {
                var itemResult = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventory(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.txtLocation.Text.Trim(), string.Empty, this.txtLPN.Text.Trim(), this.txtItemNumber.Text.Trim());
                if (itemResult != null)
                {
                    this.txtLotNumber.Enabled = itemResult.LotControl;
                    if (itemResult.LotControl)
                    {
                        // Lotcontrol = true
                        lotNumberBinding(this.txtLocation.Text.Trim(), this.txtLPN.Text.Trim(), this.txtItemNumber.Text.Trim());
                    }
                    this.txtExpiryDate.Enabled = itemResult.ExpiryDateControl;
                    if (itemResult.ExpiryDateControl)
                    {
                        // ExpiryDateControl = true
                        expiryDateBinding(this.txtLocation.Text.Trim(), this.txtLPN.Text.Trim(), this.txtItemNumber.Text.Trim());
                    }

                    this.txtDescription.Text = string.IsNullOrEmpty(itemResult.ItemName) ? string.Empty : itemResult.ItemName;
                    ComboBoxBinding.BindEntityToCombobox(AppContext.UOMDDLBinding(this.txtItemNumber.Text.Trim()), this.cmbUOM, "Uom", "Uom", "");
                    this.cmbUOM.SelectedValue = itemResult.UOM;
                    defaultItemStatusBinding(this.txtItemNumber.Text.Trim(), itemResult.StatusName);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    MsgBox.DialogError(ex.InnerException.Message.ToString());
                }
                else
                {
                    if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
                    {
                        // Show error description detail
                        MsgBox.DialogError(ex.GetBaseException().ToString());
                    }
                    else
                    {
                        // Show message error
                        MsgBox.DialogError(ex.Message.ToString());
                    }
                }
            }
        }
Пример #11
0
 private void LotNumberBinding()
 {
     try
     {
         List <string> _listLotNumber = new List <string>();
         _listLotNumber = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventoryLotNumbers(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.txtLocation.Text.Trim(), string.Empty, string.Empty, this.txtItemNumber.Text.Trim()).OrderBy(s => s).ToList();
         if (_listLotNumber != null)
         {
             if (_listLotNumber.Count() >= 1)
             {
                 ComboBoxBinding.BindLStringToCombobox(_listLotNumber, this.cmbLotNumber);
             }
             else
             {
                 this.cmbLotNumber.DataSource = null;
             }
         }
         else
         {
             this.cmbLotNumber.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #12
0
        /// <summary>
        /// Bind enum to ComboBox. Assumes the first enum member is the default.
        /// </summary>
        public ConfigurationGuiBinding BindEnum <T>(Control control, string property, params T[] values) where T : struct
        {
            Type type = typeof(T);

            if (values == null || values.Length == 0)
            {
                values = (T[])Enum.GetValues(type);
            }
            ComboBox comboBox = control as ComboBox;

            if (comboBox != null)
            {
                foreach (T element in values)
                {
                    object[] attr = type.GetField(Enum.GetName(type, element)).GetCustomAttributes(typeof(DescriptionAttribute), false);
                    string   description;
                    if (attr.Length > 0)
                    {
                        description = StringParser.Parse((attr[0] as DescriptionAttribute).Description);
                    }
                    else
                    {
                        description = Enum.GetName(type, element);
                    }
                    comboBox.Items.Add(description);
                }
                string[] valueNames = new string[values.Length];
                for (int i = 0; i < values.Length; i++)
                {
                    valueNames[i] = values[i].ToString();
                }
                ComboBoxBinding binding = new ComboBoxBinding(comboBox, valueNames, valueNames[0]);
                AddBinding(property, binding);
                comboBox.SelectedIndexChanged += ControlValueChanged;
                comboBox.KeyDown += ComboBoxKeyDown;
                return(binding);
            }
            else
            {
                throw new ApplicationException("Cannot bind " + control.GetType().Name + " to enum property.");
            }
        }
Пример #13
0
 private void UOMBinding(string itemNumber)
 {
     try
     {
         List <Calbee.WMS.Services.MasterService.ItemUom> _listUOM = new List <Calbee.WMS.Services.MasterService.ItemUom>();
         Calbee.WMS.Services.MasterService.ItemUom        _master;
         _listUOM = Calbee.WMS.Services.Masters.MasterServiceProxy.WS.GetItemUoms(itemNumber, string.Empty).ToList();
         if (_listUOM != null)
         {
             _master     = new Calbee.WMS.Services.MasterService.ItemUom();
             _master.Uom = Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect;
             _listUOM.Insert(0, _master);
             ComboBoxBinding.BindEntityToCombobox(_listUOM, this.cmbUOM, "Uom", "ItemUomId", "");
         }
         else
         {
             this.cmbUOM.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #14
0
 private void warehouseBinding()
 {
     try
     {
         List <Calbee.WMS.Services.MasterService.Warehouse> _listWarehouse = new List <Calbee.WMS.Services.MasterService.Warehouse>();
         Calbee.WMS.Services.MasterService.Warehouse        _master;
         _listWarehouse = Calbee.WMS.Services.Masters.MasterServiceProxy.WS.GetWarehousesUser(AppContext.CurrentUser.UserId, true).ToList();
         if (_listWarehouse != null)
         {
             _master = new Calbee.WMS.Services.MasterService.Warehouse();
             _master.WarehouseCode = Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect;
             _listWarehouse.Insert(0, _master);
             ComboBoxBinding.BindEntityToCombobox(_listWarehouse, this.cmbWarehouse, "WarehouseCode", "WarehouseCode", "");
         }
         else
         {
             this.cmbWarehouse.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             MsgBox.DialogError(ex.InnerException.Message.ToString());
         }
         else
         {
             if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
             {
                 // Show error description detail
                 MsgBox.DialogError(ex.GetBaseException().ToString());
             }
             else
             {
                 // Show message error
                 MsgBox.DialogError(ex.Message.ToString());
             }
         }
     }
 }
Пример #15
0
        /// <summary>
        /// Bind list of strings to ComboBox.
        /// entries: value -> Description
        /// </summary>
        public ConfigurationGuiBinding BindStringEnum(Control control, string property, string defaultValue, params KeyValuePair <string, string>[] entries)
        {
            ComboBox comboBox = control as ComboBox;

            if (comboBox != null)
            {
                string[] valueNames = new string[entries.Length];
                for (int i = 0; i < entries.Length; i++)
                {
                    valueNames[i] = entries[i].Key;
                    comboBox.Items.Add(StringParser.Parse(entries[i].Value));
                }
                ComboBoxBinding binding = new ComboBoxBinding(comboBox, valueNames, defaultValue);
                AddBinding(property, binding);
                comboBox.SelectedIndexChanged += ControlValueChanged;
                comboBox.KeyDown += ComboBoxKeyDown;
                return(binding);
            }
            else
            {
                throw new ApplicationException("Cannot bind " + control.GetType().Name + " to enum property.");
            }
        }
Пример #16
0
        private void txtLPN_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (string.IsNullOrEmpty(this.txtLPN.Text.Trim()))
                {
                    MsgBox.DialogWarning("Please scan lpn");
                    this.txtLPN.Focus();
                    this.txtLPN.SelectAll();
                    return;
                }
                else
                {
                    try
                    {
                        Calbee.WMS.Services.OutboundService.PickItem lpnResult = Calbee.WMS.Services.Outbound.OutboundServiceProxy.WS.GetOutboundPickingListLpn(string.Empty, this.txtPickingListNo.Text.Trim(), string.Empty, this.txtLPN.Text.Trim());
                        if (lpnResult != null)
                        {
                            this.txtItemNumber.Text  = string.IsNullOrEmpty(lpnResult.ItemNumber) ? string.Empty : lpnResult.ItemNumber;
                            entPickItem.itemNumber   = string.IsNullOrEmpty(lpnResult.ItemNumber) ? string.Empty : lpnResult.ItemNumber;
                            this.txtDescription.Text = string.IsNullOrEmpty(lpnResult.ItemName) ? string.Empty : lpnResult.ItemName;
                            this.txtLotNumber.Text   = string.IsNullOrEmpty(lpnResult.LotNumber) ? string.Empty : lpnResult.LotNumber;
                            entPickItem.lotNumber    = string.IsNullOrEmpty(lpnResult.LotNumber) ? string.Empty : lpnResult.LotNumber;
                            this.txtExpiryDate.Text  = string.IsNullOrEmpty(lpnResult.ExpiryDate) ? string.Empty : lpnResult.ExpiryDate;
                            entPickItem.expiryDate   = string.IsNullOrEmpty(lpnResult.ExpiryDate) ? string.Empty : lpnResult.ExpiryDate;
                            this.txtQuantity.Text    = string.IsNullOrEmpty(lpnResult.QuantityPlan.ToString()) ? string.Empty : lpnResult.QuantityPlan.ToString();
                            entPickItem.quantityPlan = lpnResult.QuantityPlan;
                            ComboBoxBinding.BindEntityToCombobox(AppContext.UOMDDLBinding(this.txtItemNumber.Text.Trim()), this.cmbUOM, "Uom", "Uom", "");
                            this.cmbUOM.SelectedValue = string.IsNullOrEmpty(lpnResult.Uom) ? string.Empty : lpnResult.Uom;
                            entPickItem.uom           = string.IsNullOrEmpty(lpnResult.Uom) ? string.Empty : lpnResult.Uom;
                            this.txtItemStatus.Text   = string.IsNullOrEmpty(lpnResult.Status) ? string.Empty : lpnResult.Status;
                            entPickItem.status        = string.IsNullOrEmpty(lpnResult.Status) ? string.Empty : lpnResult.Status;
                            entPickItem.location      = string.IsNullOrEmpty(lpnResult.Location) ? string.Empty : lpnResult.Location;
                            this.txtToLPN.Text        = this.txtLPN.Text.Trim();

                            this.lblResultCounter.Text = lpnResult.CompletedPalletQty + "/" + lpnResult.PlanPalletQty;

                            this.txtQuantity.Focus();
                            this.txtQuantity.SelectAll();
                        }
                        else
                        {
                            MsgBox.DialogWarning("Null LPN : " + this.txtLPN.Text.Trim() + " in system");
                            this.txtLPN.Focus();
                            this.txtLPN.SelectAll();
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.InnerException != null)
                        {
                            MsgBox.DialogError(ex.InnerException.Message.ToString());
                        }
                        else
                        {
                            if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
                            {
                                // Show error description detail
                                MsgBox.DialogError(ex.GetBaseException().ToString());
                            }
                            else
                            {
                                // Show message error
                                MsgBox.DialogError(ex.Message.ToString());
                            }
                        }
                    }
                }
            }
        }
Пример #17
0
        private void txtLPN_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (string.IsNullOrEmpty(this.txtLPN.Text.Trim()))
                {
                    MsgBox.DialogWarning("Please scan lpn");
                    this.txtLPN.Focus();
                    this.txtLPN.SelectAll();
                    return;
                }
                else
                {
                    try
                    {
                        var LpnDetailResult = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventorys(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, string.Empty, string.Empty, this.txtLPN.Text.Trim(), string.Empty, string.Empty);
                        if (LpnDetailResult != null)
                        {
                            if (LpnDetailResult.Count() > 0)
                            {
                                // เอาข้อมูลมาใส่ Gridview Production
                                CreateTableDetailOnGridView();
                                DataTable dtTempProduction = ConvertObject.ToTable(LpnDetailResult);
                                if (dtTempProduction != null)
                                {
                                    if (dtTempProduction.Rows.Count > 0)
                                    {
                                        //Add to datagrid.
                                        DataRow AddAll;
                                        foreach (DataRow item in dtTempProduction.Rows)
                                        {
                                            AddAll                = dtDetail.NewRow();
                                            AddAll["Quantity"]    = Convert.ToString(item["Quantity"]).Trim();
                                            AddAll["ItemStatus"]  = Convert.ToString(item["StatusName"]).Trim();
                                            AddAll["UOM"]         = Convert.ToString(item["UOM"]).Trim();
                                            AddAll["ReceiveDate"] = Convert.ToString(item["ReceiveDate"]).Trim();
                                            dtDetail.Rows.Add(AddAll);
                                        }

                                        dtDetail.TableName = "Detail";
                                        dgvChangeStatusDetail.DataSource = dtDetail;
                                    }
                                }

                                this.txtLocation.Text        = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().LocationCode) ? string.Empty : LpnDetailResult.FirstOrDefault().LocationCode;
                                this.txtLocation.ReadOnly    = true;
                                this.txtItemNumber.Text      = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().ItemNumber) ? string.Empty : LpnDetailResult.FirstOrDefault().ItemNumber;
                                this.txtItemNumber.ReadOnly  = true;
                                this.txtDescription.Text     = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().ItemName) ? string.Empty : LpnDetailResult.FirstOrDefault().ItemName;
                                this.txtDescription.ReadOnly = true;
                                this.txtLotNumber.Text       = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().LotNumber) ? string.Empty : LpnDetailResult.FirstOrDefault().LotNumber;
                                this.txtLotNumber.ReadOnly   = true;
                                if (LpnDetailResult.FirstOrDefault().ExpiryDate != null)
                                {
                                    this.dtpExpiryDate.Value = LpnDetailResult.FirstOrDefault().ExpiryDate.Value;
                                }
                                else
                                {
                                    this.dtpExpiryDate.Value = AppContext.GetDateTimeServer();
                                }
                                this.toLpn                 = LpnDetailResult.FirstOrDefault().Lpn;
                                this.UOM                   = LpnDetailResult.FirstOrDefault().UOM;
                                this.expiryDateControl     = LpnDetailResult.FirstOrDefault().ExpiryDateControl;
                                this.dtpExpiryDate.Enabled = false;
                                this.txtQuantity.Text      = LpnDetailResult.FirstOrDefault().Quantity.ToString();
                                List <string> _listItemStatus = new List <string>();
                                foreach (var item in LpnDetailResult)
                                {
                                    _listItemStatus.Add(item.StatusName);
                                }

                                ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus);
                                this.txtQuantity.Focus();
                            }
                        }
                        else
                        {
                            MsgBox.DialogWarning("Not found lpn : " + this.txtLPN.Text);
                            this.txtItemNumber.Focus();
                            this.txtItemNumber.SelectAll();
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.InnerException != null)
                        {
                            MsgBox.DialogError(ex.InnerException.Message.ToString());
                        }
                        else
                        {
                            if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
                            {
                                // Show error description detail
                                MsgBox.DialogError(ex.GetBaseException().ToString());
                            }
                            else
                            {
                                // Show message error
                                MsgBox.DialogError(ex.Message.ToString());
                            }
                        }
                    }
                }
            }
        }
Пример #18
0
        private void forkLiftBinding(string warehouseCode)
        {
            try
            {
                /*
                 * List<Calbee.WMS.Services.MasterService.Location> _listForkLift = new List<Calbee.WMS.Services.MasterService.Location>();
                 * Calbee.WMS.Services.MasterService.Location _master;
                 * _listForkLift = Calbee.WMS.Services.Masters.MasterServiceProxy.WS.GetLocations(warehouseCode, string.Empty, string.Empty, Calbee.Infra.Common.Constants.WConstants.locationType).ToList();
                 * if (_listForkLift != null)
                 * {
                 *  if (_listForkLift.Count() == 1)
                 *  {
                 *      ComboBoxBinding.BindEntityToCombobox(_listForkLift, this.cmbForklift, "LocationCode", "LocationCode", "");
                 *  }
                 *  else
                 *  {
                 *      _master = new Calbee.WMS.Services.MasterService.Location();
                 *      _master.LocationCode = Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect;
                 *      _listForkLift.Insert(0, _master);
                 *      ComboBoxBinding.BindEntityToCombobox(_listForkLift, this.cmbForklift, "LocationCode", "LocationCode", "");
                 *  }
                 * }
                 * else
                 * {
                 *  this.cmbWarehouse.DataSource = null;
                 * }
                 */

                List <Calbee.WMS.Services.MasterService.Location> _listForkLift = new List <Calbee.WMS.Services.MasterService.Location>();
                Calbee.WMS.Services.MasterService.Location        _master;
                string forkliftLocation = Calbee.WMS.Services.Masters.MasterServiceProxy.WS.GetWarehousesUserLocation(Calbee.Infra.Common.Constants.WConstants.userId, true, warehouseCode);
                if (!string.IsNullOrEmpty(forkliftLocation))
                {
                    _master = new Calbee.WMS.Services.MasterService.Location();
                    _master.LocationCode = forkliftLocation;
                    _listForkLift.Insert(0, _master);
                    ComboBoxBinding.BindEntityToCombobox(_listForkLift, this.cmbForklift, "LocationCode", "LocationCode", "");
                }
                else
                {
                    // MsgBox.ShowExclamation("Not found forklift by This Warehouse : " + this.cmbWarehouse.Text);
                    this.cmbForklift.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    MsgBox.DialogError(ex.InnerException.Message.ToString());
                }
                else
                {
                    if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y"))
                    {
                        // Show error description detail
                        MsgBox.DialogError(ex.GetBaseException().ToString());
                    }
                    else
                    {
                        // Show message error
                        MsgBox.DialogError(ex.Message.ToString());
                    }
                }
            }
        }