Пример #1
0
        protected override bool InsertObject()
        {
            try
            {
                if (!ValidInput()) return false;

                var o = new Tra_Kind()
                {
                    Tra_GroupId = (Guid)lokGroup.GetColumnValue("Id"),
                    Name = txtName.Text,
                    Price1 = (int)calPrice1.Value,
                    Price2 = (int)calPrice2.Value,
                    Descript = txtDescript.Text
                };

                var oki = _bll.Tra_Kind.Insert(o);
                if (oki == null) BasePRE.ShowMessage(STR_DUPLICATE, STR_ADD);

                return oki != null ? true : false;
            }
            catch { return false; }
        }
Пример #2
0
        protected override bool UpdateObject()
        {
            try
            {
                if (!ValidInput()) return false;

                var id = (Guid)grvMain.GetFocusedRowCellValue("Id");

                var o = new Tra_Kind()
                {
                    Id = id,
                    Tra_GroupId = (Guid)lokGroup.GetColumnValue("Id"),
                    Name = txtName.Text,
                    Price1 = (int)calPrice1.Value,
                    Price2 = (int)calPrice2.Value,
                    Descript = txtDescript.Text
                };

                var oki = _bll.Tra_Kind.Update(o);
                if (oki == null) BasePRE.ShowMessage(STR_DUPLICATE, STR_EDIT);

                return oki != null ? true : false;
            }
            catch { return false; }
        }