public ResponseStatus Login(string phoneNumber, int loginId) { ResponseStatus response = new ResponseStatus(); using (mom_androidEntities context = new mom_androidEntities()) { userloginmaster u = new userloginmaster(); u.PhoneNumber = phoneNumber; u.LoginID = loginId; u.OTP = SendOTP(u.PhoneNumber); var data = context.userloginmasters.Where(x => x.LoginID == u.LoginID && x.PhoneNumber == u.PhoneNumber).FirstOrDefault(); if (data != null) { context.userloginmasters.Where(p => p.LoginID == u.LoginID && p.PhoneNumber == u.PhoneNumber).ToList().ForEach(x => x.OTP = u.OTP); } var result = context.SaveChanges(); if (result > 0) { response.isSuccess = true; response.serverResponseTime = System.DateTime.Now; } else { response.isSuccess = false; response.serverResponseTime = System.DateTime.Now; } } return(response); }
public IEnumerable <DepartmentMasterModel> GetAllDepartmentList(int DataBaseId) { List <DepartmentMasterModel> data = new List <DepartmentMasterModel>(); MultipleDataBase dataAccess = new MultipleDataBase(); using (mom_androidEntities context = new mom_androidEntities()) { var user = context.userdatabasemasters.Where(u => u.DataBaseId == DataBaseId).FirstOrDefault(); data = dataAccess.GetAllDepartmentList(user.DataBase).ToList(); } return(data); }
public IEnumerable <StockSummaryMasterModel> StockSummary(StockMasterModel model) { List <StockSummaryMasterModel> data = new List <StockSummaryMasterModel>(); MultipleDataBase dataAccess = new MultipleDataBase(); using (mom_androidEntities context = new mom_androidEntities()) { var user = context.userdatabasemasters.Where(u => u.DataBaseId == model.DataBaseId).FirstOrDefault(); data = dataAccess.StockSummary(model, user.DataBase).ToList(); } return(data); }
public IEnumerable <TodayAndLastWeekSalesModel> TodayAndLastWeekSale(SalesSummaryModel model) { List <TodayAndLastWeekSalesModel> data = new List <TodayAndLastWeekSalesModel>(); MultipleDataBase dataAccess = new MultipleDataBase(); using (mom_androidEntities context = new mom_androidEntities()) { var user = context.userdatabasemasters.Where(u => u.DataBaseId == model.DataBaseId).FirstOrDefault(); data = dataAccess.TodayAndLastWeekSale(model, user.DataBase).ToList(); } return(data); }
public IEnumerable <MenuMasterModel> GetAllMenuList() { List <MenuMasterModel> data = new List <MenuMasterModel>(); using (mom_androidEntities context = new mom_androidEntities()) { data = (from m in context.menumasters orderby m.MenuName select new MenuMasterModel() { MenuId = m.MenuId, MenuName = m.MenuName, //ImageUrl = "http://103.233.79.234/Data/EverGreen_Android/MenuPictures/" + m.MenuId + ".jpg", }).ToList(); return(data); } }
public UserModel Login(string phonenumber) { //ResponseStatus response = new ResponseStatus(); UserModel user = new UserModel(); using (mom_androidEntities context = new mom_androidEntities()) { userloginmaster u = new userloginmaster(); var data = context.userloginmasters.Where(x => x.PhoneNumber == phonenumber).FirstOrDefault(); if (data == null) { u.PhoneNumber = phonenumber; u.OTP = SendOTP(u.PhoneNumber); context.userloginmasters.Add(u); } else { var userdata = context.userloginmasters.Where(x => x.PhoneNumber == phonenumber); foreach (var item in userdata) { item.OTP = SendOTP(phonenumber); } } var result = context.SaveChanges(); if (result > 0) { var userdata = context.userloginmasters.Where(x => x.PhoneNumber == phonenumber).FirstOrDefault(); if (userdata != null) { user.LoginID = Convert.ToInt32(userdata.LoginID); user.Name = userdata.Name; user.PhoneNumber = userdata.PhoneNumber; user.OTP = (int)userdata.OTP; user.RoleId = Convert.ToInt32(userdata.RoleId); user.EmailID = userdata.EmailID; //user.DataBaseId = Convert.ToInt32(userdata.DataBaseId); user.StoreId = Convert.ToInt32(userdata.StoreId); //user.ProfilePictureUrl = "http://103.233.79.234/Data/EverGreen_Android/EverGreenProfilePicture/" + userdata.LoginID + ".jpeg"; } } } return(user); }
//string path = "http://103.233.79.234/Data/EverGreen_Android/StorePictures/"; public IEnumerable <DataBaseMasterModel> GetAllStoreByUser(int loginId) { List <DataBaseMasterModel> database = new List <DataBaseMasterModel>(); //DataBaseMasterModel store = new DataBaseMasterModel(); using (mom_androidEntities context = new mom_androidEntities()) { database = (from u in context.userloginmasters join p in context.userpermissionmasters on u.LoginID equals p.LoginID into j1 from j2 in j1.DefaultIfEmpty() join d in context.userdatabasemasters on j2.DataBaseID equals d.DataBaseId into j3 from j4 in j3.DefaultIfEmpty() where u.LoginID == loginId select new DataBaseMasterModel() { DataBaseId = j4.DataBaseId, DataBaseName = j4.DataBaseName }).ToList(); } return(database); }
public IEnumerable <CategoryModel> GetAllCategoryList(int menuid) { List <CategoryModel> data = new List <CategoryModel>(); using (mom_androidEntities context = new mom_androidEntities()) { data = (from c in context.categorymasters where c.MenuId == menuid orderby c.CategoryName select new CategoryModel() { CategoryId = c.CategoryId, CategoryName = c.CategoryName, //CategoryDescription = c.CategoryDescription, //CategoryPictures = "http://103.233.79.234/Data/EverGreen_Android/CategoryPictures/" + c.CategoryId + ".jpg", //StoreName = j2.StoreName, //MenuName = j4.MenuName }).ToList(); return(data); } }
public UserModel Login(string phoneNumber, int otp, int loginId) { UserModel user = new UserModel(); using (mom_androidEntities context = new mom_androidEntities()) { var userdata = context.userloginmasters.Where(u => u.LoginID == loginId && u.PhoneNumber == phoneNumber && u.OTP == otp).FirstOrDefault(); if (userdata != null) { user.LoginID = Convert.ToInt32(userdata.LoginID); user.Name = userdata.Name; user.PhoneNumber = userdata.PhoneNumber; user.OTP = (int)userdata.OTP; user.RoleId = Convert.ToInt32(userdata.RoleId); user.EmailID = userdata.EmailID; //user.DataBaseId = Convert.ToInt32(userdata.DataBaseId); user.StoreId = Convert.ToInt32(userdata.StoreId); //user.ProfilePictureUrl = "http://103.233.79.234/Data/EverGreen_Android/EverGreenProfilePicture/" + result.LoginID + ".jpeg"; } } return(user); }