Пример #1
0
        public ActionResult Settle(SupplyOrderPreviousList model)
        {
            model.SettledDate = System.DateTime.Now;
            model.SettledBy   = UserID.ToString();
            try
            {
                string id = new SupplyOrderRepository().SOSettlement(model);

                TempData["success"] = "Settled successfully. Supply Order LPO.No. is " + id;
                TempData["error"]   = "";
                return(RedirectToAction("PendingSOSettle"));
            }

            catch (SqlException sx)
            {
                TempData["error"] = "Some error occured while connecting to database. Please check your network connection and try again.|" + sx.Message;
            }
            catch (NullReferenceException nx)
            {
                TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message;
            }
            catch (Exception ex)
            {
                TempData["error"] = "Some error occured. Please try again.|" + ex.Message;
            }
            return(View("Settle", model.SupplyOrderItemId));
        }
Пример #2
0
 public string SOSettlement(SupplyOrderPreviousList objSupplyOrder)
 {
     using (IDbConnection connection = OpenConnection(dataConnection))
     {
         string sql = @" UPDATE SupplyOrderItem SET SettledQty = @BalanceQuantity,SettledReason=@SettledReason,
                         SettledDate=@SettledDate,SettledBy=@SettledBy   
                         WHERE SupplyOrderItemId = @SupplyOrderItemId;";
         var    id  = connection.Execute(sql, objSupplyOrder);
         //InsertLoginHistory(dataConnection, objSupplyOrder.CreatedBy, "Update", "LPO", id.ToString(), "0");
         return(objSupplyOrder.SupplyOrderNo);
     }
 }
Пример #3
0
        public ActionResult Settle(int id = 0)
        {
            try
            {
                if (id != 0)
                {
                    SupplyOrderPreviousList supplyorder = new SupplyOrderPreviousList();
                    supplyorder = new SupplyOrderRepository().GetSOSettlement(id);
                    FillDropdowns();
                    return(View(supplyorder));
                }
                else
                {
                    TempData["error"]   = "That was an invalid/unknown request. Please try again.";
                    TempData["success"] = "";
                }
            }
            catch (InvalidOperationException iox)
            {
                TempData["error"] = "Sorry, we could not find the requested item. Please try again.|" + iox.Message;
            }
            catch (SqlException sx)
            {
                TempData["error"] = "Some error occured while connecting to database. Please try again after sometime.|" + sx.Message;
            }
            catch (NullReferenceException nx)
            {
                TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message;
            }
            catch (Exception ex)
            {
                TempData["error"] = "Some error occured. Please try again.|" + ex.Message;
            }

            TempData["success"] = "";
            return(RedirectToAction("PendingSOSettle"));
        }