public int TempOrderUpdate(string FMobNo, string ProductId, int PackageID, int Qty, int UserId) { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; //string flag = ""; connection = new SqlConnection(connetionString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Usp_TempVideoOrderUpdate"; command.Parameters.AddWithValue("@CreatedBy", UserId); command.Parameters.AddWithValue("@MobileNo", FMobNo); command.Parameters.AddWithValue("@Quantity", Qty); command.Parameters.AddWithValue("@PackageID", PackageID); command.Parameters.AddWithValue("@ProductId", ProductId); flag = command.ExecuteNonQuery(); command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, UserId); } connection.Close(); return(flag); }
public ApiPostResponse SaveTractorUserDetail(string FarmerName, int StateId, string MobileNo, int CategoryId, int BzProductId, string ModelNo, decimal QuotationPrice, string RequestSource, string DemoDate, string TimeSlot) { SqlConnection connection; SqlCommand command = new SqlCommand(); System.Data.SqlTypes.SqlDateTime sqldatenul; string Msg = ""; connection = new SqlConnection(connetionString); ApiPostResponse objDataObject = new ApiPostResponse(); try { sqldatenul = System.Data.SqlTypes.SqlDateTime.Null; connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "usp_SaveUpdateTractorUsersDetail"; command.Parameters.AddWithValue("@FarmerName", FarmerName); command.Parameters.AddWithValue("@StateId", StateId); command.Parameters.AddWithValue("@MobileNo", MobileNo); command.Parameters.AddWithValue("@CategoryId", CategoryId); command.Parameters.AddWithValue("@BzProductId", BzProductId); command.Parameters.AddWithValue("@ModelNo", ModelNo); command.Parameters.AddWithValue("@QuotationPrice", QuotationPrice); command.Parameters.AddWithValue("@RequestSource", RequestSource); if (string.IsNullOrEmpty(DemoDate)) { command.Parameters.AddWithValue("@DemoDate", sqldatenul); } else { command.Parameters.AddWithValue("@DemoDate", Convert.ToDateTime(DemoDate)); } command.Parameters.AddWithValue("@TimeSlot", TimeSlot); Msg = Convert.ToString(command.ExecuteScalar()); if (Msg != "") { objDataObject.Success = true; objDataObject.Msg = Msg; } else { objDataObject.Success = false; objDataObject.Msg = "Issue Occurred, Please try again!!"; } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); } connection.Close(); return(objDataObject); }
public int OrderCreate(int userid, int FarmerId, string FarmerName, string FatherName, long Mobile, int StateId, int DistrictId, int BlockId, int VillageId, string OtherVillageName, string Address, string DeliveryDate, string Lat, string Long, string ModeOfPayment)//, DataTable DT { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; //string flag = ""; connection = new SqlConnection(connetionString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Usp_VideoOrderCreate"; command.Parameters.AddWithValue("@CreatedBy", userid); command.Parameters.AddWithValue("@farmerid", FarmerId); command.Parameters.AddWithValue("@name", FarmerName); command.Parameters.AddWithValue("@fathername", FatherName); command.Parameters.AddWithValue("@mobile", Mobile); command.Parameters.AddWithValue("@stateid", StateId); command.Parameters.AddWithValue("@districtid", DistrictId); command.Parameters.AddWithValue("@blockid", BlockId); command.Parameters.AddWithValue("@villageid", VillageId); command.Parameters.AddWithValue("@othervillagename", OtherVillageName); command.Parameters.AddWithValue("@Address", Address); command.Parameters.AddWithValue("@DeliveryDate", DeliveryDate); command.Parameters.AddWithValue("@ModeOfPayment", ModeOfPayment); command.Parameters.AddWithValue("@Lat", Lat); command.Parameters.AddWithValue("@Long", Long); command.Parameters.AddWithValue("@OrderSource", "Video App"); // command.Parameters.AddWithValue("@Product", DT); SqlParameter Error = new SqlParameter(); Error.ParameterName = "@Error"; Error.DbType = DbType.Int32; Error.Direction = ParameterDirection.Output; command.Parameters.Add(Error); flag = command.ExecuteNonQuery(); if (flag > 0) { string GetError = command.Parameters["@Error"].Value.ToString(); flag = int.Parse(GetError); } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, userid); } connection.Close(); return(flag); }
public SavedProductResult SaveSubDealerProducts(int PackageId, int Quantity, int SubDealerId) { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; connection = new SqlConnection(connetionString); SavedProductResult objDataObject = new SavedProductResult(); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Usp_SaveSubDealerProducts"; command.Parameters.AddWithValue("@StockId", 0); command.Parameters.AddWithValue("@PackageId", PackageId); command.Parameters.AddWithValue("@Quantity", Quantity); command.Parameters.AddWithValue("@SubDealerId", SubDealerId); flag = (int)command.ExecuteScalar(); if (flag > 0) { objDataObject.Status = 1; objDataObject.StockQty = flag; objDataObject.Msg = "Products have been added successfully to stock."; } else { objDataObject.Status = 0; objDataObject.StockQty = 0; objDataObject.Msg = "Issue Occurred, Please try again!!"; } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, SubDealerId); } connection.Close(); return(objDataObject); }
public int TempOrderCreate(int userid, int FarmerId, DataTable DT) { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; //string flag = ""; connection = new SqlConnection(connetionString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Usp_TempVideoOrderCreate"; command.Parameters.AddWithValue("@CreatedBy", userid); command.Parameters.AddWithValue("@farmerid", FarmerId); command.Parameters.AddWithValue("@OrderSource", "Video App"); command.Parameters.AddWithValue("@Product", DT); SqlParameter Error = new SqlParameter(); Error.ParameterName = "@Error"; Error.DbType = DbType.Int32; Error.Direction = ParameterDirection.Output; command.Parameters.Add(Error); flag = command.ExecuteNonQuery(); if (flag > 0) { string GetError = command.Parameters["@Error"].Value.ToString(); flag = int.Parse(GetError); } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, userid); } connection.Close(); return(flag); }
public ApiPostResponse SaveTractorUserDetailV2(string FarmerName, int StateId, string MobileNo, int CategoryId, string ModelNo, decimal QuotationPrice) { SqlConnection connection; SqlCommand command = new SqlCommand(); string Msg = ""; connection = new SqlConnection(connetionString); ApiPostResponse objDataObject = new ApiPostResponse(); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "usp_SaveUpdateTractorUsersDetail_Test"; command.Parameters.AddWithValue("@FarmerName", FarmerName); command.Parameters.AddWithValue("@StateId", StateId); command.Parameters.AddWithValue("@MobileNo", MobileNo); command.Parameters.AddWithValue("@CategoryId", CategoryId); command.Parameters.AddWithValue("@ModelNo", ModelNo); command.Parameters.AddWithValue("@QuotationPrice", QuotationPrice); Msg = Convert.ToString(command.ExecuteScalar()); if (Msg != "") { objDataObject.Success = true; objDataObject.Msg = Msg; } else { objDataObject.Success = false; objDataObject.Msg = "Issue Occurred, Please try again!!"; } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); } connection.Close(); return(objDataObject); }
public CreatedOrderResult OrderCreate(int userid, int FarmerId, string FarmerName, string FatherName, long Mobile, int StateId, int DistrictId, int BlockId, int VillageId, string OtherVillageName, string Address, string DeliveryDate, string ModeOfPayment, DataTable DT, string x_StateName, string x_DistrictName) //(int OfferDiscount, int Pckgid, int Qty, int Amount, int FarmerId, long Mobile, int StateId, int DistrictId, int BlockId, // int VillageId, string OtherVillageName, string Address, string DeliveryDate, string ModeOfPayment, int DiscountPrice, string DiscountCode) //, DataTable DT { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; //string flag = ""; connection = new SqlConnection(connetionString); CreatedOrderResult objDataObject = new CreatedOrderResult(); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Usp_OrderCreateByBZApp"; command.Parameters.AddWithValue("@SathiId", 0); command.Parameters.AddWithValue("@farmerid", FarmerId); command.Parameters.AddWithValue("@name", FarmerName); command.Parameters.AddWithValue("@fathername", FatherName); command.Parameters.AddWithValue("@mobile", Mobile); command.Parameters.AddWithValue("@stateid", StateId); command.Parameters.AddWithValue("@districtid", DistrictId); command.Parameters.AddWithValue("@blockid", BlockId); command.Parameters.AddWithValue("@villageid", VillageId); command.Parameters.AddWithValue("@othervillagename", OtherVillageName); command.Parameters.AddWithValue("@Address", Address); command.Parameters.AddWithValue("@DeliveryDate", DeliveryDate); command.Parameters.AddWithValue("@ModeOfPayment", ModeOfPayment); command.Parameters.AddWithValue("@Product", DT); command.Parameters.AddWithValue("@x_StateName", x_StateName); command.Parameters.AddWithValue("@x_DistrictName", x_DistrictName); SqlParameter ErrorId = new SqlParameter(); ErrorId.ParameterName = "@Error"; ErrorId.DbType = DbType.Int32; ErrorId.Direction = ParameterDirection.Output; command.Parameters.Add(ErrorId); flag = command.ExecuteNonQuery(); if (flag >= 1) { flag = 1; string Error = command.Parameters["@Error"].Value.ToString(); if (Convert.ToInt32(Error) > 2) { CreatedOrderResult objData = GetCreateOrderData(Convert.ToInt32(Error)); //objDataObject.OrderAmount = 1; //objDataObject.OrderId = 329676; //objDataObject.Status = 1; objDataObject.OrderAmount = objData.OrderAmount; objDataObject.OrderId = Convert.ToInt32(Error); objDataObject.Status = 1; } else { objDataObject.OrderAmount = 0; objDataObject.OrderId = 0; objDataObject.Status = Convert.ToInt32(Error); } } else { flag = 0; string Error = command.Parameters["@Error"].Value.ToString(); objDataObject.OrderAmount = 0; objDataObject.OrderId = 0; objDataObject.Status = 2;// Convert.ToInt32(2); } if (flag == 0) { //string Error = command.Parameters["@Error"].Value.ToString(); //flag = int.Parse(Error);// flag =2 set by error means fo try to create new order to other district so flag =2 objDataObject.OrderAmount = 0; objDataObject.OrderId = 0; objDataObject.Status = 2; } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, FarmerId); } connection.Close(); return(objDataObject); }
public ResponseObj SaveTempTransTrip(TransporterVehicleTrip obj) { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; var result = new ResponseObj(); connection = new SqlConnection(connetionString); var fName = obj.Transporter.Name; var lName = string.Empty; if (obj.Transporter.Name.Contains(" ")) { fName = obj.Transporter.Name.Split(' ')[0]; lName = obj.Transporter.Name.Split(' ')[1]; } try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "SP_SAVETempTRIP_DETAIL";//SP_SAVETRIP_DETAIL command.Parameters.AddWithValue("@ORDER_IDS", obj.Orderid); SqlParameter TripId = new SqlParameter(); TripId.ParameterName = "@TripID"; TripId.DbType = DbType.Int32; TripId.Direction = ParameterDirection.Output; command.Parameters.Add(TripId); command.Parameters.AddWithValue("@PickupAddress", "NA"); command.Parameters.AddWithValue("@VehicleTypeID", obj.VehicleId); command.Parameters.AddWithValue("@VehicleName", obj.VehicleName); command.Parameters.AddWithValue("@mobile", obj.Mobile); command.Parameters.AddWithValue("@vehicleNo", "NA"); command.Parameters.AddWithValue("@StartKmReading", 0); command.Parameters.AddWithValue("@EndKmReading", 0); command.Parameters.AddWithValue("@ChargesPerKm", 0); command.Parameters.AddWithValue("@OtherCharges", 0); command.Parameters.AddWithValue("@LabourCharges", 0); command.Parameters.AddWithValue("@Remark", "NA"); command.Parameters.AddWithValue("@CreateBy", Convert.ToInt32(obj.CreatedBy)); command.Parameters.AddWithValue("@ModifiedBy", 0); command.Parameters.AddWithValue("@IsActive", 1); command.Parameters.AddWithValue("@TransporterId", obj.Transporter.UserId); command.Parameters.AddWithValue("@TransporterFName", fName); command.Parameters.AddWithValue("@TransporterLName", lName); command.Parameters.AddWithValue("@TransMobile", obj.Transporter.Mobile); command.Parameters.AddWithValue("@TransAddress", obj.Transporter.Address); command.Parameters.AddWithValue("@RuleId", obj.RuleId); command.Parameters.AddWithValue("@Fixedrateperday", obj.Fixedrateperday); command.Parameters.AddWithValue("@FuelCharges", obj.FuelCharges); command.Parameters.AddWithValue("@Priceperkm", obj.Priceperkm); command.Parameters.AddWithValue("@Mincharges", obj.Mincharges); command.Parameters.AddWithValue("@MinchargeUptoKm", obj.MinchargeUptoKm); command.Parameters.AddWithValue("@UpPrice", obj.UpPrice); command.Parameters.AddWithValue("@DownPrice", obj.DownPrice); command.Parameters.AddWithValue("@FixedPrice", obj.FixedPrice); command.Parameters.AddWithValue("@IsUpDown", Convert.ToBoolean(obj.IsUpDown)); command.Parameters.AddWithValue("@ReasonId", obj.ReasonId); command.Parameters.AddWithValue("@Remarks", obj.Remarks); SqlParameter TripMSG = new SqlParameter(); TripMSG.ParameterName = "@TripMsg"; TripMSG.DbType = DbType.String; TripMSG.Size = 299; TripMSG.Direction = ParameterDirection.Output; command.Parameters.Add(TripMSG); flag = command.ExecuteNonQuery(); //if (flag > 0) //{ result.Status = "Sucess"; string GetTripID = command.Parameters["@TripID"].Value.ToString(); // flag = int.Parse(GetTripID); result.Value = GetTripID; result.Msg = command.Parameters["@TripMsg"].Value.ToString(); //} command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { result.Msg = ex.Message; result.Status = "Failed"; result.Value = "-1"; LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, int.Parse("0")); } connection.Close(); return(result); }
public ResponseObj UpdateTempTripStatus(string tempTripId, string status, int userId, ref string FoFCM, ref string FoName, ref string RoFCM, ref string TransName) { SqlConnection connection; SqlCommand command = new SqlCommand(); int flag = 0; string res = "0"; connection = new SqlConnection(connetionString); var result = new ResponseObj(); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Usp_UpdateTempTripStatus";//SP_SAVETRIP_DETAIL command.Parameters.AddWithValue("@tempTripId", tempTripId); command.Parameters.AddWithValue("@status", status); command.Parameters.AddWithValue("@userId", userId); SqlParameter FCMFo = new SqlParameter(); FCMFo.ParameterName = "@FoFCM"; FCMFo.DbType = DbType.String; FCMFo.Size = 999; FCMFo.Direction = ParameterDirection.Output; command.Parameters.Add(FCMFo); SqlParameter FCMName = new SqlParameter(); FCMName.ParameterName = "@FoName"; FCMName.DbType = DbType.String; FCMName.Size = 299; FCMName.Direction = ParameterDirection.Output; command.Parameters.Add(FCMName); SqlParameter FCMRo = new SqlParameter(); FCMRo.ParameterName = "@RoFCM"; FCMRo.DbType = DbType.String; FCMRo.Size = 999; FCMRo.Direction = ParameterDirection.Output; command.Parameters.Add(FCMRo); SqlParameter TransporterName = new SqlParameter(); TransporterName.ParameterName = "@TransporterName"; TransporterName.DbType = DbType.String; TransporterName.Size = 299; TransporterName.Direction = ParameterDirection.Output; command.Parameters.Add(TransporterName); flag = command.ExecuteNonQuery(); if (flag > 0) { result.Status = "Sucess"; result.Value = flag.ToString(); result.Msg = "Status updated successfully!"; FoFCM = command.Parameters["@FoFCM"].Value.ToString(); FoName = command.Parameters["@FoName"].Value.ToString(); RoFCM = command.Parameters["@RoFCM"].Value.ToString(); TransName = command.Parameters["@TransporterName"].Value.ToString(); } else { result.Status = "Sucess"; result.Value = flag.ToString(); result.Msg = "Some problem in request contact with admin"; } command.Parameters.Clear(); LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { result.Msg = ex.Message; result.Status = "Failed"; result.Value = "-1"; LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, int.Parse(tempTripId)); } connection.Close(); return(result); }