Пример #1
0
        private async void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectEdit() || !CheckEmpty())
            {
                return;
            }
            var selectItem = _productSearchData[DgdData.SelectedIndex];

            try
            {
                var editProduct = new DProduct
                {
                    DId          = selectItem.Id,
                    DProductName = TxtName.Text.Trim() == string.Empty ? null : TxtName.Text
                };
                await Task.Run(() => editProduct.Edit());
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در ویرایش اطلاعات\n" + exception.Message);
                return;
            }
            Window_Loaded(null, null);
            Utility.Message("پیام", "اطلاعات با موفقیت ویرایش گردید", "Correct.png");
        }
Пример #2
0
        public static string Edit(int id, string code, string name, string description, byte[] image, int idcat, int idpre)
        {
            DProduct Obj = new DProduct();

            Obj.Id             = id;
            Obj.Name           = name;
            Obj.Description    = description;
            Obj.Code           = code;
            Obj.Image          = image;
            Obj.IdCategory     = idcat;
            Obj.IdPresentation = idpre;
            return(Obj.Edit(Obj));
        }