Ejemplo n.º 1
0
        public int UpdateUserDefaultAddress(UserAddress objuser)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_UpdateUserDefaultAddress";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Id", objuser.Id < 0 ? 0 : objuser.Id);
                        cmd.Parameters.AddWithValue("@UserId", objuser.UserId);
                        id = cmd.ExecuteNonQuery();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 2
0
        public int UpdateUserPassword(UserModel objuser)
        {
            int Result = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_UpdateUserPassword";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@OldPassword", objuser.OldPassword);
                        cmd.Parameters.AddWithValue("@NewPassword", objuser.Password);
                        cmd.Parameters.AddWithValue("@UserId", objuser.Id);
                        Result = cmd.ExecuteNonQuery();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Result);
        }
Ejemplo n.º 3
0
        public int AddUpdateUserKYCDetails(UserKYCDetails objuser)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddUpdateUserKYCDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Id", objuser.Id < 0 ? 0 : objuser.Id);
                        cmd.Parameters.AddWithValue("@NameAsPerID", objuser.NameAsPerID);
                        cmd.Parameters.AddWithValue("@DocumentType", objuser.DocumentType);
                        cmd.Parameters.AddWithValue("@DocumentNumber", objuser.DocumentNumber);
                        cmd.Parameters.AddWithValue("@CreatedBy", objuser.CreatedBy);
                        id = cmd.ExecuteNonQuery();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 4
0
        public int ChangePassword(LoginRequestModel objectentity)
        {
            int Result = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_UpdatePassword";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@PhoneNo", objectentity.UserName);
                        cmd.Parameters.AddWithValue("@Password", objectentity.Password);
                        cmd.ExecuteNonQuery();
                        Result = 1;
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Result);
        }
Ejemplo n.º 5
0
        public int DeleteCropList(CropDetailsModel model)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_DeleteCropList";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CropListId", model.Id);
                        cmd.Parameters.AddWithValue("@UserId", model.ModifiedBy);
                        cmd.ExecuteNonQuery();
                        id = 1;
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 6
0
        public int AddDairyLoanDetails(DairyLoanModel model)
        {
            int Id = 0;

            try
            {
                using (SqlConnection conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (SqlCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddDairyLoanDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@LoanAmount", model.LoanAmount);
                        cmd.Parameters.AddWithValue("@LoanTenure", model.LoanTenure);
                        cmd.Parameters.AddWithValue("@RateOfInterest", model.RateOfInterest);
                        cmd.Parameters.AddWithValue("@CreatedBy", model.CreatedBy);
                        cmd.Parameters.Add("@Result", SqlDbType.Int).Direction = ParameterDirection.Output;
                        int i = cmd.ExecuteNonQuery();
                        Id = Convert.ToInt32(cmd.Parameters["@Result"].Value);
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Id);
        }
Ejemplo n.º 7
0
        public int CheckPhoneNoExists(string PhoneNo)
        {
            int Result = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_CheckPhoneNoExists";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@PhoneNo", PhoneNo);
                        cmd.Parameters.Add("@Result", SqlDbType.Int).Direction = ParameterDirection.Output;
                        int i = cmd.ExecuteNonQuery();
                        Result = Convert.ToInt32(cmd.Parameters["@Result"].Value);
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Result);
        }
Ejemplo n.º 8
0
        public int AddCropPerticular(CropPerticularModel model)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddCropPerticular";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CropId", model.CropId);
                        cmd.Parameters.AddWithValue("@Transportation", model.Transportation);
                        cmd.Parameters.AddWithValue("@LabourCharges", model.LabourCharges);
                        cmd.Parameters.AddWithValue("@Loading", model.Loading);
                        cmd.Parameters.AddWithValue("@Gunnies", model.Gunnies);
                        cmd.Parameters.AddWithValue("@OtherCharges", model.OtherCharges);
                        cmd.Parameters.AddWithValue("@UserId", model.CreatedBy);
                        cmd.ExecuteNonQuery();
                        id = 1;
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 9
0
        public int AddUpdateUserBankDetails(UserBankDetails objuser)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddUpdateUserBankDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Id", objuser.Id < 0 ? 0 : objuser.Id);
                        cmd.Parameters.AddWithValue("@AccountHolderName", objuser.AccountHolderName);
                        cmd.Parameters.AddWithValue("@BankName", objuser.BankName);
                        cmd.Parameters.AddWithValue("@AccountNumber", objuser.AccountNumber);
                        cmd.Parameters.AddWithValue("@IFSCCode", objuser.IFSCCode);
                        cmd.Parameters.AddWithValue("@CreatedBy", objuser.CreatedBy);
                        id = cmd.ExecuteNonQuery();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 10
