public static List <SelectListModel> GetCustomerType() { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var custTypeList = myshop.Gbl_Master_CustomerType.Where(custType => custType.IsDeleted == false && custType.ShopId == WebSession.ShopId).OrderBy(x => x.CustomerType).ToList(); if (custTypeList.Count > 0) { foreach (Gbl_Master_CustomerType currentItem in custTypeList) { SelectListModel newItem = new SelectListModel(); newItem.Text = currentItem.CustomerType; newItem.Value = currentItem.CustomerTypeId; list.Add(newItem); } } return(list); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public Enums.LoginStatus ResetPassword(string username, string password) { try { string passHash = Utility.getHash(password); myShop = new MyshopDb(); var IsSet = myShop.Gbl_Master_User.Where(user => user.Username.ToLower().Equals(username.ToLower()) && user.IsActive == true && user.IsBlocked == false && user.IsDeleted == false).FirstOrDefault(); if (IsSet != null) { IsSet.ModificationDate = DateTime.Now; IsSet.ModifiedBy = IsSet.UserId; IsSet.IsSync = false; IsSet.Password = passHash; myShop.Entry(IsSet).State = EntityState.Modified; myShop.SaveChanges(); return(Enums.LoginStatus.Authenticate); } else { return(Enums.LoginStatus.InvalidUser); } } catch (Exception) { return(Enums.LoginStatus.Exception); } }
public List <ExpTypeModel> GetExpTypeJson() { try { myshop = new MyshopDb(); var expList = (from exp in myshop.Gbl_Master_ExpenseType.Where(x => x.IsDeleted == false && x.ShopId.Equals(WebSession.ShopId)) orderby exp.ExpenseType select new ExpTypeModel { ExpType = exp.ExpenseType, ExpTypeId = exp.Id, CreatedDate = exp.CreatedDate, ExpTypeDesc = exp.Description ?? "No Description", }).ToList(); return(expList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public List <MorrisChartModel.DonutChart> GetStockEntryTotalQuantityChartData(int[] ProArry = null, int Duration = 30) { ProArry = ProArry ?? new int[5] { 0, 0, 0, 0, 0 }; int[] ProductId = new int[5] { 0, 0, 0, 0, 0 }; for (int i = 0; i < ProArry.Length; i++) { ProductId[i] = ProArry[i]; } List <MorrisChartModel.DonutChart> data = new List <MorrisChartModel.DonutChart>(); myshop = new MyshopDb(); DateTime lastDate = DateTime.Now.AddDays(-Duration); Array.Sort(ProductId); foreach (int proid in ProductId) { MorrisChartModel.DonutChart item = new MorrisChartModel.DonutChart(); var proColl = myshop.Stk_Dtl_Entry.Where(x => x.ProductId.Equals(proid) && x.IsDeleted == false && x.CreatedDate > lastDate).ToList(); if (proColl != null && proColl.Count > 0) { item.label = myshop.Gbl_Master_Product.Where(x => x.ProductId == proid && x.IsDeleted == false).FirstOrDefault().ProductName; item.value = proColl.Sum(x => x.Qty); data.Add(item); } } var products = myshop.Stk_Dtl_Entry.Where(x => ProductId.Contains(x.ProductId) && x.IsDeleted == false).ToList(); return(data); }
public IEnumerable <object> GetCustomerTypeJson() { try { myshop = new MyshopDb(); var catList = (from custType in myshop.Gbl_Master_CustomerType.Where(x => x.IsDeleted == false && x.ShopId.Equals(WebSession.ShopId)) orderby custType.CustomerType select new { custType.CustomerTypeId, custType.CustomerType, custType.CreatedDate, Description = custType.Description ?? "No Description", custType.ShopId }).ToList(); return(catList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public IEnumerable <object> GetUnitJson() { try { myshop = new MyshopDb(); var unitList = (from unit in myshop.Gbl_Master_Unit.Where(x => x.IsDeleted == false && x.ShopId.Equals(WebSession.ShopId)) orderby unit.UnitName select new { unit.UnitId, unit.UnitName, unit.CreatedDate, Description = unit.Description ?? "No Description", unit.ShopId }).ToList(); return(unitList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public Enums.CrudStatus SetAccess(List <UserAccessModel> model) { try { int result = 0; myshop = new MyshopDb(); foreach (UserAccessModel item in model) { var user = myshop.Gbl_Master_User.Where(x => x.IsDeleted == false && x.UserId.Equals(item.UserId)).FirstOrDefault(); if (user != null) { user.IsDeleted = false; user.IsSync = false; user.ModificationDate = DateTime.Now; user.ModifiedBy = WebSession.UserId; user.IsActive = item.IsActive; user.IsBlocked = item.IsBlocked; myshop.Entry(user).State = EntityState.Modified; result += myshop.SaveChanges(); } } return(Utility.CrudStatus(result, Enums.CrudType.Update)); } catch (Exception) { throw; } }
public static List <string> GetStateName(string stateName) { try { myshop = new MyshopDb(); List <string> list = new List <string>(); var stateList = myshop.Gbl_Master_State.Where(state => state.IsDeleted == false && state.StateName.IndexOf(stateName) > -1).OrderBy(x => x.StateName).ToList(); if (stateList.Count > 0) { foreach (Gbl_Master_State currentItem in stateList) { list.Add(currentItem.StateName); } } return(list); } catch (Exception ex) { return(new List <string> { "No State" }); } finally { if (myshop != null) { myshop = null; } } }
public static List <string> GetCityName(string cityName) { try { myshop = new MyshopDb(); List <string> list = new List <string>(); var cityList = myshop.Gbl_Master_City.Where(city => city.IsDeleted == false && city.CityName.IndexOf(cityName) > -1).OrderBy(x => x.CityName).ToList(); if (cityList.Count > 0) { foreach (Gbl_Master_City currentItem in cityList) { list.Add(currentItem.CityName); } } return(list); } catch (Exception ex) { return(new List <string> { "No City" }); } finally { if (myshop != null) { myshop = null; } } }
public static List <SelectListModel> GetNotificationTypeList() { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var NotiTypeList = myshop.Gbl_Master_NotificationType.Where(noti => noti.IsDeleted == false && noti.ShopId == WebSession.ShopId).OrderBy(x => x.NotificationType).ToList(); if (NotiTypeList.Count > 0) { foreach (Gbl_Master_NotificationType currentItem in NotiTypeList) { SelectListModel newItem = new SelectListModel(); newItem.Text = currentItem.NotificationType; newItem.Value = currentItem.NotificationTypeId; list.Add(newItem); } } return(list); } catch (Exception ex) { throw ex; } finally { if (myshop != null) { myshop = null; } } }
public static List <SelectListModel> GetShopList() { try { myshop = new MyshopDb(); var shopList = (from map in myshop.User_ShopMapper.Where(map => map.IsDeleted == false && map.UserId == WebSession.UserId) from shop in myshop.Gbl_Master_Shop.Where(shops => shops.IsDeleted == false && shops.ShopId.Equals(map.ShopId)) select new SelectListModel { Text = shop.Name, Value = shop.ShopId } ).ToList(); return(shopList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public static IEnumerable <object> GetUserJsonWithPhoto(bool allList = false, string searchValue = "") { try { myshop = new MyshopDb(); var userList = (from user in myshop.Gbl_Master_User.Where(x => x.IsDeleted == false && (searchValue == "" || x.Firstname.ToLower().Contains(searchValue)) || (searchValue == "" || x.Lastname.ToLower().Contains(searchValue)) || (searchValue == "" || x.Username.ToLower().Contains(searchValue)) || (searchValue == "" || x.Mobile.ToLower().Contains(searchValue)) ) from userType in myshop.Gbl_Master_UserType.Where(x => x.IsDeleted == false && user.UserTypeId.Equals(x.UserTypeId)) orderby user.Firstname select new UserModel { Username = user.Username, Name = user.Firstname + " " + user.Lastname, Mobile = user.Mobile, Gender = user.Gender, UserType = userType.UserType, UserTypeId = user.UserTypeId, UserId = user.UserId, CreatedDate = user.CreationDate, IsActive = user.IsActive, IsBlocked = user.IsBlocked, Img = user.Photo, Photo = string.Empty }).ToList(); if (allList) { var currentUser = userList.Where(x => x.UserId.Equals(WebSession.UserId)).FirstOrDefault(); if (currentUser != null) { userList.Remove(currentUser); } } foreach (var item in userList) { if (item.Img != null) { item.Photo = Convert.ToBase64String(Utility.GetImageThumbnails(item.Img, 100)); item.Img = new byte[0]; } } return(userList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public static List <SelectListModel> GetExpenseTypeList() { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var userList = myshop.Gbl_Master_ExpenseType.Where(user => user.IsDeleted == false && user.ShopId == WebSession.ShopId).OrderBy(x => x.ExpenseType).ToList(); if (userList.Count > 0) { foreach (Gbl_Master_ExpenseType currentItem in userList) { SelectListModel newItem = new SelectListModel(); newItem.Text = currentItem.ExpenseType; newItem.Value = currentItem.Id; list.Add(newItem); } } return(list); } catch (Exception ex) { return(new List <SelectListModel>()); } finally { if (myshop != null) { myshop = null; } } }
public static List <SelectListModel> GetUserList() { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var userList = myshop.Gbl_Master_User.Where(user => user.IsDeleted == false && user.ShopId == WebSession.ShopId).OrderBy(x => x.Firstname).ToList(); if (userList.Count > 0) { foreach (Gbl_Master_User currentItem in userList) { SelectListModel newItem = new SelectListModel(); newItem.Text = string.Format("{0} {1}", currentItem.Firstname, currentItem.Lastname); newItem.Value = currentItem.UserId; list.Add(newItem); } } return(list); } catch (Exception ex) { return(new List <SelectListModel>()); } finally { if (myshop != null) { myshop = null; } } }
public IEnumerable <object> GetBrandJson() { try { myshop = new MyshopDb(); var brandList = (from brand in myshop.Gbl_Master_Brand.Where(x => x.IsDeleted == false && x.ShopId.Equals(WebSession.ShopId)) orderby brand.BrandName select new { brand.BrandId, brand.BrandName, brand.CreatedDate, Description = brand.Description ?? "No Description", brand.ShopId }).ToList(); return(brandList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public static Tuple <int, byte[]> FileUpload(HttpPostedFileBase Files, string OriginalFileName, string ModuleName, int shopid = 0) { try { myshop = new MyshopDb(); string[] ext = OriginalFileName.Split(new char[] { '.' }); shopid = shopid == 0 ? WebSession.ShopId : shopid; Gbl_Attachment newAttachment = new Gbl_Attachment(); if (!string.IsNullOrEmpty(OriginalFileName)) { newAttachment.Attachment = ReadFile(Files); newAttachment.CreatedBy = WebSession.UserId; newAttachment.CreatedDate = DateTime.Now; newAttachment.FileExtension = ext[ext.Length - 1]; newAttachment.FileName = GetDbFileName(Enums.FileType.Image); newAttachment.ModificationDate = DateTime.Now; newAttachment.ModifiedBy = WebSession.UserId; newAttachment.ModuleName = ModuleName; newAttachment.OriginalFileName = OriginalFileName; newAttachment.ShopId = shopid; newAttachment.IsDeleted = false; newAttachment.IsSync = false; myshop.Gbl_Attachment.Add(newAttachment); myshop.SaveChanges(); } return(new Tuple <int, byte[]>(newAttachment.AttachmentId, newAttachment.Attachment)); } catch (Exception) { throw; } }
public IEnumerable <object> GetVendorJson() { try { myshop = new MyshopDb(); var venList = (from ven in myshop.Gbl_Master_Vendor.Where(x => x.IsDeleted == false && x.ShopId.Equals(WebSession.ShopId)) orderby ven.VendorName select new { ven.VendorId, ven.VendorName, ven.VendorMobile, VendorAddress = ven.VendorAddress ?? "No Description", ven.CreatedDate, Description = ven.Description ?? "No Description", ven.ShopId }).ToList(); return(venList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public static bool isExist(Enums.ValidateDataOf DataType, string Data) { myshop = new MyshopDb(); int count = 0; switch (DataType) { case Enums.ValidateDataOf.PanCard: count = myshop.Gbl_Master_Employee.Where(x => x.PANCardNo.ToLower().Equals(Data.ToLower())).Count(); return(count > 0 ? true : false); case Enums.ValidateDataOf.AadharCard: count = myshop.Gbl_Master_Employee.Where(x => x.AadharNo.ToLower().Equals(Data.ToLower())).Count(); return(count > 0 ? true : false); case Enums.ValidateDataOf.Email: count = myshop.Gbl_Master_User.Where(x => x.Username.ToLower().Equals(Data.ToLower())).Count(); return(count > 0 ? true : false); case Enums.ValidateDataOf.Mobile: count = myshop.Gbl_Master_User.Where(x => x.Mobile.ToLower().Equals(Data.ToLower())).Count(); return(count > 0 ? true : false); default: return(false); } }
public List <SelectListModel> GetShop() { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var bankList = myshop.Gbl_Master_Shop.Where(shop => shop.IsDeleted == false).OrderBy(x => x.Name).ToList(); if (bankList.Count > 0) { foreach (Gbl_Master_Shop currentItem in bankList) { SelectListModel newItem = new SelectListModel(); newItem.Text = currentItem.Name; newItem.Value = currentItem.ShopId; list.Add(newItem); } } return(list); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public IEnumerable <object> TopExpenses(int Year, int Month) { myshop = new MyshopDb(); var monthlyExpense = myshop.Exp_Dtl_New.Where(x => x.IsDeleted == false && x.CreatedDate.Year == Year && x.CreatedDate.Month == Month && x.ShopId.Equals(WebSession.ShopId)).ToList().Sum(x => x.Qty * x.Gbl_Master_ExpenseItem.Price); return(myshop.Exp_Dtl_New.Where(x => x.IsDeleted == false && x.CreatedDate.Year == Year && x.CreatedDate.Month == Month && x.ShopId.Equals(WebSession.ShopId)).GroupBy(x => x.Gbl_Master_ExpenseItem.Name).Select(x => new { Amount = x.Sum(y => y.Qty * y.Gbl_Master_ExpenseItem.Price), Item = x.Key, MonthlyExpense = monthlyExpense }).OrderByDescending(x => x.Amount)); }
public IEnumerable <object> GetMapJson(int userid) { try { myshop = new MyshopDb(); var userList = (from map in myshop.User_ShopMapper.Where(x => x.IsDeleted == false && x.UserId.Equals(userid)) from user in myshop.Gbl_Master_User.Where(x => x.IsDeleted == false && map.UserId.Equals(x.UserId)) from shop in myshop.Gbl_Master_Shop.Where(x => x.IsDeleted == false && map.ShopId.Equals(x.ShopId)) orderby user.Firstname select new { Name = user.Firstname + " " + user.Lastname, ShopName = shop.Name, shop.Address, CreatedDate = user.CreationDate, MapId = map.Id, ShopId = shop.ShopId }).ToList(); return(userList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public static int DeleteRecord <T>(T row) where T : class { MyshopDb dbContext = new MyshopDb(); dbContext.Entry(row).State = EntityState.Modified; return(dbContext.SaveChanges()); }
public List <MorrisChartModel.DonutChart> GetTotalCustomerTypeChartData(int[] CustType = null, int Duration = 30) { CustType = CustType ?? new int[5] { 0, 0, 0, 0, 0 }; int[] CustTypeId = new int[5] { 0, 0, 0, 0, 0 }; for (int i = 0; i < CustType.Length; i++) { CustTypeId[i] = CustType[i]; } List <MorrisChartModel.DonutChart> data = new List <MorrisChartModel.DonutChart>(); myshop = new MyshopDb(); DateTime lastDate = DateTime.Now.AddDays(-Duration); Array.Sort(CustTypeId); foreach (int custid in CustTypeId) { MorrisChartModel.DonutChart item = new MorrisChartModel.DonutChart(); var CustCollection = myshop.Gbl_Master_Customer.Where(x => x.CustomerTypeId.Equals(custid) && x.IsDeleted == false && x.CreatedDate > lastDate).ToList(); if (CustCollection != null && CustCollection.Count > 0) { item.label = myshop.Gbl_Master_CustomerType.Where(x => x.CustomerTypeId == custid && x.IsDeleted == false).FirstOrDefault().CustomerType; item.value = CustCollection.Count(); data.Add(item); } } //var products = myshop.Stk_Dtl_Entry.Where(x => CustTypeId.Contains(x.ProductId) && x.IsDeleted == false).ToList(); return(data); }
public List <UserNotificationModel> GetUserNotificationList() { try { myshop = new MyshopDb(); var notifyList = (from x in myshop.Gbl_Master_Notification.Where( x => x.IsDeleted == false && (x.UserId.Equals(WebSession.UserId) || x.IsForAll == true) && DbFunctions.TruncateTime(x.MessageExpireDate) >= DbFunctions.TruncateTime(DateTime.Now) && x.IsRead == false && x.IsPushed == true && DbFunctions.TruncateTime(x.PushedDate) <= DbFunctions.TruncateTime(DateTime.Now) && x.ShopId.Equals(WebSession.ShopId) && (x.Gbl_Master_NotificationType.NotificationType.ToLower().IndexOf("push") > -1 || x.Gbl_Master_NotificationType.NotificationType.ToLower().IndexOf("web") > -1) && x.Gbl_Master_NotificationType.IsDeleted == false && x.Gbl_Master_NotificationType.ShopId.Equals(WebSession.ShopId) ) select new UserNotificationModel { Message = x.Message, NotificationId = x.NotificationId }).OrderBy(y => y.NotificationId).ToList(); return(notifyList); } catch (Exception ex) { return(new List <UserNotificationModel>()); } }
public List <MorrisChartModel.DonutChart> GetSalesStatusData(int Duration = 30) { List <MorrisChartModel.DonutChart> donutCharts = new List <MorrisChartModel.DonutChart>(); myshop = new MyshopDb(); var sales = myshop.Sale_Tr_Invoice.Where(x => x.ShopId.Equals(WebSession.ShopId) && !x.IsDeleted).ToList(); MorrisChartModel.DonutChart cancelled = new MorrisChartModel.DonutChart(); cancelled.label = "Cancelled"; cancelled.labelColor = "red"; cancelled.value = sales.Where(x => x.IsCancelled).Count(); MorrisChartModel.DonutChart billed = new MorrisChartModel.DonutChart(); billed.label = "Billed"; billed.labelColor = "green"; billed.value = sales.Where(x => !x.IsCancelled && !x.IsAmountRefunded).Count(); MorrisChartModel.DonutChart returned = new MorrisChartModel.DonutChart(); returned.label = "Returned"; returned.labelColor = "orange"; returned.value = sales.Where(x => !x.IsCancelled).Count(); donutCharts.Add(billed); donutCharts.Add(cancelled); donutCharts.Add(returned); return(donutCharts); }
public Enums.CrudStatus DeleteUserNotificationList(int notificationId) { try { myshop = new MyshopDb(); var notify = myshop.Gbl_Master_Notification.Where(x => x.NotificationId.Equals(notificationId) && x.ShopId.Equals(WebSession.ShopId) && x.UserId.Equals(WebSession.UserId)).FirstOrDefault(); if (notify != null) { notify.IsDeleted = true; notify.ModificationDate = DateTime.Now; notify.ModifiedBy = WebSession.UserId; notify.IsSync = false; myshop.Entry(notify).State = EntityState.Modified; int result = myshop.SaveChanges(); return(result > 0 ? Enums.CrudStatus.Deleted : Enums.CrudStatus.NotDeleted); } else { return(Enums.CrudStatus.NotExist); } } catch (Exception ex) { return(Enums.CrudStatus.Exception); } }
public Enums.CrudStatus SetExpType(ExpTypeModel model, Enums.CrudType crudType) { try { myshop = new MyshopDb(); var oldexp = myshop.Gbl_Master_ExpenseType.Where(exp => (exp.Id.Equals(model.ExpTypeId) || (exp.ExpenseType.ToLower().Equals(model.ExpType) || exp.ExpenseType.ToLower().Contains(model.ExpType))) && exp.IsDeleted == false && exp.ShopId.Equals(WebSession.ShopId)).FirstOrDefault(); if (oldexp != null) { if (oldexp.ExpenseType.ToLower() == model.ExpType) { return(Enums.CrudStatus.AlreadyExistForSameShop); } var isUsed = myshop.Gbl_Master_ExpenseItem.Where(x => x.IsDeleted == false && x.ExpTypeId.Equals(model.ExpTypeId) && x.ShopId.Equals(WebSession.ShopId)).Count() > 0 ? true : false; if (isUsed) { return(Enums.CrudStatus.AlreadyInUse); } oldexp.IsSync = false; oldexp.ModifiedBy = WebSession.UserId; oldexp.ModifiedDate = DateTime.Now; if (crudType == Enums.CrudType.Update) { oldexp.ExpenseType = model.ExpType; oldexp.Description = model.ExpTypeDesc; } else if (crudType == Enums.CrudType.Delete) { oldexp.IsDeleted = true; } myshop.Entry(oldexp).State = EntityState.Modified; } else if (crudType == Enums.CrudType.Insert) { Gbl_Master_ExpenseType newexp = new Gbl_Master_ExpenseType(); newexp.ExpenseType = model.ExpType; newexp.CreatedBy = WebSession.UserId; newexp.CreatedDate = DateTime.Now; newexp.Description = model.ExpTypeDesc; newexp.IsDeleted = false; newexp.IsSync = false; newexp.ShopId = WebSession.ShopId; newexp.ModifiedBy = WebSession.UserId; newexp.ModifiedDate = DateTime.Now; myshop.Entry(newexp).State = EntityState.Added; } int result = myshop.SaveChanges(); return(Utility.CrudStatus(result, crudType)); } catch (Exception ex) { return(Enums.CrudStatus.Exception); } finally { } }
public IEnumerable <object> GetSubCatJson() { try { myshop = new MyshopDb(); var catList = (from subCat in myshop.Gbl_Master_SubCategory.Where(x => x.IsDeleted == false && x.ShopId.Equals(WebSession.ShopId)) from cat in myshop.Gbl_Master_Category.Where(x => x.IsDeleted == false && x.ShopId.Equals(subCat.ShopId) && x.CatId.Equals(subCat.CatId)) orderby subCat.SubCatName select new { cat.CatId, cat.CatName, subCat.SubCatId, subCat.SubCatName, cat.CreatedDate, Description = subCat.Description ?? "No Description", subCat.ShopId }).ToList(); return(catList); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }
public Enums.CrudStatus UpdateErrorLog(int ErrorId) { try { myshop = new MyshopDb(); var log = myshop.ErrorLogs.Where(x => x.IsDeleted == false && x.Id.Equals(ErrorId)).FirstOrDefault(); if (log == null) { return(Enums.CrudStatus.NotExist); } else { int result = 0; log.IsResolved = true; log.ModifiedDate = DateTime.Now; myshop.Entry(log).State = EntityState.Modified; result = myshop.SaveChanges(); return(result > 0 ? Utility.CrudStatus(result, Enums.CrudType.Update) : Enums.CrudStatus.NoEffect); } } catch (Exception ex) { return(Enums.CrudStatus.Exception); } }
public static List <SelectListModel> GetPayMode() { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var PayList = myshop.Gbl_Master_PayMode.Where(pay => pay.IsDeleted == false).OrderBy(x => x.PayMode).ToList(); if (PayList.Count > 0) { foreach (Gbl_Master_PayMode currentItem in PayList) { SelectListModel newItem = new SelectListModel(); newItem.Text = currentItem.PayMode; newItem.Value = currentItem.PayModeId; list.Add(newItem); } } return(list); } catch (Exception ex) { throw; } finally { if (myshop != null) { myshop = null; } } }