private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (checkValid())
                {
                    ProjectDirectionTypeModel dModel;
                    if (isAdd)
                    {
                        dModel = new ProjectDirectionTypeModel();
                    }
                    else
                    {
                        //int ID = Convert.ToInt32(grvData.GetFocusedRowCellValue(colID).ToString());
                        int ID = Convert.ToInt32(treeData.FocusedNode.GetValue(colIDTree));
                        dModel = (ProjectDirectionTypeModel)ProjectDirectionTypeBO.Instance.FindByPK(ID);
                    }

                    dModel.Code     = txtCode.Text;
                    dModel.Name     = txtName.Text;
                    dModel.Qty      = TextUtils.ToDecimal(txtQty.EditValue);
                    dModel.TimeDK   = TextUtils.ToDecimal(txtTimeDK.EditValue);
                    dModel.ParentID = TextUtils.ToInt(cboParent.EditValue);

                    if (isAdd)
                    {
                        ProjectDirectionTypeBO.Instance.Insert(dModel);
                    }
                    else
                    {
                        ProjectDirectionTypeBO.Instance.Update(dModel);
                    }

                    LoadData();
                    loadParent();
                    SetInterface(false);
                    ClearInterface();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 protected ProjectDirectionTypeFacade(ProjectDirectionTypeModel model) : base(model)
 {
 }