0
        public IList <TractorLoanModel> GetTractorLoanList(int UserId)
        {
            IList <TractorLoanModel> listitems = new List <TractorLoanModel>();

            try
            {
                using (SqlConnection conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (SqlCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetTractorLoanRequested";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", UserId);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                TractorLoanModel model = new TractorLoanModel();
                                model.LoanAmount     = Convert.ToString(reader["LoanAmount"]);
                                model.LoanTenure     = Convert.ToString(reader["LoanTenure"]);
                                model.RateOfInterest = Convert.ToString(reader["RateOfInterest"]);
                                model.CreatedDate    = Convert.ToDateTime(reader["CreatedDate"]);
                                listitems.Add(model);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(listitems);
        }
Ejemplo n.º 11
0
        public string CancellOrder(OrderDetailsModel request)
        {
            string Message = "";

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();

                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_CancellOrder";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@FarmerId", request.FarmerId);
                        cmd.Parameters.AddWithValue("@OrderId", request.OrderId);

                        cmd.ExecuteNonQuery();
                        Message = "Order Cancelled successfully";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Message);
        }
Ejemplo n.º 12
0
        public int AddUpdateTransportationDetails(TransportationDetails objuser)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddUpdateTransportationDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Id", objuser.Id < 0 ? 0 : objuser.Id);
                        cmd.Parameters.AddWithValue("@OwnerName", objuser.OwnerName);
                        cmd.Parameters.AddWithValue("@TransportationType", objuser.TransportationType);
                        cmd.Parameters.AddWithValue("@VehicleNumber", objuser.VehicleNumber);
                        cmd.Parameters.AddWithValue("@CreatedBy", objuser.CreatedBy);
                        id = cmd.ExecuteNonQuery();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 13
0
        public int VerifyOTPofNewUser(UserModel objuser)
        {
            int Result = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_UpdateOTPVerifiedforUser";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@PhoneNo", objuser.PhoneNo);
                        cmd.Parameters.Add("@Status", SqlDbType.Int).Direction = ParameterDirection.Output;
                        int i = cmd.ExecuteNonQuery();
                        Result = Convert.ToInt32(cmd.Parameters["@Status"].Value);
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Result);
        }
Ejemplo n.º 14
0
        public IList <BankMasterModel> GetBankLists()
        {
            IList <BankMasterModel> BankDetails = new List <BankMasterModel>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetBankLists";
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                BankMasterModel model = new BankMasterModel();
                                model.Id       = Convert.ToInt32(reader["Id"]);
                                model.BankName = Convert.ToString(reader["BankName"]);
                                model.IsActive = Convert.ToBoolean(reader["IsActive"]);
                                BankDetails.Add(model);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(BankDetails);
        }
Ejemplo n.º 15
0
        public int DeleteTransportationDetails(TransportationDetails objTransportation)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_DeleteTransportation";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Id", objTransportation.Id < 0 ? 0 : objTransportation.Id);
                        cmd.Parameters.AddWithValue("@UserId", objTransportation.CreatedBy);
                        cmd.ExecuteNonQuery();
                        id = 1;
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 16
0
        public UserModel ValidateRefferalCode(string RefferalCode)
        {
            UserModel model = new UserModel();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_ValidateRefferalCode";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@RefferalCode", RefferalCode);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                model.IsReferValidated = Convert.ToBoolean(reader["IsReferValidated"]);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(model);
        }
Ejemplo n.º 17
0
        public IList <OrderDetailsModel> GetAllOrders(OrderDetailsModel orderModel)
        {
            IList <OrderDetailsModel> Items = new List <OrderDetailsModel>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetAllOrdersByFarmer";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@FarmerId", orderModel.FarmerId);
                        cmd.Parameters.AddWithValue("@FromDate", (orderModel.FromDate == null || orderModel.FromDate == new DateTime()) ? SqlDateTime.MinValue.Value : orderModel.FromDate);
                        cmd.Parameters.AddWithValue("@ToDate", (orderModel.ToDate == null || orderModel.ToDate == new DateTime()) ? SqlDateTime.MaxValue.Value.AddDays(-1) : orderModel.ToDate);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                OrderDetailsModel model = new OrderDetailsModel();
                                model.OrderId      = Convert.ToInt32(reader["Id"]);
                                model.CartItemId   = Convert.ToInt32(reader["CartItemId"]);
                                model.CropListId   = Convert.ToInt32(reader["CropListId"]);
                                model.FarmerId     = Convert.ToInt32(reader["FarmerId"]);
                                model.UserId       = Convert.ToInt32(reader["UserId"]);
                                model.Quantity     = Convert.ToInt32(reader["Quantity"]);
                                model.Price        = Convert.ToString(reader["Price"]);
                                model.CropIcon     = Convert.ToString(reader["CropIcon"]);
                                model.CropName     = Convert.ToString(reader["CropName"]);
                                model.Variety      = Convert.ToString(reader["Variety"]);
                                model.UoM          = Convert.ToString(reader["UoM"]);
                                model.CustomerName = Convert.ToString(reader["FullName"]);
                                model.CreatedDate  = Convert.ToDateTime(reader["CreatedDate"]);
                                model.IsAccepted   = string.IsNullOrEmpty(Convert.ToString(reader["IsAccepted"])) ? false : Convert.ToBoolean(reader["IsAccepted"]);
                                model.IsCancelled  = string.IsNullOrEmpty(Convert.ToString(reader["IsCancelled"])) ? false : Convert.ToBoolean(reader["IsCancelled"]);
                                model.CancelledBy  = string.IsNullOrEmpty(Convert.ToString(reader["CancelledBy"])) ? "" : Convert.ToString(reader["CancelledBy"]);
                                model.IsDelivered  = string.IsNullOrEmpty(Convert.ToString(reader["IsDelivered"])) ? false : Convert.ToBoolean(reader["IsDelivered"]);

                                Items.Add(model);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Items);
        }
Ejemplo n.º 18
0
        public IList <UserAddress> GetAddressByUser(int UserId, string PickUpFrom = "")
        {
            IList <UserAddress> AddressDetails = new List <UserAddress>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetUserAddressByUser";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", UserId);
                        cmd.Parameters.AddWithValue("@PickUpFrom", PickUpFrom);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                UserAddress model = new UserAddress();
                                model.Id               = Convert.ToInt32(reader["Id"]);
                                model.Name             = Convert.ToString(reader["Name"]);
                                model.MobileNo         = Convert.ToString(reader["mobileNo"]);
                                model.StreeAddress     = Convert.ToString(reader["StreetAdress"]);
                                model.StreeAddress1    = Convert.ToString(reader["StreetAddress1"]);
                                model.City             = Convert.ToString(reader["City"]);
                                model.LandMark         = Convert.ToString(reader["LandMark"]);
                                model.State            = Convert.ToString(reader["State"]);
                                model.District         = Convert.ToString(reader["District"]);
                                model.Taluk            = Convert.ToString(reader["Taluk"]);
                                model.Hoblie           = Convert.ToString(reader["Hobli"]);
                                model.Village          = Convert.ToString(reader["Village"]);
                                model.Pincode          = Convert.ToString(reader["Pincode"]);
                                model.PickUpFrom       = Convert.ToString(reader["PickUpLocation"]);
                                model.IsDefaultAddress = string.IsNullOrEmpty(Convert.ToString(reader["IsDefaultAddress"])) ? false : Convert.ToBoolean(reader["IsDefaultAddress"]);
                                AddressDetails.Add(model);
                            }
                        }
                    }
                    conn.Close();
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(AddressDetails);
        }
Ejemplo n.º 19
0
        public IList <CropDetailsModel> GetCropDetails(CropDetailsModel request)
        {
            IList <CropDetailsModel> Crops = new List <CropDetailsModel>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetCropListDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", request.CreatedBy);
                        cmd.Parameters.AddWithValue("@CropId", request.CropId);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                CropDetailsModel model = new CropDetailsModel();
                                model.Id             = Convert.ToInt32(reader["Id"]);
                                model.CropId         = Convert.ToInt32(reader["CropId"]);
                                model.Variety        = Convert.ToString(reader["Variety"]);
                                model.Grade          = Convert.ToString(reader["Grade"]);
                                model.UoM            = Convert.ToString(reader["UoM"]);
                                model.Quantity       = Convert.ToInt32(reader["Quantity"]);
                                model.SellType       = Convert.ToInt32(reader["SellType"]);
                                model.FarmerId       = Convert.ToInt32(reader["FarmerId"]);
                                model.Price          = Convert.ToString(reader["Price"]);
                                model.PickupLocation = Convert.ToString(reader["PickupLocation"]);
                                model.Latitude       = Convert.ToString(reader["Latitude"]);
                                model.Longitude      = Convert.ToString(reader["Longitude"]);
                                model.Location       = Convert.ToString(reader["Location"]);
                                Crops.Add(model);
                            }
                        }
                    }
                    conn.Close();
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(Crops);
        }
Ejemplo n.º 20
0
        public int AddCropDetails(CropDetailsModel model)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddCropListDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CropId", model.CropId);
                        cmd.Parameters.AddWithValue("@Variety", model.Variety);
                        cmd.Parameters.AddWithValue("@Grade", model.Grade);
                        cmd.Parameters.AddWithValue("@UoM", model.UoM);
                        cmd.Parameters.AddWithValue("@Quantity", model.Quantity);
                        cmd.Parameters.AddWithValue("@SellType", model.SellType);
                        cmd.Parameters.AddWithValue("@Price", model.Price);
                        cmd.Parameters.AddWithValue("@CreatedBy", model.CreatedBy);
                        cmd.Parameters.AddWithValue("@PickupLocation", model.PickupLocation);
                        cmd.Parameters.AddWithValue("@Location", model.Location);
                        cmd.Parameters.AddWithValue("@Latitude", model.Latitude);
                        cmd.Parameters.AddWithValue("@Longitude", model.Longitude);

                        cmd.Parameters.AddWithValue("@StateId", model.StateId);
                        cmd.Parameters.AddWithValue("@DistID", model.DistId);
                        cmd.Parameters.AddWithValue("@TalukID", model.TalukId);
                        cmd.Parameters.AddWithValue("@HobliID", model.HobliId);
                        cmd.Parameters.AddWithValue("@VillageID", model.VillageId);
                        cmd.Parameters.AddWithValue("@AddressId", model.AddressId);


                        cmd.ExecuteNonQuery();
                        id = 1;
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 21
0
        public UserModel GetFarmerDetails(int UserId)
        {
            UserModel model = new UserModel();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetFarmerDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", UserId);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                model.Id                 = Convert.ToInt32(reader["Id"]);
                                model.FullName           = Convert.ToString(reader["FullName"]);
                                model.EmailId            = Convert.ToString(reader["EmailId"]);
                                model.PhoneNo            = Convert.ToString(reader["PhoneNo"]);
                                model.MaskedPhoneNo      = Utility.MaskData(Convert.ToString(reader["PhoneNo"]));
                                model.ProfilePic         = Convert.ToString(reader["ProfilePic"]);
                                model.DeviceId           = Convert.ToString(reader["DeviceId"]);
                                model.DeviceType         = Convert.ToString(reader["DeviceType"]);
                                model.RefferalCode       = Convert.ToString(reader["RefferalCode"]);
                                model.NotificationTypeId = Convert.ToString(reader["NotificationTypeId"]);
                                model.IsFarmer           = Convert.ToBoolean(reader["IsFarmer"]);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(model);
        }
Ejemplo n.º 22
0
        public int AddUserAddress(UserAddress objuser)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddUpdateUserAddress";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Id", objuser.Id < 0 ? 0 : objuser.Id);
                        cmd.Parameters.AddWithValue("@FullName", objuser.Name);
                        cmd.Parameters.AddWithValue("@MobileNo", objuser.MobileNo);
                        cmd.Parameters.AddWithValue("@StreetAddress", objuser.StreeAddress);
                        cmd.Parameters.AddWithValue("@StreetAddress1", objuser.StreeAddress1);
                        cmd.Parameters.AddWithValue("@City", objuser.City);
                        cmd.Parameters.AddWithValue("@LandMark", objuser.LandMark);
                        cmd.Parameters.AddWithValue("@StateId", objuser.StateId);
                        cmd.Parameters.AddWithValue("@Distict", objuser.DistrictId);
                        cmd.Parameters.AddWithValue("@TalukId", objuser.TalukId);
                        cmd.Parameters.AddWithValue("@HobliId", objuser.HobliId);
                        cmd.Parameters.AddWithValue("@VillageId", objuser.VillageId);
                        cmd.Parameters.AddWithValue("@PinCode", objuser.Pincode);
                        cmd.Parameters.AddWithValue("@UserId", objuser.UserId);
                        cmd.Parameters.AddWithValue("@PickUpLocation", objuser.PickUpFrom);
                        cmd.Parameters.Add("@Result", SqlDbType.Int).Direction = ParameterDirection.Output;
                        int i = cmd.ExecuteNonQuery();
                        id = Convert.ToInt32(cmd.Parameters["@Result"].Value);
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 23
0
        public IList <TransactionModel> GetTransactionsByUser(TransactionModel obj)
        {
            IList <TransactionModel> Items = new List <TransactionModel>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetTransactionsByUser";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", obj.CreatedBy);
                        cmd.Parameters.AddWithValue("@FromDate", (obj.FromDate == null || obj.FromDate == new DateTime()) ? SqlDateTime.MinValue.Value : obj.FromDate);
                        cmd.Parameters.AddWithValue("@ToDate", (obj.ToDate == null || obj.ToDate == new DateTime()) ? SqlDateTime.MaxValue.Value.AddDays(-1) : obj.ToDate);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                TransactionModel model = new TransactionModel();
                                model.Id              = Convert.ToInt32(reader["Id"]);
                                model.Amount          = Convert.ToDecimal(reader["Amount"]);
                                model.Description     = Convert.ToString(reader["Description"]);
                                model.TransactionType = Convert.ToString(reader["TransactionType"]);
                                model.ReferenceId     = Convert.ToInt32(reader["ReferenceId"]);
                                model.Status          = Convert.ToBoolean(reader["Status"]);
                                model.CreatedDate     = Convert.ToDateTime(reader["CreatedDate"]);
                                model.CreatedBy       = Convert.ToInt32(reader["CreatedBy"]);
                                Items.Add(model);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Items);
        }
Ejemplo n.º 24
0
        public CropPerticularModel GetCropPerticular(CropPerticularModel request)
        {
            CropPerticularModel model = new CropPerticularModel();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetCropPerticularDetails";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", request.CreatedBy);
                        cmd.Parameters.AddWithValue("@CropId", request.CropId);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                model.Id             = Convert.ToInt32(reader["Id"]);
                                model.CropId         = Convert.ToInt32(reader["CropId"]);
                                model.Transportation = Convert.ToString(reader["Transportation"]);
                                model.LabourCharges  = Convert.ToString(reader["LabourCharges"]);
                                model.Loading        = Convert.ToString(reader["Loading"]);
                                model.Gunnies        = Convert.ToString(reader["Gunnies"]);
                                model.OtherCharges   = Convert.ToString(reader["OtherCharges"]);
                                model.CropName       = Convert.ToString(reader["CropName"]);
                                model.Catagory       = Convert.ToString(reader["Catagory"]);
                            }
                        }
                    }
                    conn.Close();
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(model);
        }
Ejemplo n.º 25
0
        public int AddUser(UserModel objuser)
        {
            int id = 0;

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_AddnewUser";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@PhoneNo", objuser.PhoneNo);
                        cmd.Parameters.AddWithValue("@Password", objuser.Password);
                        cmd.Parameters.AddWithValue("@DeviceId", objuser.DeviceId);
                        cmd.Parameters.AddWithValue("@DeviceType", objuser.DeviceType);
                        cmd.Parameters.AddWithValue("@IsOTPVerified", false);
                        cmd.Parameters.AddWithValue("@FullName", objuser.FullName);
                        cmd.Parameters.AddWithValue("@EmailId", objuser.EmailId);
                        cmd.Parameters.AddWithValue("@CountryId", objuser.CountryId);
                        cmd.Parameters.AddWithValue("@StateId", objuser.StateId);
                        cmd.Parameters.AddWithValue("@DistrictId", objuser.DistrictId);
                        cmd.Parameters.AddWithValue("@TalukId", objuser.TalukId);
                        cmd.Parameters.AddWithValue("@HobliId", objuser.HobliId);
                        cmd.Parameters.AddWithValue("@RefferalCode", objuser.RefferalCode);
                        cmd.Parameters.AddWithValue("@IsReferValidated", objuser.IsReferValidated);
                        cmd.Parameters.Add("@UserId", SqlDbType.Int).Direction = ParameterDirection.Output;
                        int i = cmd.ExecuteNonQuery();
                        id = Convert.ToInt32(cmd.Parameters["@UserId"].Value);
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Ejemplo n.º 26
0
        public AccessModel GetAccessContentByLangCode(string LanguageCode, string Type)
        {
            AccessModel response = new AccessModel();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetAccessContentByLanguage";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@LangCode", LanguageCode);
                        cmd.Parameters.AddWithValue("@Type", Type);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                response.Id          = Convert.ToInt32(reader["Id"]);
                                response.LangCode    = Convert.ToString(reader["LangCode"]);
                                response.Description = Convert.ToString(reader["Description"]);
                                response.Image       = Convert.ToString(reader["Image"]);
                                response.Type        = Convert.ToString(reader["Type"]);
                                response.Action      = Convert.ToString(reader["Action"]);
                                response.Title       = Convert.ToString(reader["Title"]);
                                response.ClickCount  = Convert.ToInt32(reader["ClickCount"]);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Ejemplo n.º 27
0
        public IList <UserBankDetails> GetBankDetailsByUser(int UserId)
        {
            IList <UserBankDetails> BankDetails = new List <UserBankDetails>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetBankDetailsByUser";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserId", UserId);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                UserBankDetails model = new UserBankDetails();
                                model.Id = Convert.ToInt32(reader["Id"]);
                                model.AccountHolderName = Convert.ToString(reader["AccountHolderName"]);
                                model.BankName          = Convert.ToString(reader["BankName"]);
                                model.AccountNumber     = Convert.ToString(reader["AccountNumber"]);
                                model.IFSCCode          = Convert.ToString(reader["IFSCCode"]);
                                model.CreatedBy         = Convert.ToInt32(reader["CreatedBy"]);
                                model.UserId            = Convert.ToInt32(reader["UserId"]);
                                BankDetails.Add(model);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(BankDetails);
        }
Ejemplo n.º 28
0
 public void UpdateRegisterOTPCountForUser(string PhoneNo, bool IsNew)
 {
     try
     {
         using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
         {
             conn.Open();
             using (var cmd = conn.CreateCommand())
             {
                 cmd.CommandText = "sp_UpdateRegisterOTPCountForUser";
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@Username", PhoneNo);
                 cmd.Parameters.AddWithValue("@Isnew", IsNew);
                 cmd.ExecuteNonQuery();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 29
0
        public IList <UserModel> GetCustomersList()
        {
            IList <UserModel> CustomersList = new List <UserModel>();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetCustomersRegistered";
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                UserModel model = new UserModel();
                                model.Id         = Convert.ToInt32(reader["Id"]);
                                model.FullName   = Convert.ToString(reader["FullName"]);
                                model.EmailId    = Convert.ToString(reader["EmailId"]);
                                model.PhoneNo    = Convert.ToString(reader["PhoneNo"]);
                                model.State      = Convert.ToString(reader["State"]);
                                model.ProfilePic = Convert.ToString(reader["ProfilePic"]);
                                CustomersList.Add(model);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(CustomersList);
        }
Ejemplo n.º 30
0
        public LoginResponseModel GetRegisterOTPCountForUser(string PhoneNo)
        {
            LoginResponseModel response = new LoginResponseModel();

            try
            {
                using (var conn = new SqlConnection(ContexDetails.Connectiondetails()))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "sp_GetRegisterOTPCountwithDate";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Username", PhoneNo);
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                response.UserId               = Convert.ToInt32(reader["Id"]);
                                response.UserName             = Convert.ToString(reader["UserName"]);
                                response.RegisterOTPSentCount = Convert.ToInt32(reader["RegisterOTPSentCount"]);
                                if (reader["RegisterOTPSentDate"] != DBNull.Value)
                                {
                                    response.RegisterOTPSentDate = Convert.ToDateTime(reader["RegisterOTPSentDate"]);
                                }
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }