Example #1
0
        public ActionResult Detail(int?id, string msg, AlertMsgType?msgType)
        {
            TblPayment ob = uow.Modules.Payment.Get(id ?? 0);

            ob.StrCreatedDate = ob.CreatedDate.Day.ToString("00") + "/" + ob.CreatedDate.Month.ToString("00") + "/" + ob.CreatedDate.Year;
            ob.StrUpdatedDate = ob.UpdatedDate.Day.ToString("00") + "/" + ob.UpdatedDate.Month.ToString("00") + "/" + ob.UpdatedDate.Year;
            ob.StrPaymentDate = ob.PaymentDate.HasValue ? ob.PaymentDate.Value.Day.ToString("00") + "/" + ob.PaymentDate.Value.Month.ToString("00") + "/" + ob.PaymentDate.Value.Year : "";
            ob.StrPaySlipPath = ob.PaySlipPath;
            ob.Invoice        = uow.Modules.Invoice.Get(ob.InvoiceId.HasValue?ob.InvoiceId.Value:0);
            return(ViewDetail(ob, msg, msgType));
        }
Example #2
0
 public void Set(TblPayment ob)
 {
     if (ob.PaymentId == 0)
     {
         db.TblPayment.Add(ob);
     }
     else
     {
         db.Entry(ob).State = EntityState.Modified;
     }
 }
        public async Task <IActionResult> Create([Bind("AutoId,Id,PaymentDate,PartyName,Amount,PaymentMode,Remark,CreatedDatetime")] TblPayment tblPayment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblPayment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PartyName"] = new SelectList(_context.TblVendor, "Id", "Id", tblPayment.PartyName);
            return(View(tblPayment));
        }
Example #4
0
        public bool RequestedPayment(string Points, string PaymentType, Int64?userID)
        {
            TblPayment payment = new TblPayment();

            payment.PaymentMethod   = PaymentType == "1" ? "gift card" : "money";
            payment.RequestedDate   = DateTime.Now;
            payment.RequestedPoints = Convert.ToInt32(Points);
            payment.UserId          = userID;
            payment.Status          = PaymentStatus.Pending;
            _context.TblPayment.Add(payment);
            return(_context.SaveChanges() > 0 ? true : false);
        }
Example #5
0
        public bool SendPaymentRequest(Int64?uid, string PaymentType, Int32?RequestedPoint)
        {
            TblPayment payment = new TblPayment();

            payment.UserId          = uid;
            payment.RequestedDate   = DateTime.Now;
            payment.RequestedPoints = RequestedPoint;
            payment.PaymentMethod   = PaymentType;
            payment.Status          = PaymentStatus.Pending;
            _context.TblPayment.Add(payment);
            return(_context.SaveChanges() > 0 ? true : false);
        }
Example #6
0
        public TblPayment Update(TblPayment payment)
        {
            _context.Attach(payment);
            IEnumerable <EntityEntry> unchangedEntities = _context.ChangeTracker.Entries().Where(x => x.State == EntityState.Unchanged);

            foreach (EntityEntry ee in unchangedEntities)
            {
                ee.State = EntityState.Modified;
            }
            _context.SaveChanges();

            return(payment);
        }
Example #7
0
        public bool updatePaymentStatus(Int64?paymentId)
        {
            TblPayment oldPayment = _context.TblPayment.Where(i => i.Id == paymentId).FirstOrDefault();

            if (oldPayment != null)
            {
                TblUser user = _context.TblUser.Where(i => i.Id == oldPayment.UserId).FirstOrDefault();
                if (user != null)
                {
                    user.CurrentCreditPoints = user.CurrentCreditPoints - oldPayment.RequestedPoints;
                }

                oldPayment.Status       = PaymentStatus.Approved;
                oldPayment.ApprovedDate = DateTime.Now;
            }
            return(_context.SaveChanges() > 0 ? true : false);
        }
