public string CheckInSave(CustomerCheckInOut model)
        {
            var userid = _httpContextAccessor.HttpContext.User.GetLoggedInUserId <string>();

            if (string.IsNullOrEmpty(userid))
            {
                throw new InvalidOperationException("User Not found");
            }

            if (GetReadyForNewCheckIn() != 0)
            {
                throw new InvalidOperationException("already exist data !! ");
            }

            CoreSQLConnection CoreSQL   = new CoreSQLConnection();
            ArrayList         arrayList = new ArrayList();

            var Query = "SELECT  cast(Isnull(MAX(LocationCustId),0) + 1 AS float)  AS BinId FROM tbl_Location_Customer";
            var NewId = CoreSQL.CoreSQL_GetDoubleData(Query);

            var sqlQuery = "Insert Into tbl_Location_Customer(LocationCustId,  CustType, CustId, CustName, LUserId, CheckInlatitude,CheckInlongitude, CheckInAddress, CheckInDescription)" +
                           " Values ('" + NewId + "','" + model.CustType + "','" + model.CustId + "', N'" + model.CustName.Replace("'", "`") + "','" + userid + "', '" + model.CheckInLatitude + "' ,'" + model.CheckInLongitude + "',  N'" + model.CheckInAddress.Replace("'", "`") + "', N'" + model.CheckInDescription.Replace("'", "`") + "')";

            arrayList.Add(sqlQuery);
            CoreSQL.CoreSQL_SaveDataUseSQLCommand(arrayList);
            return("Success");
        }
Beispiel #2
0
        public ActionResult Get(string searchdata = "")
        {
            CustomerCheckInOut _lQuery = new CustomerCheckInOut();
            var list = _lQuery.GetCustomer(searchdata.ToLower());

            if (list != null)
            {
                return(Ok(list));
            }
            else
            {
                return(BadRequest(searchdata));
            }
        }
Beispiel #3
0
 public IActionResult CheckIn([FromBody] CustomerCheckInOut model)
 {
     try
     {
         if (model != null)
         {
             _checkInQuery.CheckInSave(model);
             return(Ok());
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex) { return(BadRequest(ex.Message)); };
 }
Beispiel #4
0
 public string CheckOutUpdate(CustomerCheckInOut model)
 {
     try
     {
         CoreSQLConnection CoreSQL   = new CoreSQLConnection();
         ArrayList         arrayList = new ArrayList();
         if (model.CheckOutAddress == null)
         {
             model.CheckOutAddress = "";
         }
         var sqlQuery = "Update tbl_Location_Customer set CheckOutAddress = N'" + model.CheckOutAddress.Replace("'", "`") + "', CheckOutDescription = N'" + model.CheckOutDescription.Replace("'", "`") + "', CheckOutLatitude = '" + model.CheckOutLatitude + "', CheckOutLongitude = '" + model.CheckOutLongitude + "',  dtCheckOutEntry = getdate()  where LocationCustId = '" + model.LocationCustId + "'";
         arrayList.Add(sqlQuery);
         CoreSQL.CoreSQL_SaveDataUseSQLCommand(arrayList);
         return("Success");
     }
     catch (Exception ex) {
         throw (ex);
     }
 }