Ejemplo n.º 1
0
        private void Button_Click(object sender, EventArgs e)
        {
            Form ContentFM = null;

            if (sender.Equals(btOrder))
            {
                ContentFM = new Orders.OrdersForm();
            }
            else if (sender.Equals(btCustomer))
            {
                ContentFM = new Customer.CustomerForm();
            }
            else if (sender.Equals(btClaimCollection))
            {
                ContentFM = new ClaimCollection.ClaimCollectionForm();
            }
            else if (sender.Equals(btPurchase))
            {
                ContentFM = new Purchase.Purchase();
            }
            else if (sender.Equals(btSales))
            {
                ContentFM = new Purchase.SaleForm();
            }
            ContentFM.Show();
        }
Ejemplo n.º 2
0
        public ActionResult PhonePurchase(IEnumerable <Guid> valueIds, int musicId, Guid categoryId)
        {
            var  res       = _permCatSrv.CheckPermissionCost(valueIds, musicId, categoryId);
            bool isSuccess = res.Success;

            if (res.Success && res.Entity.Cost == 0)
            {
                var purchase = new Purchase.Purchase();
                purchase.Customer       = User.GetUser();
                purchase.Music          = res.Entity.Music;
                purchase.PurchaseCost   = 0;
                purchase.PurchaseDate   = DateTime.Now;
                purchase.PurchaseStatus = Purchase.PurchaseStatus.NotPaidBycustomer;

                if (res.Entity.IsExistPermission)
                {
                    var addRes =
                        _permCatSrv.GetOrAdd(res.Entity.Permission.PropertyValues.Select(val => val.ID), categoryId);
                    isSuccess = addRes.Success;
                    if (isSuccess)
                    {
                        purchase.Permision = addRes.Entity;
                    }
                }
                else
                {
                    purchase.Permision = res.Entity.Permission;
                }

                if (isSuccess)
                {
                    isSuccess = _prchSrv.Add(purchase).Success;
                }
                if (isSuccess)
                {
                    var confirm = new Confirmation()
                    {
                        ConfirmType = ConfirmType.PhonePurchase,
                        EntityId    = purchase.PurchaseId,
                        Name        = purchase.Music.HebrewName,
                        DateUpdate  = DateTime.Now
                    };

                    isSuccess = _cnfrmSrv.Add(confirm).Success;
                }
            }

            return(Json(isSuccess));
        }