Ejemplo n.º 1
0
        public ActionResult AddRepairCheck(RepairCheck repairCheck)
        {
            var requestResult = inventoryLogic.AddRepairCheck(repairCheck);

            InvertoryViewModel            = new InvertoryViewModel();
            InvertoryViewModel.RepairUnit = new RepairUnit()
            {
                EndUserMessage = requestResult.EndUserMessage,
                Status         = requestResult.Status
            };
            return(View(InvertoryViewModel));
        }
Ejemplo n.º 2
0
        //public List<RepairUnit> RepairUnitList()
        //{

        //    string query = "SELECT * FROM Inventory";

        //    SqlCommand queryCommand = new SqlCommand(query, DBConnection);
        //    SqlDataReader queryCommandReader = queryCommand.ExecuteReader();
        //    List<InventoryModel> inventoryList = new List<InventoryModel>();
        //    if (queryCommandReader.HasRows)
        //    {
        //        while (queryCommandReader.Read())
        //        {
        //            inventoryList.Add(new InventoryModel()
        //            {
        //                Name = (string)queryCommandReader["Name"],
        //                InventoryId = Int32.Parse(queryCommandReader[0].ToString()),
        //                Address = (string)queryCommandReader["Address"],
        //                City = (string)queryCommandReader["City"],
        //                State = (string)queryCommandReader["State"],
        //                Foundation = (int)queryCommandReader["Foundation"],
        //                PhoneNumber = (string)queryCommandReader["PhoneNumber"],
        //                RepairCondition = (bool)queryCommandReader["RepairCondition"],
        //                Representation = (bool)queryCommandReader["Representation"],
        //            });
        //        }
        //    }
        //    DBConnection.Close();
        //    return inventoryList;
        //}
        public ResponseStatus AddRepairCheck(RepairCheck repairCheck)
        {
            string query = "INSERT INTO [dbo].[RepairCheck]([VisitDate],[SugesstionPrice],[InventoryRefId]" +
                           ")VALUES('" + repairCheck.VisitDate + "', '" + repairCheck.SugesstionPrice + "', '" + repairCheck.InventoryRefId + "')";
            SqlCommand queryCommand = new SqlCommand(query, DBConnection);

            queryCommand.ExecuteNonQuery();

            query = "UPDATE [dbo].[Inventory] SET [RepairCondition] = '"
                    + repairCheck.NeedRepair + "'WHERE ID = " + repairCheck.InventoryRefId;
            queryCommand = new SqlCommand(query, DBConnection);
            queryCommand.ExecuteNonQuery();

            DBConnection.Close();
            return(ResponseStatus.Success);
        }
Ejemplo n.º 3
0
 public BaseResponse AddRepairCheck(RepairCheck repairCheck)
 {
     try
     {
         return(new BaseResponse()
         {
             Status = inventoryRepository.AddRepairCheck(repairCheck),
             EndUserMessage = "با موفقیت اضافه شد"
         });
     }
     catch (Exception ex)
     {
         return(new BaseResponse()
         {
             Status = ResponseStatus.InternalError,
             EndUserMessage = "یک مشکل پیش آماده است"
         });
     }
 }