private void LoadData()
        {
            EnableMode();

            BillOfMaterialHead entity = new BillOfMaterialHead();
            if (modeHead == ObjectState.Edit && !string.IsNullOrEmpty(keyCode))
            {
                ddlBOMGroup.DataSource = ServiceProvider.BillOfMaterialGroupService.GetBillOfMaterialGroupComboBoxDTO();
                ddlBOMGroup.ValueMember = "Value";
                ddlBOMGroup.DisplayMember = "Display";

                //---Header
                entity.bill_of_material_head_id = Converts.ParseLong(keyCode);
                entity = ServiceProvider.BillOfMaterialHeadService.FindByKeys(entity, true);

                if (entity != null)
                {
                    ddlBOMGroup.SelectedValue = entity.bill_of_material_group_id.ToString();
                    txtBOMHeadCode.Text = entity.bill_of_material_head_code;
                    txtBOMHeadName.Text = entity.bill_of_material_head_name;
                    txtBOMHeadDescription.Text = entity.bill_of_material_head_description;
                    txtRemark.Text = entity.remark;

                    //---Detail
                    modeDetail = ObjectState.Add;
                    InitialGridDetail();
                    LoadDataDetail(0);
                }
            }
            else
            {
                ddlBOMGroup.SelectedIndex = 0;
                txtBOMHeadCode.Text = string.Empty;
                txtBOMHeadName.Text = string.Empty;
                txtBOMHeadDescription.Text = string.Empty;
                txtRemark.Text = string.Empty;
            }

        }
        private BillOfMaterialHead GetData()
        {
            BillOfMaterialHead entity = new BillOfMaterialHead();
            entity.bill_of_material_group_id = Converts.ParseLong(ddlBOMGroup.SelectedValue.ToStringNullable());
            entity.bill_of_material_head_id = Converts.ParseLong(keyCode);
            entity.bill_of_material_head_code = txtBOMHeadCode.Text;
            entity.bill_of_material_head_name = txtBOMHeadName.Text;
            entity.bill_of_material_head_description = txtBOMHeadDescription.Text;
            entity.remark = txtRemark.Text;
            entity.created_by = "SYSTEM";
            entity.created_date = DateTime.Now;
            entity.updated_by = "SYSTEM";
            entity.updated_date = DateTime.Now;

            return entity;
        }