Exemple #1
0
        public ActionResult GetCustomerByID(int customerID)
        {
            BO_Customers obj = new BussinessObject.BO_Customers();

            obj = BL_Customer.GetCustomerByID(customerID);
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
 public static BO_Customers GetCustomerByID(int customerID)
 {
     using (AprosysAccountingEntities db = new AprosysAccountingEntities())
     {
         var          obj       = db.Customers.Where(x => x.Id == customerID).FirstOrDefault();
         BO_Customers _customer = new BussinessObject.BO_Customers();
         if (obj != null && obj.Id > 0)
         {
             _customer.id             = obj.Id;
             _customer.lastName       = obj.LastName ?? "";
             _customer.firstName      = obj.FirstName ?? "";
             _customer.phone          = obj.Phone ?? "";
             _customer.email          = obj.Email ?? "";
             _customer.cnic           = obj.CNIC ?? "";
             _customer.openingBalance = obj.OpeningBalance ?? 0;
             _customer.startDate      = obj.StartDate;
             _customer.misc           = obj.Misc ?? "";
             _customer.ntn            = obj.NTN ?? "";
             _customer.salesPerson    = obj.SalesPersonId.GetValueOrDefault();
             //obj.ModifiedOn = BL_Common.GetDatetime();
         }
         return(_customer);
     }
 }