Example #8
0
        public bool SetPayment(TblPayment dto)
        {
            bool   result = false;
            string sql    = "sp_Payment";

            List <SqlParameter> paramList = new List <SqlParameter>();
            SqlParameter        pvNewId   = new SqlParameter("@PaymentId", SqlDbType.NVarChar, 50);

            pvNewId.Value     = dto.PaymentId;
            pvNewId.Direction = ParameterDirection.InputOutput;


            paramList.Add(pvNewId);

            //paramList.Add(new SqlParameter("@PaymentId", dto.PaymentId));
            paramList.Add(new SqlParameter("@PaymentNo", dto.PaymentNo));
            paramList.Add(new SqlParameter("@PaymentDate", dto.StrPaymentDate));
            paramList.Add(new SqlParameter("@InvoiceId", dto.InvoiceId));
            paramList.Add(new SqlParameter("@InvoiceNo", dto.InvoiceNo));
            paramList.Add(new SqlParameter("@CustomerId", dto.CustomerId));
            paramList.Add(new SqlParameter("@CustomerName", dto.CustomerName));
            paramList.Add(new SqlParameter("@PaymentAmount", dto.PaymentAmount));
            paramList.Add(new SqlParameter("@StatusId", dto.StatusId));
            paramList.Add(new SqlParameter("@BankPayFrom", dto.BankPayFrom));
            paramList.Add(new SqlParameter("@BankPayFromBranch", dto.BankPayFromBranch));
            paramList.Add(new SqlParameter("@AcctReceiveId", dto.AcctReceiveId));
            paramList.Add(new SqlParameter("@PaySlipPath", dto.PaySlipPath));
            paramList.Add(new SqlParameter("@UpdatedBy", dto.UpdatedBy));
            paramList.Add(new SqlParameter("@CreatedBy", dto.CreatedBy));
            paramList.Add(new SqlParameter("@ApprovedBy", dto.ApprovedBy));

            try
            {
                result        = webdb.ExcecuteWitTranNonQuery(sql, paramList);
                dto.PaymentId = Convert.ToInt32(pvNewId.Value.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("sp_Payment::" + ex.ToString());
            }
            finally
            { }
            return(result);
        }
Example #9
0
        private ActionResult ViewDetail(TblPayment ob, string msg, AlertMsgType?msgType)
        {
            try
            {
                if (ob == null)
                {
                    throw new Exception("ไม่พบข้อมูลที่ต้องการ, กรุณาลองใหม่อีกครั้ง");
                }

                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                AccountPermission permission = new AccountPermission();
                permission = GetPermissionSale(CurrentUser.AccountId, ob.CreatedBy);

                ViewData["optBankAccount"] = uow.Modules.BankAccount.GetList(1);
                CurrentUser.TblEmployee    = uow.Modules.Employee.GetEmployeeByAccount(CurrentUID);
                ViewData["userAccount"]    = CurrentUser;
                ViewData["optPermission"]  = permission;
                ViewData["optEmployee"]    = uow.Modules.Employee.Gets();
                return(View(ob));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", MVCController, new
                {
                    area = MVCArea,
                    msg = ex.GetMessage(),
                    msgType = AlertMsgType.Danger
                }));
            }
        }
Example #10
0
        public async Task <IActionResult> Create(paymentDto oPaymentDto)
        {
            if (!_repo.CheckUsageLimit(oPaymentDto))
            {
                oPaymentDto.Response = "Amount exceeds the Monthly Limit";
                return(Ok(oPaymentDto));
            }

            // INSERT
            if (oPaymentDto.TransactionId == null)
            {
                var payment = new TblPayment
                {
                    AccountId       = Convert.ToInt32(oPaymentDto.AccountId),
                    Amount          = Convert.ToDouble(oPaymentDto.Amount),
                    TransactionDate = DateTime.Now
                };

                var createdAccount = await _repo.Create(payment);

                return(Ok(createdAccount));
            }
            // UPDATE
            else
            {
                var payment = new TblPayment
                {
                    TransactionId   = Convert.ToInt32(oPaymentDto.TransactionId),
                    AccountId       = Convert.ToInt32(oPaymentDto.AccountId),
                    Amount          = Convert.ToDouble(oPaymentDto.Amount),
                    TransactionDate = DateTime.Now
                };
                var updatedUser = _repo.Update(payment);
                return(Ok(updatedUser));
            }
        }
Example #11
0
        public ActionResult SetDetail(TblPayment obj)
        {
            TblPayment old = uow.Modules.Payment.Get(obj.PaymentId);

            //string PaymentId = this.Request.Form["PaymentId"];
            if (obj.PaymentId < 1)
            {
                obj.PaymentNo   = getId("P");
                obj.CreatedDate = CurrentDate;
                obj.UpdatedDate = CurrentDate;
                obj.CreatedBy   = CurrentUID;
                obj.UpdatedBy   = CurrentUID;
                obj.StatusId    = 1;
            }
            else
            {
                obj.UpdatedDate = CurrentDate;
                obj.UpdatedBy   = CurrentUID;
                string StatusId  = this.Request.Form["StatusId"];
                string hdApprove = this.Request.Form["hdApprove"];
                if (hdApprove == "3")
                {
                    obj.StatusId = int.Parse(hdApprove);
                }
                else
                {
                    obj.StatusId = int.Parse(StatusId);
                }
            }
            if (this.Request.Form["InvoiceId"].ToString() != "")
            {
                string invoiceid = this.Request.Form["InvoiceId"];
                obj.InvoiceId = int.Parse(invoiceid);
                obj.InvoiceNo = this.Request.Form["InvoiceNo"];
            }

            string CustomerName = this.Request.Form["CustomerName"];

            obj.CustomerName = CustomerName;
            if (Request.Form["PaymentDate"].ToString().Count() > 0)
            {
                var dd = Request.Form["PaymentDate"].Split(' ')[0];

                obj.StrPaymentDate = dd;
            }
            var AcctReceiveId = Request.Form["radio_bankaccount"];

            if (AcctReceiveId != null)
            {
                obj.AcctReceiveId = int.Parse(AcctReceiveId);
            }

            obj.BankPayFrom       = this.Request.Form["BankPayFrom"];
            obj.BankPayFromBranch = this.Request.Form["BankPayFromBranch"];
            bool   clearOld       = false;
            string oldPaySlipPath = old.PaySlipPath;

            obj.StrPaySlipPath = oldPaySlipPath;
            obj.PaySlipPath    = oldPaySlipPath;
            if (Request.Files.Count > 0 && Request.Files["PaySlipPath"] != null && Request.Files["PaySlipPath"].ContentLength > 0)
            {
                HttpPostedFileBase uploadedFile = Request.Files["PaySlipPath"];
                string             FilePath     = string.Format("files/payment/{0}{1}", "P" + CurrentDate.ParseString(DateFormat._yyyyMMddHHmmssfff), Path.GetExtension(uploadedFile.FileName));
                if (!Directory.Exists(Server.MapPath("~/files")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/files"));
                }
                if (!Directory.Exists(Server.MapPath("~/files/payment")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/files/payment"));
                }
                uploadedFile.SaveAs(Server.MapPath("~/" + FilePath));

                obj.PaySlipPath = FilePath;
                clearOld        = true;
            }

            if (clearOld && !string.IsNullOrWhiteSpace(oldPaySlipPath) && IOFile.Exists(Server.MapPath("~/" + oldPaySlipPath)))
            {
                IOFile.Delete(Server.MapPath("~/" + oldPaySlipPath));
            }


            try
            {
                int invoicestatus = uow.Modules.Invoice.GetStatus(obj.InvoiceId.HasValue?obj.InvoiceId.Value:0);
                if (obj.StatusId == 3)
                {
                    if (invoicestatus == 3)
                    {
                        return(RedirectToAction("Detail", MVCController, new { id = obj.PaymentId, msg = "มีการชำระเงินไปแล้ว กรุณาเลือกใบแจ้งหนี้อื่น", msgType = AlertMsgType.Danger }));
                    }
                }
                uow.Modules.Payment.SetPayment(obj);
                //uow.Modules.Payment.Set(obj);
                //uow.SaveChanges();
            }
            catch (Exception ex)
            {
                string msg = ex.GetMessage(true);
                return(ViewDetail(obj, msg, AlertMsgType.Danger));
            }

            return(RedirectToAction("Detail", MVCController, new { id = obj.PaymentId, msg = "บันทึกข้อมูลเรียบร้อยแล้ว", msgType = AlertMsgType.Success }));


            //  return RedirectToAction("Detail", MVCController, new { id = 1, msg = "บันทึกข้อมูลเรียบร้อยแล้ว", msgType = AlertMsgType.Success });
        }
Example #12
0
        public ActionResult AddSales(string request)
        {
            //using (var transaction = _context.Database.BeginTransaction())
            //{
            TblSale tbl_Sale = JsonConvert.DeserializeObject <TblSale>(request);

            if (SalesItemStock.Count > 0)
            {
                var saved = false;

                try
                {
                    var t = JsonConvert.SerializeObject(tbl_Sale);

                    _context.TblSale.Add(tbl_Sale);
                    _context.SaveChanges();

                    SalesItemStock.ForEach(q => q.Item = null);

                    _context.TblItemStock.AddRange(SalesItemStock);
                    _context.SaveChanges();

                    TblSequence NewSequenceValue = GenericHelper.GetNextUpdatedData("tbl_Sale");
                    _context.Entry(NewSequenceValue).State = EntityState.Modified;
                    //_context.SaveChanges();

                    TblSequence NewSequenceValuetbl_SalesInvoice = GenericHelper.GetNextUpdatedData("tbl_SalesInvoice");
                    _context.Entry(NewSequenceValuetbl_SalesInvoice).State = EntityState.Modified;
                    //_context.SaveChanges();

                    TblSequence NewSequenceValueItemStock = GenericHelper.GetNextUpdatedData("tbl_ItemStock");
                    _context.Entry(NewSequenceValueItemStock).State = EntityState.Modified;
                    //_context.SaveChanges();
                    //_context.SaveChanges();

                    // 1 hold --  only save Sales & Item with status hold

                    // 2  CREDIT PURCHASE --  one transaction entry with Debit (In) with unpaid status

                    // 3  CASH PAY  -- one transaction entry with  Debit (In)/ Paid
                    //             one payment Entry with full amount
                    //             one transaction entry with credit (out) with payment ID

                    // 4 MULTI MODE PAY -- one transaction entry with Debit (In)
                    //             one payment Entry
                    //             one transaction entry with credit (out)

                    if (tbl_Sale.PaymentMode != null && tbl_Sale.PaymentMode.Value != PaymentMode.HOLD
                        ) // not hold
                    {
                        var amount    = tbl_Sale.Amount;
                        var creditTID = GenericHelper.GetMaxValue(SequenceTable.tbl_TransactionCredit);
                        var tbl_Transaction_Credit = new TblTransaction
                        {
                            Id = creditTID,

                            CreatedDatetime = tbl_Sale.CreatedDatetime,
                            EntryDate       = tbl_Sale.InvoiceDate.ToString(),

                            EntryType = TransactionEntryType.Sales
                                        .ToString(), //"Purchase", // Purchase/Sales/Recipt/Payment
                            Status = TransactionStatus
                                     .Unpaid,        //Paid/Unpaid/Pending/Paid Against entries : // Recive  Against entries
                            TransactionType =
                                TransactionType.Debit
                                .ToString(),     //Debit/ credit --  For Real: Debit what comes in, credit what goes out.
                            //TransactionRef = null,

                            EntryId = tbl_Sale.SaleId,
                            //PurchaseId = tbl_Sale.Id,
                            SalesId = tbl_Sale.SaleId,

                            Amount = tbl_Sale.GrandTotal,

                            VendorId = tbl_Sale.CustomerId
                        };
                        _context.TblTransaction.Add(tbl_Transaction_Credit);
                        //_context.SaveChanges();

                        var NewSequenceValueTbl_Transaction = GenericHelper.GetNextUpdatedData("tbl_TransactionCredit");
                        _context.Entry(NewSequenceValueTbl_Transaction).State = EntityState.Modified;

                        //_context.SaveChanges();
                        if (tbl_Sale.PaymentMode == 2) //CREDIT PURCHASE
                        {
                        }
                        else if (tbl_Sale.PaymentMode == 3) //CASH PAY
                        {
                            var tbl_PaymentID = GenericHelper.GetMaxValue("tbl_Payment");
                            var tbl_Payment   = new TblPayment
                            {
                                Id              = tbl_PaymentID,
                                Amount          = tbl_Sale.GrandTotal,
                                CreatedDatetime = tbl_Sale.CreatedDatetime,

                                PartyName   = tbl_Sale.SaleId,
                                PaymentDate = tbl_Sale.InvoiceDate.ToString(),
                                PaymentMode = "CASH"
                                              //Remark = "",
                                              //TransactionID = creditTID,
                            };
                            _context.TblPayment.Add(tbl_Payment);

                            var NewSequenceValueTbl_Payment = GenericHelper.GetNextUpdatedData("tbl_Payment");
                            _context.Entry(NewSequenceValueTbl_Payment).State = EntityState.Modified;
                            //_context.SaveChanges();

                            var tbl_TransactionDebit = new TblTransaction
                            {
                                Id = GenericHelper.GetMaxValue("tbl_TransactionDebit"),

                                CreatedDatetime = tbl_Sale.CreatedDatetime,
                                EntryDate       = tbl_Sale.InvoiceDate.ToString(),

                                EntryType = TransactionEntryType.Sales
                                            .ToString(), // "Purchase", // Purchase/Sales/Recipt/Payment
                                Status = TransactionStatus.PaidAgainstEntries +
                                         tbl_Sale
                                         .SaleId,     //Paid/Unpaid/Pending/Paid Against entries : // Recive  Against entries
                                TransactionType =
                                    TransactionType.Credit
                                    .ToString(),     //Debit/ credit --  For Real: Debit what comes in, credit what goes out.
                                TransactionRef = tbl_Sale.SaleId,

                                EntryId = tbl_PaymentID,
                                //PurchaseID = null,
                                //SalesID = null,
                                PaymentId = tbl_PaymentID,

                                Amount = tbl_Sale.GrandTotal,

                                VendorId = tbl_Sale.CustomerId
                            };
                            _context.TblTransaction.Add(tbl_TransactionDebit);

                            var NewSequenceValuetbl_Transaction2 =
                                GenericHelper.GetNextUpdatedData("tbl_TransactionDebit");
                            _context.Entry(NewSequenceValuetbl_Transaction2).State = EntityState.Modified;

                            //_context.SaveChanges();

                            //var tbl_Transaction result = _context.tbl_Transaction.Where(q => q.ID == creditTID).FirstOrDefault();
                            tbl_Transaction_Credit.Status = TransactionStatus.Paid;
                            //_context.Entry(tbl_Transactionresult).State = EntityState.Modified;
                            //_context.SaveChanges();
                        }
                        else if (tbl_Sale.PaymentMode == 4) //MULTI MODE PAY
                        {
                            var tbl_PaymentID = GenericHelper.GetMaxValue("tbl_Payment");
                            var tbl_Payment   = new TblPayment
                            {
                                Id              = tbl_PaymentID,
                                Amount          = amount,
                                CreatedDatetime = tbl_Sale.CreatedDatetime,

                                PartyName   = tbl_Sale.CustomerId,
                                PaymentDate = tbl_Sale.InvoiceDate.ToString(),
                                PaymentMode = "CASH"
                                              //Remark = "",
                                              //TransactionID = creditTID,
                            };
                            _context.TblPayment.Add(tbl_Payment);

                            var NewSequenceValueTbl_Payment = GenericHelper.GetNextUpdatedData("tbl_Payment");
                            _context.Entry(NewSequenceValueTbl_Payment).State = EntityState.Modified;
                            //_context.SaveChanges();

                            var tbl_TransactionDebit = new TblTransaction
                            {
                                Id = GenericHelper.GetMaxValue("tbl_TransactionDebit"),

                                CreatedDatetime = tbl_Sale.CreatedDatetime,
                                EntryDate       = tbl_Sale.InvoiceDate.ToString(),

                                EntryType = TransactionEntryType.Purchase
                                            .ToString(), // "Purchase", // Purchase/Sales/Recipt/Payment
                                Status = TransactionStatus.PaidAgainstEntries +
                                         tbl_Sale
                                         .SaleId,     //Paid/Unpaid/Pending/Paid Against entries : // Recive  Against entries
                                TransactionType =
                                    TransactionType.Debit
                                    .ToString(),     //Debit/ credit --  For Real: Debit what comes in, credit what goes out.
                                TransactionRef = tbl_Sale.SaleId,

                                EntryId = tbl_PaymentID,
                                //PurchaseID = null,
                                //SalesID = null,
                                PaymentId = tbl_PaymentID,

                                Amount = amount,

                                VendorId = tbl_Sale.CustomerId
                            };
                            _context.TblTransaction.Add(tbl_TransactionDebit);

                            var NewSequenceValueTbl_Transaction2 =
                                GenericHelper.GetNextUpdatedData("tbl_TransactionDebit");
                            _context.Entry(NewSequenceValueTbl_Transaction2).State = EntityState.Modified;
                        }
                    }


                    _context.SaveChanges();
                    saved = true;
                }
                catch (Exception e)
                {
                    throw new InvalidOperationException(e.Message);
                }
                finally
                {
                    //if (saved) transaction.Commit();
                }

                //if (tbl_Sale.PaymentMode == 4)  //MULTI MODE PAY
                //    return JavaScript("window.location = '/Purchases/index'");
                //else



                //return RedirectToAction("Index");
                return(Content("window.location = '/Sale/index'"));
            }
            else
            {
                ViewBag.CustomerID = new SelectList(_context.TblVendor, "ID", "Name", tbl_Sale.CustomerId);
                throw new InvalidOperationException("Please add item to continue!!");
            }

            //return RedirectToAction("Index");
            //}
        }
Example #13
0
        public void Insert(long? PatientID,long? RegID,DateTime? PaymentDate,decimal? TotalPayment,short? ReasonID,string SUser,string SDesc)
        {
            TblPayment item = new TblPayment();

            item.PatientID = PatientID;

            item.RegID = RegID;

            item.PaymentDate = PaymentDate;

            item.TotalPayment = TotalPayment;

            item.ReasonID = ReasonID;

            item.SUser = SUser;

            item.SDesc = SDesc;

            item.Save(UserName);
        }
        public int AddPaymentData(Model.Common.Payment PaymentModel, string PaymentNo)
        {
            List <Payment> Items    = new List <Payment>();
            List <Invoice> InvItems = new List <Invoice>();

            int returnVal = 0;

            try
            {
                using (var dBContext = new CustomerReportContext())
                {
                    Model.Common.Payment get;
                    foreach (var it in dBContext.TblPayment)
                    {
                        get               = new Model.Common.Payment();
                        get.PaymentNo     = it.PaymentNo;
                        get.InvoiceNo     = it.InvoiceNo;
                        get.PaymentDate   = it.PaymentDate;
                        get.PaymentAmount = it.PaymentAmount;
                        Items.Add(get);
                    }

                    TblPayment Cust;
                    //Add record
                    Cust               = new TblPayment();
                    Cust.PaymentNo     = PaymentModel.PaymentNo;
                    Cust.InvoiceNo     = PaymentModel.InvoiceNo;
                    Cust.PaymentDate   = PaymentModel.PaymentDate;
                    Cust.PaymentAmount = PaymentModel.PaymentAmount;
                    dBContext.TblPayment.Add(Cust);
                    PaymentNo = Cust.PaymentNo;

                    bool Invoicexist = Items.Any(asd => asd.PaymentNo == PaymentNo);
                    if (Invoicexist == true)
                    {
                        returnVal = -1;
                    }
                    else
                    {
                        returnVal = dBContext.SaveChanges();
                    }

                    //using (var ddBContext = new CustomerReportContext())
                    //{
                    //    Model.Common.Invoice Inv = new Model.Common.Invoice();
                    //    foreach (var iit in ddBContext.TblInvoices)
                    //    {

                    //        Inv.InvoiceNo = iit.InvoiceNo;
                    //        Inv.InvoiceAmount = iit.InvoiceAmount;
                    //        Inv.InvoiceDate = iit.InvoiceDate;
                    //        Inv.PaymentDueDate = iit.PaymentDueDate;
                    //        InvItems.Add(Inv);
                    //    }

                    //    bool InvoicAmount = Items.Any(asd => asd.PaymentAmount > Inv.InvoiceAmount);
                    //    if (InvoicAmount == true)
                    //    {
                    //        returnVal = -2;
                    //    }
                    //}

                    //returnVal = dBContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(returnVal);
        }