コード例 #1
0
        public static BO_SalesPersonManagement GetSalesPersonByID(int salePersonID)
        {
            BO_SalesPersonManagement _salesPerson = new BussinessObject.BO_SalesPersonManagement();

            using (AprosysAccountingEntities db = new AprosysAccountingEntities())
            {
                var obj = db.SalesPersons.Where(x => x.Id == salePersonID).FirstOrDefault();
                if (obj != null && obj.Id > 0)
                {
                    _salesPerson.Id             = obj.Id;
                    _salesPerson.lastName       = obj.LastName ?? "";
                    _salesPerson.firstName      = obj.FirstName ?? "";
                    _salesPerson.phone          = obj.Phone ?? "";
                    _salesPerson.email          = obj.Email ?? "";
                    _salesPerson.cnic           = obj.CNIC;
                    _salesPerson.ntn            = obj.NTN;
                    _salesPerson.openingBalance = obj.OpeningBalance ?? 0;
                    _salesPerson.startDate      = obj.StartDate;
                    _salesPerson.misc           = obj.Misc ?? "";
                    obj.ModifiedOn = BL_Common.GetDatetime();
                }
                if (_salesPerson != null)
                {
                    _salesPerson.customersIDs = db.Customers.Where(x => x.SalesPersonId == salePersonID).Select(x => x.Id).ToList() ?? null;
                }
            }
            return(_salesPerson);
        }
        public ActionResult GetSalesPersonByID(int salePersonID)
        {
            BO_SalesPersonManagement obj = new BussinessObject.BO_SalesPersonManagement();

            obj = BL_SalesPersonManagement.GetSalesPersonByID(salePersonID);
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }