Пример #1
0
        private MenuMapping GetDataDetail()
        {
            MenuMapping entity = new MenuMapping();
            entity.menu_mapping_id = keyCodeDetail;
            entity.menu_id = Converts.ParseLong(keyCode);

            if (modeDetail == ObjectState.Add)
            {
                entity.bill_of_material_head_id = Converts.ParseLongNullable(ddlBomHead.SelectedValue.ToString());
                entity.quantity = Converts.ParseDecimalNullable(txtQuantity.Text);
                entity.created_by = "SYSTEM";
                entity.created_date = DateTime.Now;
                entity.updated_by = "SYSTEM";
                entity.updated_date = DateTime.Now;
            }
            else
            {
                entity = ServiceProvider.MenuMappingService.FindByKeys(entity, false);
                if (entity != null)
                {
                    entity.bill_of_material_head_id = Converts.ParseLongNullable(ddlBomHead.SelectedValue.ToString());
                    entity.quantity = Converts.ParseDecimalNullable(txtQuantity.Text);
                    entity.updated_by = "SYSTEM";
                    entity.updated_date = DateTime.Now;
                }
            }

            return entity;
        }
Пример #2
0
        private void LoadDataDetail(long menuMappingID)
        {
            ddlBomHead.DataSource = ServiceProvider.BillOfMaterialHeadService.GetBillOfMaterialHeadComboBoxDTOByID(null);
            ddlBomHead.ValueMember = "Value";
            ddlBomHead.DisplayMember = "Display";

            MenuMapping entity = new MenuMapping();
            if (modeDetail == ObjectState.Edit && menuMappingID != 0)
            {
                //---Detail
                entity.menu_mapping_id = menuMappingID;
                entity = ServiceProvider.MenuMappingService.FindByKeys(entity, true);
                if (entity != null)
                {
                    ddlBomHead.SelectedValue = entity.bill_of_material_head_id.ToString();
                    txtQuantity.Text = string.Format(Format.IntegerNumberFormatNoZero, entity.quantity);

                    keyCodeDetail = entity.menu_mapping_id;
                }
            }
            else
            {
                keyCodeDetail = 0;

                ddlBomHead.SelectedIndex = 0;
                txtQuantity.Text = string.Empty;
            }

            grdDetail.LoadData();
        }