public object PostLogout(Postloginreq _login)
        {
            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();

                    tbl_OTP _logoutInput = dataContext.tbl_OTP.Single(e => e.int_user_id == _login.intloginId && e.dt_logout_time == null);
                    _logoutInput.dt_logout_time = DateTime.Now;
                    dataContext.SaveChanges();
                    dataContext.Database.Connection.Close();

                    return(new ResponseModel {
                        StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = ""
                    });
                }
            }
            catch (Exception ex)
            {
                CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true);
                return(new ResponseModel {
                    StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = ""
                });
            }
        }
Beispiel #2
0
        public object GetUserAddressById(int intUserId)
        {
            try
            {
                ShippingAddressResponseModel _response = new ShippingAddressResponseModel();

                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var command = dataContext.Database.Connection.CreateCommand();
                    command.CommandText = "usp_Shipping_Address";
                    command.CommandType = CommandType.StoredProcedure;
                    var p  = new SqlParameter("@intUserid", intUserId);
                    var p1 = new SqlParameter("@strAddress", "");
                    var p2 = new SqlParameter("@intCityid", 0);
                    var p3 = new SqlParameter("@intStateid", 0);
                    var p4 = new SqlParameter("@intCountryId", 0);
                    var p5 = new SqlParameter("@strPin", "");
                    var p6 = new SqlParameter("@strMobileNo", "");
                    var p7 = new SqlParameter("@StrAction", "GetAllShippingAddress");
                    command.Parameters.Add(p);
                    command.Parameters.Add(p1);
                    command.Parameters.Add(p2);
                    command.Parameters.Add(p3);
                    command.Parameters.Add(p4);
                    command.Parameters.Add(p5);
                    command.Parameters.Add(p6);
                    command.Parameters.Add(p7);
                    var     reader = command.ExecuteReader();
                    DataSet oDS    = new DataSet();
                    while (!reader.IsClosed)
                    {
                        oDS.Tables.Add().Load(reader);
                    }

                    if (oDS.Tables[0].Rows.Count != 0)
                    {
                        _response.intShippingid = Convert.ToInt32(oDS.Tables[0].Rows[0]["ShippingId"]);
                        _response.strAddress    = oDS.Tables[0].Rows[0]["v_address"].ToString();
                        _response.intCityId     = Convert.ToInt32(oDS.Tables[0].Rows[0]["intCityId"]);
                        _response.strCity       = oDS.Tables[0].Rows[0]["City"].ToString();
                        _response.intStateId    = Convert.ToInt32(oDS.Tables[0].Rows[0]["intStateId"]);
                        _response.strState      = oDS.Tables[0].Rows[0]["States"].ToString();
                        _response.intCountryId  = Convert.ToInt32(oDS.Tables[0].Rows[0]["intCountryId"]);
                        _response.strCountry    = oDS.Tables[0].Rows[0]["Country"].ToString();
                        _response.strPin        = oDS.Tables[0].Rows[0]["v_pin"].ToString();
                        _response.strMobileNo   = oDS.Tables[0].Rows[0]["v_mobile_no"].ToString();
                    }
                    dataContext.Database.Connection.Close();
                }

                return(new ResponseModel {
                    StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = _response
                });
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #3
0
        public CityModel DeleteCity(int intCityId)
        {
            CityModel  _objdata = new CityModel();
            tbl_Cities _objCity = new tbl_Cities();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_Cities.Where(x => x.int_Id == intCityId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_Cities _log = new tbl_Cities();

                        _log        = dataContext.tbl_Cities.Where(x => x.int_Id == intCityId).FirstOrDefault();
                        _log.b_flag = false;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "City deleted sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
 public List <ProductMaster> ProductMastersList(List <ProductMaster> _listproduct)
 {
     try
     {
         using (newconecommerce dataContext = new newconecommerce())
         {
             List <ProductMaster> _list = (from _product in dataContext.tbl_Products
                                           join _category in dataContext.tbl_category on _product.int_CategoryId equals _category.int_id
                                           join _brand in dataContext.tbl_Brands on _product.int_BrandsId equals _brand.int_id
                                           where _product.b_IsActive == true
                                           select new ProductMaster
             {
                 intProductId = _product.int_id,
                 strBrand = _brand.v_name,
                 strCategory = _category.v_category,
                 strProductName = _product.v_name,
                 intStocks = (int)_product.int_quantity,
                 dblPrice = (double)_product.fl_price
             }).ToList();
             return(_list);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #5
0
        public object GetCountry()
        {
            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    List <CountryModel> _list = (from _country in dataContext.tbl_Countries
                                                 where _country.b_IsActive == true
                                                 select new CountryModel
                    {
                        intCountryId = _country.int_Id,
                        strCountryName = _country.v_country,
                        strCourncy = _country.v_currency,
                        strCourncySymbol = _country.v_currency_symbol
                    }).ToList();

                    return(new ResponseModel {
                        StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = _list
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public StateModel DeleteState(int intStateId)
        {
            StateModel _objdata  = new StateModel();
            tbl_States _objState = new tbl_States();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_States.Where(x => x.int_Id == intStateId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_States _log = new tbl_States();

                        _log            = dataContext.tbl_States.Where(x => x.int_Id == intStateId).FirstOrDefault();
                        _log.b_IsActive = false;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "State deleted sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #7
0
        public ProductModal DeleteProduct(int intProductId)
        {
            ProductModal _objdata    = new ProductModal();
            tbl_Products _objproduct = new tbl_Products();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_Products.Where(x => x.int_id == intProductId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_Products _log = new tbl_Products();

                        _log            = dataContext.tbl_Products.Where(x => x.int_id == intProductId).FirstOrDefault();
                        _log.b_IsActive = false;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "Product updated sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public BrandModel DeleteBrand(int intBrandId)
        {
            BrandModel _objdata  = new BrandModel();
            tbl_Brands _objBrand = new tbl_Brands();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_Brands.Where(x => x.int_id == intBrandId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_Brands _log = new tbl_Brands();

                        _log = dataContext.tbl_Brands.Where(x => x.int_id == intBrandId).FirstOrDefault();
                        // _log.b_IsActive = false;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "Brand deleted sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public StateModel SaveState(StateModel _objdata)
        {
            tbl_States _objState = new tbl_States();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    _objState.v_State       = _objdata.strStateName;
                    _objState.int_CountryId = _objdata.intCountryId;
                    _objState.dt_Created_On = DateTime.Now;
                    _objState.b_IsActive    = true;
                    dataContext.tbl_States.Add(_objState);
                    dataContext.SaveChanges();
                    dataContext.Database.Connection.Close();
                    _objdata.StatusMessaage = "State save sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public StateModel UpdateState(StateModel _objdata)
        {
            tbl_States _objproduct = new tbl_States();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_States.Where(x => x.int_Id == _objdata.intStateId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_States _log = new tbl_States();

                        _log               = dataContext.tbl_States.Where(x => x.int_Id == _objdata.intStateId).FirstOrDefault();
                        _log.v_State       = _objdata.strStateName;
                        _log.int_CountryId = _objdata.intCountryId;
                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "State Updated sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #11
0
        public CountryModel UpdateCountry(CountryModel _objdata)
        {
            tbl_Countries _objCountry = new tbl_Countries();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();

                    var _query = dataContext.tbl_Countries.Where(x => x.int_Id == _objdata.intCountryId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_Countries _objTemp = new tbl_Countries();

                        _objTemp                   = dataContext.tbl_Countries.Where(x => x.int_Id == _objdata.intCountryId).FirstOrDefault();
                        _objTemp.v_country         = _objdata.strCountryName;
                        _objTemp.v_currency        = _objdata.strCourncy;
                        _objTemp.v_currency_symbol = _objdata.strCourncySymbol;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "Country updated sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public CategoryModel UpdateCategory(CategoryModel _objdata)
        {
            tbl_category _objcategory = new tbl_category();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_category.Where(x => x.int_id == _objdata.intCategoryId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_category _log = new tbl_category();

                        _log            = dataContext.tbl_category.Where(x => x.int_id == _objdata.intCategoryId).FirstOrDefault();
                        _log.v_category = _objdata.strCategoryName;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "Category updated sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #13
0
        public CountryModel SaveCountry(CountryModel _objdata)
        {
            tbl_Countries _objCountry = new tbl_Countries();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    _objCountry.v_country         = _objdata.strCountryName;
                    _objCountry.v_currency        = _objdata.strCourncy;
                    _objCountry.v_currency_symbol = _objdata.strCourncySymbol;
                    _objCountry.b_IsActive        = true;
                    dataContext.tbl_Countries.Add(_objCountry);
                    dataContext.SaveChanges();
                    dataContext.Database.Connection.Close();
                    _objdata.StatusMessaage = "Country save sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public UserModel SaveUser(UserModel _objdata)
        {
            tbl_All_User _objuser = new tbl_All_User();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();

                    _objuser.int_id        = (int)_objdata.int_id;
                    _objuser.int_User_Type = _objdata.intModuleTypeId;
                    _objuser.v_FirstName   = _objdata.strFirstName;
                    _objuser.v_LastName    = _objdata.strLastName;
                    _objuser.v_EmailId     = _objdata.strEmailId;
                    _objuser.v_MobileNo    = _objdata.strMobileNo;
                    _objuser.int_CountryId = _objdata.intCityId;
                    _objuser.int_StateId   = _objdata.intStateId;
                    _objuser.int_CityId    = _objdata.intCityId;
                    _objuser.v_address     = _objdata.strAddress;
                    _objuser.v_Password    = _objdata.strPassword;
                    _objuser.dt_CreatedOn  = DateTime.Now;
                    _objuser.b_IsActive    = true;
                    dataContext.tbl_All_User.Add(_objuser);
                    dataContext.SaveChanges();
                    dataContext.Database.Connection.Close();
                    _objdata.StatusMessaage = "User save sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public object GetUserById(int intUserId)
        {
            try
            {
                UserModel _usermodal = new UserModel();
                using (newconecommerce dataContext = new newconecommerce())
                {
                    _usermodal = (from x in dataContext.tbl_All_User
                                  where x.int_id == intUserId
                                  select new UserModel
                    {
                        intModuleTypeId = (int)x.int_User_Type,
                        int_id = x.int_id,
                        strFirstName = x.v_FirstName,
                        strLastName = x.v_LastName,
                        strEmailId = x.v_EmailId,
                        strMobileNo = x.v_MobileNo,
                        intCountryId = (int)x.int_CountryId,
                        intCityId = (int)x.int_CityId,
                        intStateId = (int)x.int_StateId,
                        strAddress = x.v_address,
                        strPin = x.v_Pin,
                        strPassword = x.v_Password
                    }).FirstOrDefault();

                    return(new ResponseModel {
                        StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = _usermodal
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #16
0
 public List <CityModel> CityMastersList(List <CityModel> _listCity)
 {
     try
     {
         using (newconecommerce dataContext = new newconecommerce())
         {
             List <CityModel> _list = (from _City in dataContext.tbl_Cities
                                       join _states in dataContext.tbl_States on _City.int_Id equals _states.int_Id
                                       join _country in dataContext.tbl_Countries on _states.int_CountryId equals _country.int_Id
                                       where _country.b_IsActive == true && _City.b_flag == true
                                       select new CityModel
             {
                 intCityId = _City.int_Id,
                 strCityName = _City.v_City,
                 intStateId = _states.int_Id,
                 strStateName = _states.v_State,
                 intCountryId = _country.int_Id,
                 strCountryName = _country.v_country
             }).ToList();
             return(_list);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public BrandModel UpdateBrand(BrandModel _objdata)
        {
            tbl_Brands _objBrand = new tbl_Brands();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var _query = dataContext.tbl_Brands.Where(x => x.int_id == _objdata.intBrandId).FirstOrDefault();
                    if (_query != null)
                    {
                        tbl_Brands _log = new tbl_Brands();

                        _log        = dataContext.tbl_Brands.Where(x => x.int_id == _objdata.intBrandId).FirstOrDefault();
                        _log.v_name = _objdata.strBrandName;

                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();
                    }
                    _objdata.StatusMessaage = "Brand updated sucessfully.";
                    return(_objdata);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #18
0
        public UserModel CheckLogin(LoginViewModel _login)
        {
            try
            {
                UserModel _log = new UserModel();
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();

                    var command = dataContext.Database.Connection.CreateCommand();
                    command.CommandText = "[usp_user_login]";
                    command.CommandType = CommandType.StoredProcedure;
                    var p  = new SqlParameter("@v_EmailId", _login.strEmailId);
                    var p1 = new SqlParameter("@v_Password", _login.strPassword);
                    //var p2 = new SqlParameter("@v_MobileNo", _login.strMobileNo);
                    //var p3 = new SqlParameter("@intModuleTypeId", _login.intModuleTypeId);
                    //var p4 = new SqlParameter("@strDeviceId", _login.strDeviceId);
                    //var p5 = new SqlParameter("@strDevicetoken", _login.strDevicetoken);
                    //var p6 = new SqlParameter("@strDevicemode", _login.strDevicemode);
                    command.Parameters.Add(p);
                    command.Parameters.Add(p1);
                    //command.Parameters.Add(p2);
                    //command.Parameters.Add(p3);
                    //command.Parameters.Add(p4);
                    //command.Parameters.Add(p5);
                    //command.Parameters.Add(p6);
                    var     reader = command.ExecuteReader();
                    DataSet oDS    = new DataSet();
                    while (!reader.IsClosed)
                    {
                        oDS.Tables.Add().Load(reader);
                    }


                    if (oDS.Tables[0].Rows.Count != 0)
                    {
                        _log.intUserId   = Convert.ToInt32(oDS.Tables[0].Rows[0]["int_id"]);
                        _log.strName     = oDS.Tables[0].Rows[0]["strName"].ToString();
                        _log.strEmailId  = oDS.Tables[0].Rows[0]["strEmailId"].ToString();
                        _log.strMobileNo = oDS.Tables[0].Rows[0]["strMobileNo"].ToString();
                        dataContext.Database.Connection.Close();
                    }
                    else
                    {
                        _log.StatusMessaage = oDS.Tables[0].Rows[0]["Msg"].ToString();
                    }
                }
                return(_log);
                //return new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = _log };
            }
            catch (Exception ex)
            {
                CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true);

                throw ex;
            }
        }
        //public object CheckLogin(UserModel _login)
        //{
        //    tbl_All_User log = new tbl_All_User();
        //    try
        //    {
        //        using (newconecommerce dataContext = new newconecommerce())
        //        {
        //            dataContext.Database.Connection.Open();
        //            var query = dataContext.tbl_All_User.Where(a => a.v_EmailId == _login.strEmailId || a.v_MobileNo == _login.strEmailId && a.v_Password == _login.strPassword).FirstOrDefault();

        //            var querye = dataContext.tbl_All_User.Where(a => a.v_EmailId == _login.strEmailId || a.v_MobileNo == _login.strMobileNo).FirstOrDefault();
        //            var _checkAlreadyLogin = (object)null;
        //            if (query!=null)
        //             _checkAlreadyLogin = (from x in dataContext.tbl_OTP
        //                                      where x.int_user_id == query.int_id && x.dt_logout_time == null
        //                                      select x.int_user_id).FirstOrDefault();

        //            if (querye != null)
        //            {
        //                if (query == null)
        //                {
        //                    return new ResponseModel { StatusCode = (int)CCommon.StatusCode.UnAuthorizedAccess, StatusMessaage = "Email id and password do not match.", data = log };
        //                }
        //                else if (_checkAlreadyLogin != null)
        //                {
        //                    return new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Already logged in with other device." };
        //                }
        //                else
        //                {
        //                    Random generator = new Random();
        //                    string number = generator.Next(1, 10000).ToString("D4");
        //                    string strMessage = "Your OTP for Just Cool App is :" + number + ". Regards Just Cool.com";

        //                    tbl_OTP _objLoginInput = new tbl_OTP();
        //                    _objLoginInput.int_moduleType_id = _login.intModuleTypeId;
        //                    _objLoginInput.int_user_id = _login.int_id;
        //                    _objLoginInput.int_OTP = Convert.ToInt32(number);
        //                    _objLoginInput.dt_OTP_created = DateTime.Now;
        //                    _objLoginInput.dt_login_time = DateTime.Now;
        //                    _objLoginInput.v_device_id = _login.strDeviceId;
        //                    _objLoginInput.v_device_token = _login.strDevicetoken;
        //                    _objLoginInput.v_device_token = _login.strDevicemode;
        //                    _objLoginInput.dt_created_on = DateTime.Now;
        //                    dataContext.tbl_OTP.Add(_objLoginInput);
        //                    dataContext.SaveChanges();
        //                    dataContext.Database.Connection.Close();
        //                }
        //                log = query;
        //                return new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = log };
        //            }
        //            else
        //            {
        //                return new ResponseModel { StatusCode = (int)CCommon.StatusCode.InvalidMailId, StatusMessaage = "Could not find email id in our system.", data = log };
        //            }

        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true);
        //        return new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = log };
        //    }
        //}
        public object CheckLogin(UserModel _login)
        {
            try
            {
                Postloginres _log = new Postloginres();
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();
                    var command = dataContext.Database.Connection.CreateCommand();
                    command.CommandText = "usp_user_login";
                    command.CommandType = CommandType.StoredProcedure;
                    var p  = new SqlParameter("@v_EmailId", _login.strEmailId);
                    var p1 = new SqlParameter("@v_Password", _login.strPassword);
                    var p2 = new SqlParameter("@v_MobileNo", _login.strMobileNo);
                    var p3 = new SqlParameter("@intModuleTypeId", _login.intModuleTypeId);
                    var p4 = new SqlParameter("@strDeviceId", _login.strDeviceId);
                    var p5 = new SqlParameter("@strDevicetoken", _login.strDevicetoken);
                    var p6 = new SqlParameter("@strDevicemode", _login.strDevicemode);
                    command.Parameters.Add(p);
                    command.Parameters.Add(p1);
                    command.Parameters.Add(p2);
                    command.Parameters.Add(p3);
                    command.Parameters.Add(p4);
                    command.Parameters.Add(p5);
                    command.Parameters.Add(p6);
                    var     reader = command.ExecuteReader();
                    DataSet oDS    = new DataSet();
                    while (!reader.IsClosed)
                    {
                        oDS.Tables.Add().Load(reader);
                    }


                    if (oDS.Tables[0].Rows.Count != 0)
                    {
                        _log.intUserId   = Convert.ToInt32(oDS.Tables[0].Rows[0]["int_id"]);
                        _log.strName     = oDS.Tables[0].Rows[0]["strName"].ToString();
                        _log.strEmailId  = oDS.Tables[0].Rows[0]["strEmailId"].ToString();
                        _log.strMobileNo = oDS.Tables[0].Rows[0]["strMobileNo"].ToString();
                        _log.strMsg      = oDS.Tables[0].Rows[0]["Msg"].ToString();
                        dataContext.Database.Connection.Close();
                    }
                    dataContext.Database.Connection.Close();
                }

                return(new ResponseModel {
                    StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = _log
                });
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public object PostLogin(Postloginreq _login)
        {
            try
            {
                Random generator  = new Random();
                string number     = generator.Next(1, 10000).ToString("D4");
                string strMessage = "Your OTP for Just Cool App is :" + number + ". Regards Corvi.com";

                using (newconecommerce dataContext = new newconecommerce())
                {
                    var query = (from x in dataContext.tbl_OTP
                                 where x.int_user_id == _login.intloginId && x.dt_logout_time == null
                                 select x.int_user_id).FirstOrDefault();

                    if (query != null)
                    {
                        return(new ResponseModel {
                            StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Already logged in with other device."
                        });
                    }
                    else
                    {
                        dataContext.Database.Connection.Open();

                        tbl_OTP _objLoginInput = new tbl_OTP();
                        _objLoginInput.int_moduleType_id = _login.intModuleTypeId;
                        _objLoginInput.int_user_id       = _login.intloginId;
                        _objLoginInput.int_OTP           = Convert.ToInt32(number);
                        _objLoginInput.dt_OTP_created    = DateTime.Now;
                        _objLoginInput.dt_login_time     = DateTime.Now;
                        _objLoginInput.v_device_id       = _login.strDeviceId;
                        _objLoginInput.v_device_token    = _login.strDevicetoken;
                        _objLoginInput.v_device_token    = _login.strDevicemode;
                        _objLoginInput.dt_created_on     = DateTime.Now;
                        dataContext.tbl_OTP.Add(_objLoginInput);
                        dataContext.SaveChanges();
                        dataContext.Database.Connection.Close();

                        return(new ResponseModel {
                            StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = "Login success"
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true);
                return(new ResponseModel {
                    StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "Failed to login."
                });
            }
        }
        public object getProductCartByUserId(AddToCartModel addtocart)
        {
            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    if (addtocart.int_user_id == 0)
                    {
                        return(new ResponseModel {
                            StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Incorrect Retailer Id."
                        });
                    }
                    else

                    {
                        var result = dataContext.usp_get_user_cart_by_id(addtocart.int_user_id).ToList();
                        if (result.Count > 0)
                        {
                            if (result[0] != null)
                            {
                                MemoryStream    memStream = new MemoryStream();
                                BinaryFormatter formatter = new BinaryFormatter();
                                memStream.Position = 0;
                                memStream          = new MemoryStream();

                                byte[] strTemp = (byte[])result[0];

                                memStream.Write(strTemp, 0, strTemp.Length);
                                memStream.Seek(0, SeekOrigin.Begin);
                                Object obj = (Object)formatter.Deserialize(memStream);
                                addtocart.listProduct = (List <Product>)obj;
                                return(new ResponseModel {
                                    StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = addtocart
                                });
                            }
                        }
                        return(new ResponseModel {
                            StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "No data Found."
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true);
                return(new ResponseModel {
                    StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "Failed to AddToCart."
                });
            }
        }
        public object UserSignUp(UserModel _objdata)
        {
            tbl_All_User _objuser = new tbl_All_User();

            try
            {
                using (newconecommerce dataContext = new newconecommerce())
                {
                    dataContext.Database.Connection.Open();

                    _objuser.int_id        = (int)_objdata.int_id;
                    _objuser.int_User_Type = _objdata.intModuleTypeId;
                    _objuser.v_FirstName   = _objdata.strFirstName;
                    _objuser.v_LastName    = _objdata.strLastName;
                    _objuser.v_EmailId     = _objdata.strEmailId;
                    _objuser.v_MobileNo    = _objdata.strMobileNo;
                    _objuser.int_CountryId = _objdata.intCountryId;
                    _objuser.int_StateId   = _objdata.intStateId;
                    _objuser.int_CityId    = _objdata.intCityId;
                    _objuser.v_address     = _objdata.strAddress;
                    _objuser.v_Pin         = _objdata.strPin;
                    _objuser.v_Password    = _objdata.strPassword;
                    _objuser.dt_CreatedOn  = DateTime.Now;
                    _objuser.b_IsActive    = true;
                    dataContext.tbl_All_User.Add(_objuser);
                    dataContext.SaveChanges();
                    UserModel _model = new UserModel();
                    _model.intUserId = _objuser.int_id;
                    dataContext.Database.Connection.Close();
                    if (_model.intUserId != 0)
                    {
                        return new ResponseModel {
                                   StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = "User save sucessfully."
                        }
                    }
                    ;
                    else
                    {
                        return new ResponseModel {
                                   StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = "something went wrong"
                        }
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public StateModel GetStateById(StateModel _statemodal)
        {
            StateModel _objstate = new StateModel();

            using (newconecommerce dataContext = new newconecommerce())
            {
                _objstate = (from x in dataContext.tbl_States
                             where x.int_Id == _statemodal.intStateId
                             select new StateModel
                {
                    strStateName = x.v_State,
                    intCountryId = (int)x.int_CountryId
                }).FirstOrDefault();

                return(_objstate);
            }
        }
 public List <UserTypeList> GetUserTypeList()
 {
     using (newconecommerce dataContext = new newconecommerce())
     {
         List <UserTypeList> _listUserType = new List <UserTypeList>();
         dataContext.Database.Connection.Open();
         _listUserType = (from _usertype in dataContext.tbl_User_Types.AsEnumerable()
                          select new UserTypeList
         {
             int_id = _usertype.int_Id,
             v_User_Type = _usertype.v_name
         }).ToList();
         _listUserType.Insert(0, new UserTypeList {
             v_User_Type = "--Select User Type--", int_id = 0
         });
         return(_listUserType);
     }
 }
Beispiel #25
0
 public List <ProductCategory> GetCategory()
 {
     using (newconecommerce dataContext = new newconecommerce())
     {
         List <ProductCategory> _listCategory = new List <ProductCategory>();
         dataContext.Database.Connection.Open();
         _listCategory = (from _category in dataContext.tbl_category.AsEnumerable()
                          select new ProductCategory
         {
             int_id = _category.int_id,
             strCategory = _category.v_category
         }).ToList();
         _listCategory.Insert(0, new ProductCategory {
             strCategory = "--Select Category--", int_id = 0
         });
         return(_listCategory);
     }
 }
Beispiel #26
0
 public List <StateModel> GetState()
 {
     using (newconecommerce dataContext = new newconecommerce())
     {
         List <StateModel> _listState = new List <StateModel>();
         dataContext.Database.Connection.Open();
         _listState = (from _state in dataContext.tbl_States.AsEnumerable()
                       select new StateModel
         {
             intStateId = _state.int_Id,
             strStateName = _state.v_State
         }).ToList();
         _listState.Insert(0, new StateModel {
             strStateName = "--Select State--"
         });
         return(_listState);
     }
 }
 public List <CountryModel> GetCountry()
 {
     using (newconecommerce dataContext = new newconecommerce())
     {
         List <CountryModel> _listCountry = new List <CountryModel>();
         dataContext.Database.Connection.Open();
         _listCountry = (from _country in dataContext.tbl_Countries.AsEnumerable()
                         select new CountryModel
         {
             intCountryId = _country.int_Id,
             strCountryName = _country.v_country
         }).ToList();
         _listCountry.Insert(0, new CountryModel {
             strCountryName = "--Select Country--"
         });
         return(_listCountry);
     }
 }
Beispiel #28
0
 public List <ProductBrands> GetBrands()
 {
     using (newconecommerce dataContext = new newconecommerce())
     {
         List <ProductBrands> _listBrand = new List <ProductBrands>();
         dataContext.Database.Connection.Open();
         _listBrand = (from _brand in dataContext.tbl_Brands.AsEnumerable()
                       select new ProductBrands
         {
             int_id = _brand.int_id,
             strBrands = _brand.v_name
         }).ToList();
         _listBrand.Insert(0, new ProductBrands {
             strBrands = "--Select Brand--", int_id = 0
         });
         return(_listBrand);
     }
 }
        public CategoryModel GetCategoryById(CategoryModel _categorymodal)
        {
            CategoryModel _objcategory = new CategoryModel();

            using (newconecommerce dataContext = new newconecommerce())
            {
                _objcategory = (from x in dataContext.tbl_category
                                where x.int_id == _categorymodal.intCategoryId
                                select new CategoryModel
                {
                    strCategoryName = x.v_category
                }).AsEnumerable().Select(x => new CategoryModel
                {
                    strCategoryName = x.strCategoryName
                }).FirstOrDefault();

                return(_objcategory);
            }
        }
        public BrandModel GetBrandById(BrandModel _Brandmodal)
        {
            BrandModel _objBrand = new BrandModel();

            using (newconecommerce dataContext = new newconecommerce())
            {
                _objBrand = (from x in dataContext.tbl_Brands
                             where x.int_id == _Brandmodal.intBrandId
                             select new BrandModel
                {
                    strBrandName = x.v_name
                }).AsEnumerable().Select(x => new BrandModel
                {
                    strBrandName = x.strBrandName
                }).FirstOrDefault();

                return(_objBrand);
            }
        }