/* * Gets `UserAcces` string from `Accounts` and converts it into * boolean array. * * Returns array with value all false if username parameter does not match * any `Username` */ public bool[] GetUserAccessArray(string username) { using (CFMMCDEntities db = new CFMMCDEntities()) { bool[] userAccessArray; var user = db.Accounts.Where(o => o.Username.Equals(username)); if (user.Any()) { string userAccessString = user.FirstOrDefault().UserAccess; string[] userAccessStringArray = userAccessString.Split(','); userAccessArray = new bool[userAccessStringArray.Length]; for (int i = 0; i < userAccessStringArray.Length; i++) { userAccessArray[i] = Boolean.Parse(userAccessStringArray[i]); } } else { userAccessArray = new bool[18]; for (int i = 0; i < 19; i++) { userAccessArray[i] = false; } } return(userAccessArray); } }
public bool ExportToExcel(List <CSHMIMP0> MIMRow, List <INVRIRP0> RECRow, List <INVRIMP0> RIMRow, List <Store_Profile> SPRow) { using (CFMMCDEntities db = new CFMMCDEntities()) { DataSet ds = PrepareDataTable(MIMRow, RECRow, RIMRow, SPRow); using (XLWorkbook wb = new XLWorkbook()) { foreach (DataTable dt in ds.Tables) { wb.Worksheets.Add(dt); } HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Charset = ""; string filename = "attachment;filename=Report" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx"; HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; HttpContext.Current.Response.AddHeader("content-disposition", filename); using (MemoryStream MyMemoryStream = new MemoryStream()) { wb.SaveAs(MyMemoryStream); MyMemoryStream.WriteTo(HttpContext.Current.Response.OutputStream); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } } } return(true); }
/* * Check if given * username is available * * Returns false if available (Username does not exist) */ public bool IsUsernameExist(string username) { using (CFMMCDEntities db = new CFMMCDEntities()) { return(db.Accounts.Where(o => o.Username.Equals(username)).Any()); } }
public List <NotificationViewModel> GetVendorItemNotification(string username) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <NotificationViewModel> list = new List <NotificationViewModel>(); Account currentAccount = db.Accounts.Single(o => o.Username.Equals(username)); if (currentAccount.TimeLastLogged != null) { DateTime lastUserAccess = (DateTime)currentAccount.TimeLastLogged; foreach (var v in db.Audit_Log.Where(o => o.Page.Contains("Vendor Master"))) { if (lastUserAccess < v.Date_Time) { NotificationViewModel notif = new NotificationViewModel(); notif.ItemCode = v.ItemId; notif.ItemName = v.Name; notif.Action = v.Page_Action; notif.Page = "Vendor"; list.Add(notif); } } } return(list); } }
public List <GenericDropDownList> SetGroupList() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <GenericDropDownList> list = new List <GenericDropDownList>(); int previousGroup = 0; GenericDropDownList option = new GenericDropDownList(); option.text = ""; option.value = "0"; list.Add(option); foreach (var i in db.ITMGRPs.OrderBy(o => o.Group_Id)) { if (previousGroup == i.Group_Id) { continue; } previousGroup = i.Group_Id; option = new GenericDropDownList(); option.text = i.Group_Name; option.value = i.Group_Id.ToString(); list.Add(option); } return(list); } }
public ValueMealViewModel SearchSingleValueMeal(string SearchItem) { using (CFMMCDEntities db = new CFMMCDEntities()) { CSHVMLP0 VMRow; if (db.CSHVMLP0.Where(o => o.VMLNUM.ToString().Equals(SearchItem)).Any()) { VMRow = db.CSHVMLP0.FirstOrDefault(o => o.VMLNUM.ToString().Equals(SearchItem)); } else if (db.CSHVMLP0.Where(o => o.VMLID.ToString().Equals(SearchItem)).Any()) { VMRow = db.CSHVMLP0.FirstOrDefault(o => o.VMLID.ToString().Equals(SearchItem)); } else { return(null); } ValueMealViewModel vm = new ValueMealViewModel(); vm.VMLNUM = VMRow.VMLNUM.ToString(); vm.VMLNAM = VMRow.VMLNAM.Trim(); vm.VMLPRI = VMRow.VMLPRI.ToString(); vm.VMLPRO = VMRow.VMLPRI.ToString(); vm.MenuItemList = SearchVMMenuItem(vm.VMLNUM); return(vm); } }
/* * Gets password for the username parameter * * Returns empty string if username does not exist */ public bool CheckPassword(string username, string password) { using (CFMMCDEntities db = new CFMMCDEntities()) { // Get `Username` that matches the specified username parameter var user = db.Accounts.Where(o => o.Username.Equals(username)); if (user.Any()) { string pass = user.FirstOrDefault().Password; if (user.FirstOrDefault().Password.Equals(password)) { return(true); } string key = pass.Substring(0, 15); pass = pass.Substring(15); string encodedPass = EncodePassword(password, key); if (encodedPass.Equals(pass)) { return(true); } else { return(false); } } else { return(false); } } }
// Searches Menu Items included in a value meal public List <VMMenuItem> SearchVMMenuItem(string ValueMealNumber) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <CSHVMLP0> VMRowList = new List <CSHVMLP0>(); List <VMMenuItem> MIList = new List <VMMenuItem>(); if (db.CSHVMLP0.Where(o => o.VMLNUM.ToString().Equals(ValueMealNumber)).Any()) { VMRowList = db.CSHVMLP0.Where(o => o.VMLNUM.ToString().Equals(ValueMealNumber)).ToList(); } foreach (var v in VMRowList) { VMMenuItem mi = new VMMenuItem(); mi.MIMMIC = v.VMLMIC.ToString(); mi.MIMNAM = db.CSHMIMP0.Single(o => o.MIMMIC.ToString().Equals(mi.MIMMIC)).MIMNAM; string id = mi.MIMMIC + "A"; if (db.MIM_Price.Where(o => o.Id.Equals(id)).Any()) { mi.MIMPRI = db.MIM_Price.Single(o => o.Id.Equals(id)).MIMPRI.ToString(); mi.MIMPRO = db.MIM_Price.Single(o => o.Id.Equals(id)).MIMPRO.ToString(); } else { mi.MIMPRI = ""; mi.MIMPRO = ""; } mi.VMLQUA = v.VMLQUA.ToString(); MIList.Add(mi); } return(MIList); } }
public bool ExportToPDF(AuditLogViewModel ALViewModel) { using (CFMMCDEntities db = new CFMMCDEntities()) { //Creates a DataTable DataTable dt = new DataTable("AL Report"); //Adds the Columns to the DataTable based on the AuditLog dt.Columns.Add("UserId", typeof(string)); dt.Columns.Add("Date", typeof(string)); dt.Columns.Add("Time", typeof(string)); dt.Columns.Add("Page", typeof(string)); dt.Columns.Add("Page_Action", typeof(string)); dt.Columns.Add("ID", typeof(string)); dt.Columns.Add("Name", typeof(string)); //Puts all the rows of the Audit Log Table List <Audit_Log> AlRow = db.Audit_Log.ToList(); foreach (var vm in AlRow) { var row = dt.NewRow(); row["UserId"] = vm.UserId; row["Date_Time"] = vm.Date_Time.ToString("yyyy-MM-dd hh:mm tt"); row["Page"] = vm.Page; row["Page_Action"] = vm.Page_Action; row["ID"] = vm.Id; row["Name"] = vm.Name; dt.Rows.Add(row); } //Creates a dummy Gridview GridView gv = new GridView(); gv.AllowPaging = false; gv.DataSource = dt; gv.DataBind(); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=AuditLog.pdf"); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); gv.RenderControl(hw); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); #pragma warning disable CS0612 // Type or member is obsolete HTMLWorker htmlparser = new HTMLWorker(pdfDoc); #pragma warning restore CS0612 // Type or member is obsolete PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); HttpContext.Current.Response.Write(pdfDoc); HttpContext.Current.Response.End(); } return(true); }
public static bool DeleteItem(int Id) { using (CFMMCDEntities db = new CFMMCDEntities()) { if (db.ITMGRPs.Where(o => o.Id == Id).Any()) { ITMGRP IGRow = db.ITMGRPs.SingleOrDefault(o => o.Id == Id); if (IGRow.Item_Type == 1) { db.CSHMIMP0.Single(o => o.MIMMIC == IGRow.Item_Code).Group = 0; } else if (IGRow.Item_Type == 2) { db.INVRIMP0.Single(o => o.RIMRIC == IGRow.Item_Code).Group = 0; } if (IGRow.Item_Type == 3) { db.Store_Profile.Single(o => o.STORE_NO == IGRow.Item_Code).Group = 0; } if (IGRow.Item_Type == 4) { foreach (var v in db.INVRIRP0.Where(o => o.RIRMIC == IGRow.Item_Code)) { v.Group = 0; } } db.ITMGRPs.Remove(IGRow); // Save DB try { db.SaveChanges(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Source); System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.WriteLine(e.StackTrace); System.Diagnostics.Debug.WriteLine(e.InnerException); Exception f = e.InnerException; while (f != null) { System.Diagnostics.Debug.WriteLine("INNER:"); System.Diagnostics.Debug.WriteLine(f.Message); System.Diagnostics.Debug.WriteLine(f.Source); f = f.InnerException; } System.Diagnostics.Debug.WriteLine(e.Data); return(false); } return(true); } return(false); } }
public static List <MenuItem> SearchMenuItem(string SearchItem) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <MenuItem> MIList = new List <MenuItem>(); List <CSHMIMP0> MIMRowList; if (SearchItem == null || SearchItem.Equals("")) { return(null); } if (SearchItem.ToUpper().Equals("ALL")) { MIMRowList = db.CSHMIMP0.ToList(); } else if (db.CSHMIMP0.Where(o => o.MIMMIC.ToString().Equals(SearchItem)).Any()) { MIMRowList = db.CSHMIMP0.Where(o => o.MIMMIC.ToString().Equals(SearchItem)).ToList(); } else if (db.CSHMIMP0.Where(o => o.MIMNAM.Trim().Equals(SearchItem)).Any()) { MIMRowList = db.CSHMIMP0.Where(o => o.MIMNAM.Trim().Equals(SearchItem)).ToList(); } else { return(null); } foreach (CSHMIMP0 rim in MIMRowList) { MenuItem mi = new MenuItem(); if (rim.MIMMIC != 0) { mi.MIMMIC = rim.MIMMIC.ToString(); } if (rim.MIMDSC != null) { mi.MIMDSC = rim.MIMDSC.Trim(); } if (rim.MIMLON != null) { mi.MIMLON = rim.MIMLON.Trim(); } if (rim.MIMSTA != null) { mi.MIMSTA = rim.MIMSTA; } MIList.Add(mi); } if (MIList == null || MIList.ElementAt(0) == null) { return(null); } return(MIList); } }
public static VendorMasterViewModel SearchSingleVendor(string SearchItem) { using (CFMMCDEntities db = new CFMMCDEntities()) { INVVEMP0 VMRow; if (db.INVVEMP0.Where(o => o.VEMVEN.ToString().Equals(SearchItem)).Any()) { VMRow = db.INVVEMP0.Single(o => o.VEMVEN.ToString().Equals(SearchItem)); } else { return(null); } VendorMasterViewModel vm = new VendorMasterViewModel(); if (VMRow.VEMVEN != 0) { vm.VEMVEN = VMRow.VEMVEN.ToString(); } if (VMRow.VEMDS1 != null) { vm.VEMDS1 = VMRow.VEMDS1.Trim(); } if (VMRow.VEMLOC != null) { vm.VEMLOC = VMRow.VEMLOC; } if (VMRow.Region != null) { vm.Region = VMRow.Region; } if (VMRow.Province != null) { vm.Province = VMRow.Province; } if (VMRow.City != null) { vm.City = VMRow.City; } vm.Store = VMRow.Store; if ((VMRow.Store != null) && VMRow.Store.Equals("ALL")) { vm.SelectAllCb = true; vm.Store = ""; } if ((VMRow.Except_Store != null) && !(VMRow.Except_Store.Equals(""))) { vm.SelectExceptCb = true; vm.SelectAllCb = false; vm.Store = VMRow.Except_Store; } return(vm); } }
public static bool DeleteGroup(int GroupId) { using (CFMMCDEntities db = new CFMMCDEntities()) { if (db.ITMGRPs.Where(o => o.Group_Id == GroupId).Any()) { db.ITMGRPs.RemoveRange(db.ITMGRPs.Where(o => o.Group_Id == GroupId)); foreach (var v in db.CSHMIMP0.Where(o => o.Group == GroupId)) { v.Group = 0; } foreach (var v in db.INVRIMP0.Where(o => o.Group == GroupId)) { v.Group = 0; } foreach (var v in db.Store_Profile.Where(o => o.Group == GroupId)) { v.Group = 0; } foreach (var v in db.INVRIRP0.Where(o => o.Group == GroupId)) { v.Group = 0; } // Save DB try { db.SaveChanges(); return(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Source); System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.WriteLine(e.StackTrace); System.Diagnostics.Debug.WriteLine(e.InnerException); Exception f = e.InnerException; while (f != null) { System.Diagnostics.Debug.WriteLine("INNER:"); System.Diagnostics.Debug.WriteLine(f.Message); System.Diagnostics.Debug.WriteLine(f.Source); f = f.InnerException; } System.Diagnostics.Debug.WriteLine(e.Data); return(false); } } else { return(false); } } }
public List <CSHVMLP0> GetValueMeal(string Store_No, DateTime DateFrom, DateTime DateTo) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <CSHVMLP0> sublist = db.CSHVMLP0.Where(o => o.STATUS.Equals("A")).ToList(); List <CSHVMLP0> list = new List <CSHVMLP0>(); list.AddRange(sublist); sublist = db.CSHVMLP0.Where(o => o.STATUS.Equals("E")).ToList(); list.AddRange(sublist); return(list); } }
public List <INVMGRP0> GetMaterialGroup(string Store_No, DateTime DateFrom, DateTime DateTo) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <INVMGRP0> sublist = db.INVMGRP0.Where(o => o.STATUS.Equals("A")).ToList(); List <INVMGRP0> list = new List <INVMGRP0>(); list.AddRange(sublist); sublist = db.INVMGRP0.Where(o => o.STATUS.Equals("E")).ToList(); list.AddRange(sublist); return(list); } }
public bool ExportToExcel(AuditLogViewModel ALViewModel) { using (CFMMCDEntities db = new CFMMCDEntities()) { //Creates a DataTable DataTable dt = new DataTable("AL Report"); //Adds the Columns to the DataTable based on the AuditLog dt.Columns.Add("UserId", typeof(string)); dt.Columns.Add("Date_Time", typeof(string)); dt.Columns.Add("Page", typeof(string)); dt.Columns.Add("Page_Action", typeof(string)); dt.Columns.Add("ID", typeof(string)); dt.Columns.Add("Name", typeof(string)); //Puts all the rows of the Audit Log Table List <Audit_Log> AlRow = db.Audit_Log.ToList(); foreach (var vm in AlRow) { var row = dt.NewRow(); row["UserId"] = vm.UserId; row["Date_Time"] = vm.Date_Time.ToString("yyyy-MM-dd hh:mm tt"); row["Page"] = vm.Page; row["Page_Action"] = vm.Page_Action; row["ID"] = vm.Id; row["Name"] = vm.Name; dt.Rows.Add(row); } using (XLWorkbook wb = new XLWorkbook()) { wb.Worksheets.Add(dt); wb.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; wb.Style.Font.Bold = true; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Charset = ""; HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocuments.spreadsheetml.sheet"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename= AuditLog.xlsx"); using (MemoryStream MyMemoryStream = new MemoryStream()) { wb.SaveAs(MyMemoryStream); MyMemoryStream.WriteTo(HttpContext.Current.Response.OutputStream); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } } } return(true); }
public bool DeleteBusinessExtension(BusinessExtensionViewModel BEXViewModel) { using (CFMMCDEntities db = new CFMMCDEntities()) { BUSINESS_EXT bexRow; if (db.BUSINESS_EXT.Where(o => o.ID.ToString().Equals(BEXViewModel.ID)).Any()) { bexRow = db.BUSINESS_EXT.Single(o => o.ID.ToString().Equals(BEXViewModel.ID)); } else { return(false); } // Get position in the table to be used in the deletion of entry in StoreProfile table int index = db.BUSINESS_EXT.ToList().IndexOf(bexRow); // Get Store_Profile rows that contain 'index' in `BET` List <Store_Profile> SPRows = db.Store_Profile.Where(o => o.BET.Contains(index.ToString())).ToList(); for (int i = 0; i < SPRows.Count(); i++) { string BETString = SPRows[i].BET; BETString = BETString.Replace(index.ToString(), ""); // Replace the index with empty BETString = BETString.Replace(",,", ","); // Removes instances of blank between delimiters SPRows[i].BET = BETString; // Replace old entry } try { db.BUSINESS_EXT.Remove(bexRow); db.SaveChanges(); return(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Source); System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.WriteLine(e.StackTrace); System.Diagnostics.Debug.WriteLine(e.InnerException); Exception f = e.InnerException; while (f != null) { System.Diagnostics.Debug.WriteLine("INNER:"); System.Diagnostics.Debug.WriteLine(f.Message); System.Diagnostics.Debug.WriteLine(f.Source); f = f.InnerException; } System.Diagnostics.Debug.WriteLine(e.Data); return(false); } } }
public static List <MenuItem> GetFilteredRecipe() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <MenuItem> RIRList = MenuRecipeManager.SearchMenuItem("ALL"); List <ITMGRP> IGRows = db.ITMGRPs.Where(o => o.Item_Type == 4).ToList(); foreach (var v in IGRows) { RIRList.RemoveAll(o => o.MIMMIC.Equals(v.Item_Code.ToString())); } return(RIRList); } }
public static List <RawItem> GetFilteredRawItem() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <RawItem> RIList = RawItemMasterManager.GetRawItems("ALL"); List <ITMGRP> IGRows = db.ITMGRPs.ToList(); foreach (var v in IGRows) { RIList.RemoveAll(o => o.RIMRIC.Equals(v.Item_Code.ToString())); } return(RIList); } }
public static List <Store> GetFilteredStore() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <Store> STOList = new StoreProfileManager().SearchStores("ALL"); List <ITMGRP> IGRows = db.ITMGRPs.ToList(); foreach (var v in IGRows) { STOList.RemoveAll(o => o.Store_No.Equals(v.Item_Code.ToString())); } return(STOList); } }
public static bool UpdateRawItemPrice(RawItemPriceUpdateViewModel RIPViewModel) { using (CFMMCDEntities db = new CFMMCDEntities()) { RIM_VEM_Lookup RVLRow; if (db.RIM_VEM_Lookup.Where(o => o.RIM_VEM_ID.Equals(RIPViewModel.RIM_VEM_ID)).Any()) { RVLRow = db.RIM_VEM_Lookup.Single(o => o.RIM_VEM_ID.Equals(RIPViewModel.RIM_VEM_ID)); } else { RVLRow = new RIM_VEM_Lookup(); } RVLRow.RIM_VEM_ID = RIPViewModel.RIM_VEM_ID; RVLRow.RIMRIC = int.Parse(RIPViewModel.RIMRIC); RVLRow.VEMVEN = int.Parse(RIPViewModel.VEMVEN); RVLRow.VEMDS1 = RIPViewModel.VEMDS1.Trim(); RVLRow.RIMCPR = double.Parse(RIPViewModel.RIMCPR); RVLRow.RIMRID = db.INVRIMP0.Single(o => o.RIMRIC.ToString().Equals(RIPViewModel.RIMRIC)).RIMRID; //RVLRow.RIMPDT = DateTime.Parse(RIPViewModel.RIMPDT); //RVLRow.RIMCPN = double.Parse(RIPViewModel.RIMCPN); try { if (!db.RIM_VEM_Lookup.Where(o => o.RIM_VEM_ID.Equals(RIPViewModel.RIM_VEM_ID)).Any()) { db.RIM_VEM_Lookup.Add(RVLRow); } db.SaveChanges(); return(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Source); System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.WriteLine(e.StackTrace); System.Diagnostics.Debug.WriteLine(e.InnerException); Exception f = e.InnerException; while (f != null) { System.Diagnostics.Debug.WriteLine("INNER:"); System.Diagnostics.Debug.WriteLine(f.Message); System.Diagnostics.Debug.WriteLine(f.Source); f = f.InnerException; } System.Diagnostics.Debug.WriteLine(e.Data); return(false); } } }
public static List <ItemGroupViewModel> GetGroup(ItemGroupViewModel IGViewModel) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <ITMGRP> IGRows; List <ItemGroupViewModel> IGList = IGViewModel.GroupList; //IGRows = db.ITMGRPs.Where(o => o.Group_Type == IGViewModel.GroupType).OrderBy(o => o.Group_Id).ToList(); IGRows = db.ITMGRPs.OrderBy(o => o.Group_Id).ToList(); int CurrentGroup = 0; ItemGroupViewModel vm = new ItemGroupViewModel(); for (int i = 0; i < IGRows.Count(); i++) { if (CurrentGroup != IGRows[i].Group_Id) { vm = new ItemGroupViewModel(); vm.GroupId = IGRows[i].Group_Id; vm.GroupType = IGRows[i].Group_Type; vm.GroupName = IGRows[i].Group_Name; vm.Id = IGRows[i].Id; } else { continue; } foreach (var v in IGRows.Where(o => o.Group_Id == IGRows[i].Group_Id)) { Item item = new Item(); item.Name = v.Item_Name; item.ItemId = v.Item_Code; item.Id = v.Id; item.ItemType = v.Item_Type; // If item is store if (v.Item_Type == 3) { vm.StoreList.Add(item); } else { vm.ItemList.Add(item); } } IGList.Add(vm); CurrentGroup = IGRows[i].Group_Id; } return(IGList); } }
public List <string> SearchAccounts(string username) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <string> AList = new List <string>(); List <string> AIdList = new List <string>(); List <Account> ARowList; if (username.ToUpper().Equals("ALL")) { ARowList = db.Accounts.ToList(); } else if (db.Accounts.Where(o => o.Username.Equals(username)).Any()) { ARowList = db.Accounts.Where(o => o.Username.Equals(username)).ToList(); } else { return(null); } try { foreach (Account a in ARowList) { AList.Add(a.Username); AIdList.Add(a.UserId.ToString()); } if (AList == null || AList.ElementAt(0) == null) { return(null); } return(AList); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Source); System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.WriteLine(e.StackTrace); System.Diagnostics.Debug.WriteLine(e.InnerException); Exception f = e.InnerException; while (f != null) { System.Diagnostics.Debug.WriteLine("INNER:"); System.Diagnostics.Debug.WriteLine(f.Message); System.Diagnostics.Debug.WriteLine(f.Source); f = f.InnerException; } System.Diagnostics.Debug.WriteLine(e.Data); return(null); } } }
public static bool LogDateTime(string username) { using (CFMMCDEntities db = new CFMMCDEntities()) { if (db.Accounts.Where(o => o.Username.Trim().Equals(username)).Any()) { Account ac = db.Accounts.SingleOrDefault(o => o.Username.Trim().Equals(username)); ac.TimeLastLogged = DateTime.Now; db.SaveChanges(); return(true); } return(false); } }
public static string GetGroupName(int id) { using (CFMMCDEntities db = new CFMMCDEntities()) { if (db.ITMGRPs.Where(o => o.Group_Id == id).Any()) { return(db.ITMGRPs.Single(o => o.Group_Id == id).Group_Name); } else { return(null); } } }
public List <INVRIRP0> GetRecipes(string Store_No, DateTime DateFrom, DateTime DateTo) { using (CFMMCDEntities db = new CFMMCDEntities()) { List <INVRIRP0> sublist = db.INVRIRP0.Where(o => o.STATUS.Equals("A")).ToList(); List <INVRIRP0> list = new List <INVRIRP0>(); list.AddRange(sublist); sublist = db.INVRIRP0.Where(o => o.STATUS.Equals("E")).ToList(); list.AddRange(sublist); list.RemoveAll(o => o.RIRDAT < DateFrom); list.RemoveAll(o => o.RIRDAT > DateTo); return(list); } }
public List <GenericDropDownList> SetUnitOfMeasureList() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <GenericDropDownList> list = new List <GenericDropDownList>(); foreach (var i in db.INVUOMP0) { GenericDropDownList option = new GenericDropDownList(); option.text = i.UOMDEL; option.value = i.UOMDES; list.Add(option); } return(list); } }
public List <GenericDropDownList> SetMDSPriceTierDropDown() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <GenericDropDownList> list = new List <GenericDropDownList>(); foreach (var i in db.MDS_Price_Tier) { GenericDropDownList option = new GenericDropDownList(); option.text = i.Price_Tier; option.value = i.Id.ToString(); list.Add(option); } return(list); } }
public static SCMRecipeViewModel SearchSCMRecipe(string SearchItem) { using (CFMMCDEntities db = new CFMMCDEntities()) { SCMRecipeViewModel CSMList = new SCMRecipeViewModel(); if (SearchItem == null || SearchItem.Equals("")) { return(CSMList); } CSMList.CSMDES = SearchItem; CSMList.RawItemList = SearchSCMRawItem(SearchItem); return(CSMList); } }
public List <GenericDropDownList> SetMaterialsGroupList() { using (CFMMCDEntities db = new CFMMCDEntities()) { List <GenericDropDownList> list = new List <GenericDropDownList>(); foreach (var i in db.INVMGRP0) { GenericDropDownList option = new GenericDropDownList(); option.text = i.MGRTXT; option.value = i.MGRGRP; list.Add(option); } return(list); } }