Exemple #1
0
        private void GridPartitionMaster_RowActivated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
        {
            foreach (var data in gridPartitionMaster.SelectedItems)
            {
                tbl_PartitionMaster _tbs = data as tbl_PartitionMaster;

                _partCode = _tbs.PartitionCode;
            }
        }
Exemple #2
0
        private void GridPartitionMaster_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            try
            {
                if (gridPartitionMaster.SelectedItems.Count > 0)
                {
                    btnNewPartition.IsEnabled = false;

                    btnAddPartitionQuantity.IsEnabled = true;

                    tbl_PartitionMaster _tbs = gridPartitionMaster.SelectedItem as tbl_PartitionMaster;

                    _partCode = _tbs.PartitionCode;
                }
            }
            catch
            {
            }
        }
        private Boolean InsertPartition()
        {
            Boolean _isValid = false;

            _isValid = _isValidFields();

            if (!_isValid)
            {
                return(false);
            }

            bool isexists = dbContext.tbl_PartitionMaster.Any(x => x.PartitionCode == tbPartitionCode.Text.Trim() && x.BoxCode == _boxCode);

            if (!isexists)
            {
                tbl_PartitionMaster tbl = new tbl_PartitionMaster()
                {
                    BoxCode       = _boxCode,
                    PartitionCode = tbPartitionCode.Text.Trim().ToUpper(),
                    EncodedBy     = _name,
                    DateEncoded   = DateTime.Now
                };

                dbContext.tbl_PartitionMaster.Add(tbl);

                dbContext.SaveChanges();

                Save();

                var b = from data in dbContext.tbl_BoxMaster
                        join part in dbContext.tbl_PartitionMaster on data.BoxCode equals part.BoxCode
                        where data.BoxCode == _boxCode
                        select new
                {
                    PartitionCode = part.PartitionCode,
                };

                BoxAndPartitionMaster.gridBoxPartitionList.ItemsSource = b.ToList();

                if (BoxAndPartitionMaster.gridBoxPartitionList.Items.Count > 0)
                {
                    BoxAndPartitionMaster.btnNew_Partition.IsEnabled = false;

                    BoxAndPartitionMaster.btnAdd_PartitionQTY.IsEnabled = false;
                }
                else
                {
                    BoxAndPartitionMaster.btnNew_Partition.IsEnabled = true;

                    BoxAndPartitionMaster.btnAdd_PartitionQTY.IsEnabled = false;
                }

                MessageBox.Show("Record successfully saved");

                this.Close();
            }
            else
            {
                MessageBox.Show("Record already exists");
            }

            return(true);
        }