コード例 #1
0
 public List <GoodReceiptDetail> GetGoodsReceiptDetails(int goodReceiptNumber)
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.GoodReceiptDetails.Where(x => x.GRNumber == goodReceiptNumber).ToList());
     }
 }
コード例 #2
0
 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());
     }
 }
コード例 #3
0
 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());
     }
 }
コード例 #4
0
 public static List <DisbursementListDetail> GetDisbursementListDetails(int disbursementId)
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.DisbursementListDetails.Where(x => x.DisbursementID == disbursementId).ToList());
     }
 }
コード例 #5
0
 public static List <DisbursementList> GetListOfDisbursements()
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.DisbursementLists.ToList());
     }
 }
コード例 #6
0
        //-------------------- VALLIYODAN THANISHA Code Ends Here-------------------------//



        //-------------------- Lim Chang Siang Start here -------------------------------//
        public static List <Department> GetListofDepartments()
        {
            using (SA45Team12AD ctx = new SA45Team12AD())
            {
                return(ctx.Departments.ToList());
            }
        }
コード例 #7
0
 public static DisbursementList GetDisbursementList(int disbursementId)
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.DisbursementLists.Where(x => x.DisbursementID == disbursementId).FirstOrDefault());
     }
 }
コード例 #8
0
 public static PORecord GetPurchaseOrderRecord(int poNo)
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         return(entities.PORecords.FirstOrDefault(x => x.PONumber == poNo));
     }
 }
コード例 #9
0
 public static List <PORecord> GetListOfPurchaseOrder(string status)
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         return(entities.PORecords.Where(x => x.Status == status).ToList());
     }
 }
コード例 #10
0
 public static List <PORecord> ListPORecords()
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         return(entities.PORecords.ToList());
     }
 }
コード例 #11
0
        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();
        }
コード例 #12
0
 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());
     }
 }
コード例 #13
0
 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());
     }
 }
コード例 #14
0
        //------------ 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);
        }
コード例 #15
0
        //------------------ 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());
            }
        }
コード例 #16
0
 public static List <PORecordDetail> GetListOfPORecorDetails(int poNo)
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         return(entities.PORecordDetails.Where(x => x.PONumber == poNo).ToList());
     }
 }
コード例 #17
0
        // 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);
            }
        }
コード例 #18
0
 public static List <PORecordDetail> GetListOfPurchaseOrderDetails()
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         return(entities.PORecordDetails.ToList());
     }
 }
コード例 #19
0
 public static List <CollectionPoint> GetListofColPoint()
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.CollectionPoints.ToList());
     }
 }
コード例 #20
0
 public static int GetPORecordApproveID(int poNo)
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         return(entities.PORecordDetails.Where(x => x.PONumber == poNo).Select(x => x.ID).FirstOrDefault());
     }
 }
コード例 #21
0
 public static List <DisbursementListDetail> GetDisbursementListDetails()
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.DisbursementListDetails.ToList());
     }
 }
コード例 #22
0
        //------ 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());
            }
        }
コード例 #23
0
        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);
        }
コード例 #24
0
        //--------- 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());
            }
        }
コード例 #25
0
        //-------------------- Lim Chang Siang ends here -------------------------------//

        //------ Predeep Code Starts Here--------------------//

        public static List <CollectionPoint> ListCollectionPoints()
        {
            using (SA45Team12AD entities = new SA45Team12AD())
            {
                return(entities.CollectionPoints.ToList());
            }
        }
コード例 #26
0
 public static List <PORecord> GetListOfPO()
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.PORecords.ToList());
     }
 }
コード例 #27
0
 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());
     }
 }
コード例 #28
0
 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());
     }
 }
コード例 #29
0
        //-------------------------------get departments()-------------------------------------------------------------------//

        public static List <Department> GetDepartmentList()
        {
            using (SA45Team12AD entities = new SA45Team12AD())
            {
                return(entities.Departments.ToList <Department>());
            }
        }
コード例 #30
0
 public GoodReceipt GetGoodsReceipt(int goodReceiptNumber)
 {
     using (SA45Team12AD ctx = new SA45Team12AD())
     {
         return(ctx.GoodReceipts.FirstOrDefault(x => x.GRNumber == goodReceiptNumber));
     }
 }