public int Cancel(ViewReplaceModel replaceModel, int userId)
 {
     try
     {
         CommandObj.CommandText = "UDSP_CancelReplaceEntry";
         CommandObj.CommandType = CommandType.StoredProcedure;
         CommandObj.Parameters.Clear();
         CommandObj.Parameters.AddWithValue("@UserId", userId);
         CommandObj.Parameters.AddWithValue("@Remarks", replaceModel.CancelRemarks);
         CommandObj.Parameters.AddWithValue("@ReceiveId", replaceModel.ReceiveId);
         CommandObj.Parameters.Add("@RowAffected", SqlDbType.Int);
         CommandObj.Parameters["@RowAffected"].Direction = ParameterDirection.Output;
         ConnectionObj.Open();
         CommandObj.ExecuteNonQuery();
         var rowAffected = Convert.ToInt32(CommandObj.Parameters["@RowAffected"].Value);
         return(rowAffected);
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         throw new Exception("Could not cancel the replace entry by id", exception);
     }
     finally
     {
         ConnectionObj.Close();
         CommandObj.Dispose();
         CommandObj.Parameters.Clear();
     }
 }
Ejemplo n.º 2
0
 public ActionResult Delivery(long id)
 {
     try
     {
         ViewReplaceModel model = new ViewReplaceModel();
         int branchId           = Convert.ToInt32(Session["BranchId"]);
         int companyId          = Convert.ToInt32(Session["CompanyId"]);
         var stock    = _iInventoryManager.GetStockProductInBranchByBranchAndCompanyId(branchId, companyId);
         var received = _iServiceManager.GetDeliverableServiceProductById(id);
         Session["Branch_stock"] = stock;
         var client   = _iClientManager.GetById(received.ClientId);
         var products = new List <ViewReplaceDetailsModel>
         {
             new ViewReplaceDetailsModel
             {
                 ExpiryDate  = received.ExpiryDate,
                 ProductId   = received.ProductId,
                 ProductName = received.ProductName,
                 Quantity    = 1
             }
         };
         model.ClientCode    = client.SubSubSubAccountCode;
         model.ClientName    = client.ClientName;
         model.ClientAddress = client.Address;
         model.Products      = products;
         model.ReceiveId     = id;
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
 public int ChangeReplaceProuctType(ViewReplaceModel model)
 {
     try
     {
         CommandObj.CommandText = "UDSP_ChangeReplaceProuctType";
         CommandObj.CommandType = CommandType.StoredProcedure;
         CommandObj.Parameters.AddWithValue("@ReceiveId", model.ReceiveId);
         CommandObj.Parameters.AddWithValue("@ProductId", model.ProductId);
         CommandObj.Parameters.AddWithValue("@NewProductId", model.NewProductId);
         CommandObj.Parameters.AddWithValue("@Remarks", model.Remarks);
         CommandObj.Parameters.Add("@RowAffected", SqlDbType.Int);
         CommandObj.Parameters["@RowAffected"].Direction = ParameterDirection.Output;
         ConnectionObj.Open();
         CommandObj.ExecuteNonQuery();
         var rowAffected = Convert.ToInt32(CommandObj.Parameters["@RowAffected"].Value);
         return(rowAffected);
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         throw new Exception("Could not update replace product..", exception);
     }
     finally
     {
         CommandObj.Dispose();
         ConnectionObj.Close();
         CommandObj.Parameters.Clear();
     }
 }
 public ActionResult UpdateCliaimedBatteryDeliveryStatus(long id, FormCollection collection)
 {
     try
     {
         var  product      = _iServiceManager.GetReceivedServiceProductById(id);
         var  deliveryDate = Convert.ToDateTime(collection["DeliveryDate"]);
         bool result       = _iServiceManager.UpdateCliaimedBatteryDeliveryStatus(id, deliveryDate);
         if (result)
         {
             if (product.ForwardedToId == 5)
             {
                 return(RedirectToAction("ReturnList"));
             }
             return(RedirectToAction("CharegReturnList"));
         }
         ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(id);
         List <ViewReplaceDetailsModel> products = _iProductReplaceManager.GetReplaceProductListById(id).ToList();
         model.Products = products;
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
Ejemplo n.º 5
0
        public ActionResult PrintChallan(long id)
        {
            ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(id);
            List <ViewReplaceDetailsModel> products = _iProductReplaceManager.GetReplaceProductListById(id).ToList();

            model.Products = products;
            return(View(model));
        }
 public ActionResult ChangeProuctType(long id)
 {
     try
     {
         ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(id);
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
 public ViewReplaceModel GetReplaceById(long id)
 {
     try
     {
         ViewReplaceModel model = null;
         CommandObj.CommandText = "UDSP_GetReplaceById";
         CommandObj.CommandType = CommandType.StoredProcedure;
         CommandObj.Parameters.AddWithValue("@ReceiveId", id);
         ConnectionObj.Open();
         SqlDataReader reader = CommandObj.ExecuteReader();
         if (reader.Read())
         {
             model = new ViewReplaceModel
             {
                 ReceiveId         = id,
                 ClientCode        = reader["ClientCode"].ToString(),
                 ClientId          = Convert.ToInt32(reader["ClientId"]),
                 ClientName        = reader["ClientName"].ToString(),
                 ClientAddress     = reader["ClientAddress"].ToString(),
                 EntryDate         = Convert.ToDateTime(reader["SysDateTime"]),
                 ReceiveRef        = reader["ReceiveRef"].ToString(),
                 BranchId          = Convert.ToInt32(reader["ReceiveByBranchId"]),
                 CompanyId         = Convert.ToInt32(reader["CompanyId"]),
                 UserId            = Convert.ToInt32(reader["EntryByUserId"]),
                 ReplaceForBarcode = reader["BarcodeNo"].ToString(),
                 ProductName       = reader["ProductName"].ToString(),
                 ProductId         = Convert.ToInt32(reader["ProductId"]),
                 Remarks           = reader["ReceiveReport"].ToString(),
                 SaleDate          = DBNull.Value.Equals(reader["SaleDate"]) ? (DateTime?)null:Convert.ToDateTime(reader["SaleDate"]),
                 ExpiryDate        = DBNull.Value.Equals(reader["ExpiryDate"]) ? (DateTime?)null : Convert.ToDateTime(reader["ExpiryDate"]),
                 RbdDate           = DBNull.Value.Equals(reader["RbdDate"]) ? (DateTime?)null:Convert.ToDateTime(reader["RbdDate"]),
                 RbdBarcode        = DBNull.Value.Equals(reader["RbdBarcode"]) ? null:reader["RbdBarcode"].ToString(),
                 RbdRemarks        = DBNull.Value.Equals(reader["RbdRemarks"]) ?null:reader["RbdRemarks"].ToString(),
                 DistributionPoint = DBNull.Value.Equals(reader["DistributionPoint"]) ? null : reader["DistributionPoint"].ToString(),
             };
         }
         reader.Close();
         return(model);
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         throw new Exception("Could not collect Replace by Id", exception);
     }
     finally
     {
         CommandObj.Dispose();
         ConnectionObj.Close();
         CommandObj.Parameters.Clear();
     }
 }
 public ActionResult UpdateCliaimedBatteryDeliveryStatus(long id)
 {
     try
     {
         ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(id);
         List <ViewReplaceDetailsModel> products = _iProductReplaceManager.GetReplaceProductListById(id).ToList();
         model.Products = products;
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
Ejemplo n.º 9
0
 public ActionResult Delivery(long id)
 {
     try
     {
         var stock = _iInventoryManager.GetStockProductInFactory();
         Session["Factory_stock12"] = stock;
         ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(id);
         List <ViewReplaceDetailsModel> products = _iProductReplaceManager.GetReplaceProductListById(id).ToList();
         model.Products = products;
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
 public ActionResult ChangeProuctType(long id, ViewReplaceModel model)
 {
     try
     {
         model.ReceiveId = id;
         bool result = _iProductReplaceManager.ChangeReplaceProuctType(model);
         if (result)
         {
             return(RedirectToAction("ReplaceList", "WarrantyBattery"));
         }
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
 public ActionResult Edit(long id, ViewReplaceModel model)
 {
     try
     {
         model.ReceiveId = id;
         bool result = _iProductReplaceManager.EditReplaceEntry(model);
         if (result)
         {
             return(RedirectToAction("ViewAll"));
         }
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
Ejemplo n.º 12
0
 public ActionResult WarrantyDelivery(long id)
 {
     try
     {
         int branchId  = Convert.ToInt32(Session["BranchId"]);
         int companyId = Convert.ToInt32(Session["CompanyId"]);
         var stock     = _iInventoryManager.GetStockProductInBranchByBranchAndCompanyId(branchId, companyId);
         Session["Branch_stock"] = stock;
         ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(id);
         List <ViewReplaceDetailsModel> products = _iProductReplaceManager.GetReplaceProductListById(id).ToList();
         model.Products = products;
         return(View(model));
     }
     catch (Exception exception)
     {
         Log.WriteErrorLog(exception);
         return(PartialView("_ErrorPartial", exception));
     }
 }
        public ActionResult Cancel(ViewReplaceModel replaceModel)
        {
            try
            {
                ViewReplaceModel model = _iProductReplaceManager.GetReplaceById(replaceModel.ReceiveId);
                var user = (ViewUser)Session["user"];

                int rowAffected = _iProductReplaceManager.Cancel(replaceModel, user.UserId);
                if (rowAffected > 0)
                {
                    return(RedirectToAction("ViewAll"));
                }
                List <ViewReplaceDetailsModel> products = _iProductReplaceManager.GetReplaceProductListById(replaceModel.ReplaceId).ToList();
                model.Products = products;
                return(View(model));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }
Ejemplo n.º 14
0
        //-----------------------Replace---------------------
        public string SaveReplaceDeliveryInfo(List <ScannedProduct> scannedProducts, Delivery aDelivery, int replaceStatus, ViewReplaceModel replaceModel)
        {
            string refCode = _iCommonGateway.GetAllSubReferenceAccounts().ToList().Find(n => n.Id == Convert.ToInt32(ReferenceType.Distribution)).Code;

            aDelivery.VoucherNo = GetMaxVoucherNoByTransactionInfix(refCode);
            int maxRefNo = _iInventoryGateway.GetMaxDeliveryRefNoOfCurrentYear();

            aDelivery.DeliveryRef = GenerateDeliveryReference(maxRefNo);
            int rowAffected = _iInventoryGateway.SaveReplaceDeliveryInfo(scannedProducts, aDelivery, replaceStatus, replaceModel);

            return(rowAffected > 0 ? "Saved Successfully!" : "Failed to Save");
        }
 public int Cancel(ViewReplaceModel replaceModel, int userId)
 {
     return(_iProductReplaceGateway.Cancel(replaceModel, userId));
 }
        public bool ChangeReplaceProuctType(ViewReplaceModel model)
        {
            int rowAffected = _iProductReplaceGateway.ChangeReplaceProuctType(model);

            return(rowAffected > 0);
        }
        public bool EditReplaceEntry(ViewReplaceModel model)
        {
            int rowAffected = _iProductReplaceGateway.EditReplaceEntry(model);

            return(rowAffected > 0);
        }