Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ResultEN res = new ResultEN();

            if (mode == "add")
            {
                EquipmentTypeEN en = new EquipmentTypeEN();
                if (Level == 0)
                {
                    en.TypeName = txtTypeName.Text;
                }
                else
                {
                    en.TypeName = txtSubName.Text;
                }

                en.ParentID = Convert.ToInt32(hidParentID.Value);

                res = ClassEuipt.Insert_Type(en);
            }
            else
            {
                SetData();
                EquipmentTypeEN en = new EquipmentTypeEN();
                en  = SelectedItem;
                res = ClassEuipt.Update_Type(en);
            }

            if (res.result)
            {
                MessageShow("บันทึกเรียบร้อยแล้ว");
                BindGrid();
                BindTree();
                SetDefaultControl();
                this.SelectedItem = null;
            }
        }