public HttpResponseMessage CompleteConsignment(ConsignmentDetail objConsignmentDetail) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[2]; int iParamCount = 0; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "UPDATELOADSTATUS"; iParamCount++; objParam[iParamCount].sParamName = "@vFilterClause"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = Convert.ToString(objConsignmentDetail.CId); iParamCount++; sQuery = "ProcGetOfferConsignment"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "Consignment Completed Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
/// Function Name : Reject Bid Details /// Parameter Details /// 1. BidDetail DTO /// /// Functionality /// This function accept Bid details DTO and mark the bid as rejected based on the Bid ID /// public HttpResponseMessage RejectBid(BidDetail objBidDetail) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[2]; int iParamCount = 0; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "REJECTBID"; iParamCount++; objParam[iParamCount].sParamName = "@bid"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.BidID); iParamCount++; sQuery = ProcBidOperation_Bid; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "Bid Rejected Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
public HttpResponseMessage ValidateOTP(UserLogin objUserOTP) { #region Declaration string sRetVal = ""; DataTable dt = null; #endregion try { if (long.Equals(objUserOTP.lMobileNo, null) || objUserOTP.lMobileNo.Equals("")) { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Mobile Number can't be blank")); } DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); DBOperation.StructDBOperation[] structDBOperation = new DBOperation.StructDBOperation[3]; structDBOperation[0].sParamName = "@vQueryType"; structDBOperation[0].sParamType = SqlDbType.VarChar; structDBOperation[0].sParamValue = "GETUSEROTPDETAILS"; structDBOperation[1].sParamName = "@iMobileNo"; structDBOperation[1].sParamType = SqlDbType.BigInt; structDBOperation[1].sParamValue = Convert.ToString(objUserOTP.lMobileNo); structDBOperation[2].sParamName = "@iMobileOTP"; structDBOperation[2].sParamType = SqlDbType.Int; structDBOperation[2].sParamValue = Convert.ToString(objUserOTP.iUserOTP); sRetVal = DBOperation.ExecuteDBOperation("ProcUserLogin", DBOperation.OperationType.STOREDPROC, structDBOperation, ref dt); if (sRetVal == "SUCCESS") { //Logs.StoreActivityLogsInDB(LogType.Login, GlobalData.iUserID, "Logged in successfully.", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name); if (dt != null && dt.Rows.Count > 0) { return(Request.CreateResponse(HttpStatusCode.OK, "Mobile No Verified Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Mobile OTP doesn't match.")); } } return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + ex.Message)); } }
public string ValidateUser(string sUserName, string sPassword) { //string strQuery = ""; string sRetVal = ""; DataTable dt = null; try { DBOperation.StructDBOperation[] structDBOperation = new DBOperation.StructDBOperation[2]; structDBOperation[0].sParamName = "@vQueryType"; structDBOperation[0].sParamType = SqlDbType.VarChar; structDBOperation[0].sParamValue = "GETUSERDETAILS"; structDBOperation[1].sParamName = "@vUserName"; structDBOperation[1].sParamType = SqlDbType.VarChar; structDBOperation[1].sParamValue = sUserName; sRetVal = DBOperation.ExecuteDBOperation("ProcGetUserInfo", DBOperation.OperationType.STOREDPROC, structDBOperation, ref dt); if (sRetVal == "SUCCESS") { if (dt != null && dt.Rows.Count > 0) { if (Convert.ToString(dt.Rows[0]["Password"]) != sPassword) { return("Invalid Username or password."); } return("SUCCESS"); } else { return("Invalid Username or password."); } } return(sRetVal); } catch (Exception ex) { return(ex.Message); } }
public HttpResponseMessage UpdateConsignment(ConsignmentDetail objConsignmentDetail) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[11]; int iParamCount = 0; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "UPDATELOAD"; iParamCount++; objParam[iParamCount].sParamName = "@iLoadId"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = Convert.ToString(objConsignmentDetail.CId); iParamCount++; objParam[iParamCount].sParamName = "@iUserId"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = Convert.ToString(objConsignmentDetail.UserID); iParamCount++; objParam[iParamCount].sParamName = "@vDepartureCity"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objConsignmentDetail.DepartureCity; iParamCount++; objParam[iParamCount].sParamName = "@vDestinationCity"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objConsignmentDetail.DestinationCity; iParamCount++; objParam[iParamCount].sParamName = "@dStartDate"; objParam[iParamCount].sParamType = SqlDbType.DateTime; objParam[iParamCount].sParamValue = objConsignmentDetail.CStartDate.ToString("MM-dd-yyyy hh:mm:ss");; iParamCount++; objParam[iParamCount].sParamName = "@vMaterial"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objConsignmentDetail.Cmaterial; iParamCount++; objParam[iParamCount].sParamName = "@fApproximateWeight"; objParam[iParamCount].sParamType = SqlDbType.Float; objParam[iParamCount].sParamValue = Convert.ToString(objConsignmentDetail.ApproximateWeight); iParamCount++; objParam[iParamCount].sParamName = "@dApproximateBudget"; objParam[iParamCount].sParamType = SqlDbType.Float; objParam[iParamCount].sParamValue = Convert.ToString(objConsignmentDetail.ApproximateBudget); iParamCount++; objParam[iParamCount].sParamName = "@bLoading"; objParam[iParamCount].sParamType = SqlDbType.Bit; objParam[iParamCount].sParamValue = objConsignmentDetail.Loading ? "1" : "0"; iParamCount++; objParam[iParamCount].sParamName = "@bUnLoading"; objParam[iParamCount].sParamType = SqlDbType.Bit; objParam[iParamCount].sParamValue = objConsignmentDetail.UnLoading ? "1" : "0"; iParamCount++; sQuery = "ProcOfferConsignment"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "Consignment Updated Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
public HttpResponseMessage GetConsignmentDetail(ConsignmentDetail objConsignmentDetail) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[2]; int iParamCount = 0; string sFilter = ""; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); #region Prepare Query Filter if (objConsignmentDetail.CId > 0) { sFilter += " AND load_id=" + objConsignmentDetail.CId; } if (objConsignmentDetail.UserID > 0) { sFilter += " AND user_id=" + objConsignmentDetail.UserID; } if (!string.IsNullOrEmpty(objConsignmentDetail.DepartureCity)) { sFilter += " AND load_departure_city=" + "'" + objConsignmentDetail.DepartureCity + "'"; } if (!string.IsNullOrEmpty(objConsignmentDetail.DestinationCity)) { sFilter += " AND load_destination_city=" + "'" + objConsignmentDetail.DestinationCity + "'"; } if (objConsignmentDetail.CStartDate > DateTime.MinValue) { sFilter += " AND load_departure_city>=" + "'" + objConsignmentDetail.CStartDate + "'"; } if (sFilter.Length > 4) { sFilter = "Where " + sFilter.Substring(4); } else { sFilter = null; } #endregion objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "GETCONSIGNMENTDETAIL"; iParamCount++; objParam[iParamCount].sParamName = "@vFilterClause"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = sFilter; iParamCount++; sQuery = "ProcGetOfferConsignment"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, dt)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
//***************************************** Place Bid ************************************************** // PlaceBid : Place the bid for a specific consignment * // GetBidDetail : Get the bid detail on the basis of different filter Crieteria * // UpdateBid : Update Bid Details. Only Bid amount can modify * // DeleteBid : Delete bid on the basis of bid ID * // //******************************************************************************************************* /// Function Name : Place Bid /// Parameter Details /// 1. BidDetail DTO /// /// Functionality /// This function accept Bid details DTO and store into DB /// Value of Load ID, User ID, Amount is mandatory public HttpResponseMessage PlaceBid(BidDetail objBidDetail) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[9]; int iParamCount = 0; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "PLACEBID"; iParamCount++; objParam[iParamCount].sParamName = "@bid"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "0"; iParamCount++; objParam[iParamCount].sParamName = "@cid"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.CId); iParamCount++; objParam[iParamCount].sParamName = "@bidamount"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.BidAmount); iParamCount++; objParam[iParamCount].sParamName = "@userid"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.UserID); iParamCount++; objParam[iParamCount].sParamName = "@viewed"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objBidDetail.Viewed; iParamCount++; objParam[iParamCount].sParamName = "@status"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.Status); iParamCount++; objParam[iParamCount].sParamName = "@creationdatetime"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.CreationDateTime.ToString("dd-MM-yyyy")); iParamCount++; objParam[iParamCount].sParamName = "@BidUpdateDateTime"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.BidUpdateDateTime.ToString("dd-MM-yyyy"));; iParamCount++; sQuery = "ProcBidOperation"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "Bid Placed Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
public HttpResponseMessage GetBidDetail(BidDetail objBidDetail) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[2]; int iParamCount = 0; string sFilter = ""; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); #region Prepare Query Filter if (objBidDetail.BidID > 0) { sFilter += " AND bid_id=" + objBidDetail.BidID; } if (objBidDetail.CId > 0) { sFilter += " AND load_id=" + objBidDetail.CId; } if (objBidDetail.BidAmount > 0) { sFilter += " AND Bid_Amount=" + objBidDetail.BidAmount; } if (objBidDetail.UserID > 0) { sFilter += " AND User_ID=" + objBidDetail.UserID; } if (!string.IsNullOrEmpty(objBidDetail.Viewed)) { sFilter += " AND Viewed=" + objBidDetail.Viewed; } if (sFilter.Length > 4) { sFilter = "Where " + sFilter.Substring(4); } #endregion objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "CONSIGNMENTDETAIL"; iParamCount++; objParam[iParamCount].sParamName = "@vFilterClause"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = sFilter; iParamCount++; sQuery = "ProcGetBidDetail"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, dt)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
//***************************************** User Login ************************************************** // UserLogin : Login/Signup user with mobile number * // ValidateOTP : Validate register mobile number with OTP * // UpdateUserPreference : Update user preference of user i.e. Company Owner/ Fleet Owner * // * //******************************************************************************************************* public HttpResponseMessage UserLogin(UserLogin objUserLogin) { try { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[3]; int iParamCount = 0; string sMobile_OTP = ""; #endregion #region validation if (long.Equals(objUserLogin.lMobileNo, null) || objUserLogin.lMobileNo.Equals("")) { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Mobile Number can't be blank")); } #endregion #region DataBase Entry and Response if ((objUserLogin.lMobileNo != 0)) { r = new Random(); sMobile_OTP = r.Next().ToString(); sMobile_OTP = sMobile_OTP.PadLeft(6, '0'); sMobile_OTP = sMobile_OTP.Substring(0, 6); sendSMS(objUserLogin.lMobileNo, "Your OTP for " + GlobalClass.sCompanyName + " is " + sMobile_OTP); } objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "USERLOGIN"; iParamCount++; objParam[iParamCount].sParamName = "@iMobileNo"; objParam[iParamCount].sParamType = SqlDbType.BigInt; objParam[iParamCount].sParamValue = Convert.ToString(objUserLogin.lMobileNo); iParamCount++; objParam[iParamCount].sParamName = "@iMobileOTP"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = sMobile_OTP; iParamCount++; sQuery = "ProcUserLogin"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "SUCCESS")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } #endregion } catch (Exception e1) { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + e1.Message)); } }
//***************************************** User Info ************************************************** // UserInfo : Insert User Info * // ValidateOTP : Validate register mobile number with OTP * // UpdateUserPreference : Update user preference of user i.e. Company Owner/ Fleet Owner * // * //******************************************************************************************************* public HttpResponseMessage UpdateUserInfo(UserInfo objUserInfo) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); int iParamCount = 0; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[8]; objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "USERINFO"; iParamCount++; objParam[iParamCount].sParamName = "@iuser_id"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = Convert.ToString(objUserInfo.iUserId); iParamCount++; objParam[iParamCount].sParamName = "@vuser_name"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objUserInfo.sUser_Name; iParamCount++; objParam[iParamCount].sParamName = "@vuser_email_id"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objUserInfo.sEmailID; iParamCount++; objParam[iParamCount].sParamName = "@vuser_address"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objUserInfo.sUser_Address; iParamCount++; objParam[iParamCount].sParamName = "@iuser_zip"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = Convert.ToString(objUserInfo.sUser_Zip); iParamCount++; objParam[iParamCount].sParamName = "@vuser_gst_pan"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objUserInfo.sUser_Gst_Pan; iParamCount++; objParam[iParamCount].sParamName = "@vuser_company_name"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = objUserInfo.sCompany_Name; iParamCount++; sQuery = "ProcUserInfo"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "User Info Updated Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
public HttpResponseMessage UpdateUserPreference(UserLogin objUserLogin) { try { #region declaration DataTable dt = new DataTable(); Random r = new Random(); DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[3]; int iParamCount = 0; #endregion #region validation if (long.Equals(objUserLogin.lMobileNo, null) || objUserLogin.lMobileNo.Equals("")) { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Mobile Number can't be blank")); } #endregion #region DataBase Entry and Response objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "UPDATEPREFERENCE"; iParamCount++; objParam[iParamCount].sParamName = "@iMobileNo"; objParam[iParamCount].sParamType = SqlDbType.BigInt; objParam[iParamCount].sParamValue = Convert.ToString(objUserLogin.lMobileNo); iParamCount++; objParam[iParamCount].sParamName = "@iUserPreference"; objParam[iParamCount].sParamType = SqlDbType.Int; objParam[iParamCount].sParamValue = Convert.ToString(objUserLogin.iUserPreference); iParamCount++; sRetVal = DBOperation.ExecuteDBOperation("ProcUserLogin", DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "SUCCESS")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } #endregion } catch (Exception e1) { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + e1.Message)); } }