public MemberJuiceTransaction InsertJuiceTrans(MemberJuiceTransaction objJuiceTrans)
 {
     try
     {
         objJuiceTrans.isDeleted  = false;
         objJuiceTrans.insertDate = DateTime.Now;
         using (var context = new FitnessCenterEntities())
         {
             context.MemberJuiceTransactions.AddObject(objJuiceTrans);
             context.SaveChanges();
             return(objJuiceTrans);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public void InsertTrans()
 {
     try
     {
         foreach (var obj in lstJuiceTrans)
         {
             MemberJuiceTransaction objsale = new MemberJuiceTransaction();
             objsale.memberId    = obj.memberId;
             objsale.itemId      = obj.itemId;
             objsale.amount      = obj.amount;
             objsale.quantity    = obj.quantity;
             objsale.totalAmount = obj.totalAmount;
             new JuiceTransController().InsertJuiceTrans(objsale);
         }
         UpdateJuiceRecharge();
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Success','Items Sold Successfully')", true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public void InsertTempTrans()
        {
            try
            {
                var obj = lstJuiceTrans;
                MemberJuiceTransaction temp = new MemberJuiceTransaction();
                if (obj == null)
                {
                    obj = new List <MemberJuiceTransaction>();
                }
                ItemId = Convert.ToInt64(drpItems.SelectedValue);


                if (lstJuiceTrans != null && lstJuiceTrans.Count > 0)
                {
                    if (lstJuiceTrans.FirstOrDefault(x => x.isDeleted == false && x.itemId == ItemId) == null)
                    {
                        temp.itemId = ItemId;
                        ItemMaster objItem = ProductSalesController.GetItemsById(ItemId);
                        temp.ItemMaster = objItem;
                        temp.quantity   = Convert.ToInt32(txtQty.Text);
                        temp.amount     = Convert.ToDecimal(txtMRP.Text);
                        decimal total = 0;
                        total            = temp.quantity * temp.amount;
                        temp.totalAmount = total;
                        temp.memberId    = MemberId;
                        if (GetAvailableAmount() >= total)
                        {
                            obj.Add(temp);
                            lstJuiceTrans = obj;
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Sorry no More Balance Left. Delete some items or recharge')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','This Item is already Sold to this Member')", true);
                    }
                }
                else
                {
                    temp.itemId = ItemId;
                    ItemMaster objItem = ProductSalesController.GetItemsById(ItemId);
                    temp.ItemMaster = objItem;
                    temp.quantity   = Convert.ToInt32(txtQty.Text);
                    temp.amount     = Convert.ToDecimal(txtMRP.Text);
                    decimal total = 0;
                    total            = temp.quantity * temp.amount;
                    temp.totalAmount = total;
                    temp.memberId    = MemberId;
                    if (GetAvailableAmount() >= total)
                    {
                        obj.Add(temp);
                        lstJuiceTrans = obj;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Sorry no More Balance Left. Delete some items or recharge')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }