public List <GoodReceiptDetail> GetGoodsReceiptDetails(int goodReceiptNumber) { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.GoodReceiptDetails.Where(x => x.GRNumber == goodReceiptNumber).ToList()); } }
public static string GetDepNameByDepID(string depid) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.Departments.Where(x => x.DeptID == depid).Select(x => x.DepartmentName).Single().ToString()); } }
public static string GetCurrentCPWithTimeByID(int id) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.CollectionPoints.Where(x => x.CollectionPointID == id).Select(x => x.CollectionPoint1).Single().ToString()); } }
public static List <DisbursementListDetail> GetDisbursementListDetails(int disbursementId) { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.DisbursementListDetails.Where(x => x.DisbursementID == disbursementId).ToList()); } }
public static List <DisbursementList> GetListOfDisbursements() { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.DisbursementLists.ToList()); } }
//-------------------- VALLIYODAN THANISHA Code Ends Here-------------------------// //-------------------- Lim Chang Siang Start here -------------------------------// public static List <Department> GetListofDepartments() { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.Departments.ToList()); } }
public static DisbursementList GetDisbursementList(int disbursementId) { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.DisbursementLists.Where(x => x.DisbursementID == disbursementId).FirstOrDefault()); } }
public static PORecord GetPurchaseOrderRecord(int poNo) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.PORecords.FirstOrDefault(x => x.PONumber == poNo)); } }
public static List <PORecord> GetListOfPurchaseOrder(string status) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.PORecords.Where(x => x.Status == status).ToList()); } }
public static List <PORecord> ListPORecords() { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.PORecords.ToList()); } }
static void PurchaseOrderIsApproved(int poNumber) { PORecord po; double totalPrice = 0; string supplierEmail; using (SA45Team12AD ctx = new SA45Team12AD()) { po = ctx.PORecords.Where(x => x.PONumber == poNumber).FirstOrDefault(); supplierEmail = ctx.SupplierLists.Where(x => x.SupplierID == po.SupplierID).Select(x => x.EmailAddress).FirstOrDefault(); List <PORecordDetail> poDList = ctx.PORecordDetails.Where(x => x.PONumber == poNumber).ToList(); foreach (PORecordDetail p in poDList) { InventoryLogic.UpdateUnitsOnOrder(p.ItemID, (int)p.Quantity); totalPrice += (double)(p.UnitPrice * p.Quantity); } } //Creating a thread to send the PDF email in background to prevent lagging the Website. Thread bgThread = new Thread(delegate() { using (EmailControl em = new EmailControl()) { em.SendPurchaseOrder(supplierEmail, po.PONumber, po.RecipientName, po.DeliveryAddress, GetSuppilerName(po.SupplierID), (DateTime)po.ExpectedDelivery, totalPrice); } }); bgThread.Start(); }
public static string GetUOM(string ItemID, string supplierId) { using (SA45Team12AD entities = new SA45Team12AD()) { return((string)entities.SupplierCatalogues.Where(x => x.ItemID == ItemID).Where(x => x.SupplierID == supplierId).Select(x => x.UOM).FirstOrDefault()); } }
public static double GetUnitPrice(string ItemID, string supplierId) { using (SA45Team12AD entities = new SA45Team12AD()) { return((double)entities.SupplierCatalogues.Where(x => x.ItemID == ItemID).Where(x => x.SupplierID == supplierId).Select(x => x.Price).FirstOrDefault()); } }
//------------ Lim Chang Siang's Code Ends Here-------------------------------// //------ Li Jianing'S Code start Here------------------------------// public static int AddText(string Deliverto, string Address, string SupplierID, DateTime RequestedDate, string userName, DateTime ExpectedBy) { //Put here so other methods can use even after the EF object is disposed. PORecord poRecord; using (SA45Team12AD entities = new SA45Team12AD()) { poRecord = new PORecord(); poRecord.RecipientName = Deliverto; poRecord.DeliveryAddress = Address; poRecord.SupplierID = SupplierID; poRecord.Status = "Pending"; poRecord.DateRequested = RequestedDate; poRecord.CreatedBy = userName; poRecord.ExpectedDelivery = ExpectedBy; entities.PORecords.Add(poRecord); entities.SaveChanges(); } //Using System.Web.Security feature. List <MembershipUser> userList = Utility.Utility.GetListOfMembershipUsers(); string[] approveAuthList = Roles.GetUsersInRole("Supervisor"); string clerkName = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString(); foreach (string s in approveAuthList) { var User = userList.Find(x => x.UserName == s); using (EmailControl em = new EmailControl()) { em.NewPurchaseOrderForApprovalNotification(User.Email.ToString(), clerkName, poRecord.PONumber.ToString(), DateTime.Now.Date.ToString("d")); } } //Return the new PONumber. return(poRecord.PONumber); }
//------------------ Lim Chang Siang's Code Ends Here---------------------// //---------------------------------------- SYED MOHAMAD KHAIRWANCYK BIN SAYED HIRWAINI ---------------------------------------------// // Retrieving our forecasted data by ItemID public static List <ForecastedData> RetrieveForecastedData(string itemID) { using (SA45Team12AD context = new SA45Team12AD()) { return(context.Database.SqlQuery <ForecastedData>("EXEC [SA45Team12AD].[dbo].[RetrieveLatestForecastData] @ItemID = {0}", itemID).ToList()); } }
public static List <PORecordDetail> GetListOfPORecorDetails(int poNo) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.PORecordDetails.Where(x => x.PONumber == poNo).ToList()); } }
// Retrieve latest date from actual data table public static bool CheckIfBeyondLatestData(DateTime tempDate) { using (SA45Team12AD context = new SA45Team12AD()) { ActualData temp = context.Database.SqlQuery <ActualData>("EXEC [SA45Team12AD].[dbo].[LatestActualDataEntry]").First(); int lSeason = temp.Season; int lPeriod = temp.Period; // Check if the year selected is more than the latest we have in our db, return false if (lSeason < tempDate.Year) { return(false); } if (lSeason == tempDate.Year) { // Check if the period selected is more than the latest we have in our db, return false DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo; Calendar cal = dfi.Calendar; int selectedPeriod = cal.GetWeekOfYear(tempDate, dfi.CalendarWeekRule, dfi.FirstDayOfWeek); if (lPeriod <= selectedPeriod) { return(false); } } return(true); } }
public static List <PORecordDetail> GetListOfPurchaseOrderDetails() { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.PORecordDetails.ToList()); } }
public static List <CollectionPoint> GetListofColPoint() { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.CollectionPoints.ToList()); } }
public static int GetPORecordApproveID(int poNo) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.PORecordDetails.Where(x => x.PONumber == poNo).Select(x => x.ID).FirstOrDefault()); } }
public static List <DisbursementListDetail> GetDisbursementListDetails() { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.DisbursementListDetails.ToList()); } }
//------ Li Jianing'S Code end Here------------------------------// //--------- Yuan Yishu's Code Starts Here-----------------// public static List <SupplierList> ListSuppliers() { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.SupplierLists.ToList()); } }
public static bool UpdateDisbursementStatus(int disbursementId, string status) { string email; string collectPoint; string dateTime; bool success = false; using (SA45Team12AD ctx = new SA45Team12AD()) { DisbursementList dL = ctx.DisbursementLists.Where(x => x.DisbursementID == disbursementId).FirstOrDefault(); email = Utility.Utility.GetEmailAddressByName(dL.RepresentativeName); collectPoint = GetCurrentCPWithTimeByID(dL.CollectionPointID); dateTime = ((DateTime)dL.CollectionDate).ToString("d"); dL.Status = status; ctx.SaveChanges(); success = true; } if (status == "Cancelled") { using (EmailControl em = new EmailControl()) { em.CancelStationeryCollectionNotification(email, collectPoint, dateTime); } } return(success); }
//--------- Yuan Yishu's Code Ends Here-----------------// //--------------- THET NAING AYE Starts Here-----------------------// public static List <PORecord> GetListOfPO(String status) { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.PORecords.Where(x => x.Status == status).ToList()); } }
//-------------------- Lim Chang Siang ends here -------------------------------// //------ Predeep Code Starts Here--------------------// public static List <CollectionPoint> ListCollectionPoints() { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.CollectionPoints.ToList()); } }
public static List <PORecord> GetListOfPO() { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.PORecords.ToList()); } }
public static string GetCurrentCPIDByDep(string dep) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.Departments.Where(x => x.DeptID == dep).Select(x => x.CollectionPointID).Single().ToString()); } }
public List <SupplierList> SearchBy(string value) { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.SupplierLists.Where(s => s.SupplierID.Contains(value) || s.SupplierName.Contains(value)).ToList()); } }
//-------------------------------get departments()-------------------------------------------------------------------// public static List <Department> GetDepartmentList() { using (SA45Team12AD entities = new SA45Team12AD()) { return(entities.Departments.ToList <Department>()); } }
public GoodReceipt GetGoodsReceipt(int goodReceiptNumber) { using (SA45Team12AD ctx = new SA45Team12AD()) { return(ctx.GoodReceipts.FirstOrDefault(x => x.GRNumber == goodReceiptNumber)); } }