public CustomerBusinessEntity GetCustomerById(int ID)
        {
            CustomerBusinessEntity customer = new CustomerBusinessEntity();

            try
            {
                using (var dbContext = new LoanManagementSystemEntities())
                {
                    tbl_Customer cust = dbContext.tbl_Customer.Where(c => c.Id == ID).FirstOrDefault();
                    if (cust != null)
                    {
                        customer.ID      = cust.Id;
                        customer.Name    = cust.Name;
                        customer.PanCard = cust.PANCard;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return(customer);
        }
Пример #2
0
        public ActionResult GetCustomerById(CustomerBusinessEntity customerBusinessEntity)
        {
            LookupBL lookupBL = new LookupBL();
            var      cust     = lookupBL.GetCustomerById(customerBusinessEntity.ID);

            return(Json(cust, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public JsonResult Create(CustomerBusinessEntity customerEntity)
        {
            string   str = "success";
            DateTime dt  = customerEntity.DOB;

            CustomerBL customerBL = new CustomerBL();

            customerBL.Save(customerEntity);
            //WebAPIHelper oWebAPIHelper = new WebAPIHelper();
            //bool result = oWebAPIHelper.SaveCustomer(customerEntity);

            return(Json(str, JsonRequestBehavior.AllowGet));
        }
        public bool SaveCustomer(CustomerBusinessEntity customer)
        {
            WebClient client = new WebClient();

            client.Headers[HttpRequestHeader.ContentType] = "application/json";
            client.Headers["authenticationtoken"]         = Guid.NewGuid().ToString();
            string serialisedData = JsonConvert.SerializeObject(customer);

            // build save url method
            string url      = baseURL + "Customer/Save";
            var    response = client.UploadString(url, serialisedData);

            status = JsonConvert.DeserializeObject <Boolean>(response);
            return(status);
        }
        public bool Save(CustomerBusinessEntity customerEntity)
        {
            bool status = false;

            try
            {
                CustomerBL customerBL = new CustomerBL();
                status = customerBL.Save(customerEntity);
            }
            catch (Exception exp)
            {
            }
            finally
            {
            }

            return(status);
        }
Пример #6
0
        public bool Save(CustomerBusinessEntity customer)
        {
            tbl_Customer dbCustomer;

            if (customer.ID == -1)
            {
                dbCustomer = new tbl_Customer();
            }
            else
            {
                dbCustomer = Get(customer.ID);
            }
            AssignValueToDBCustomer(ref dbCustomer, ref customer);
            using (var dbContext = new LoanManagementSystemEntities())
            {
                dbContext.tbl_Customer.Add(dbCustomer);
                dbContext.SaveChanges();
            }

            return(true);
        }
Пример #7
0
        private void AssignValueToDBCustomer(ref tbl_Customer dbCustomer, ref CustomerBusinessEntity custmorEntity)
        {
            dbCustomer.Name         = custmorEntity.Name;
            dbCustomer.AdhaarNo     = custmorEntity.Adhaarno;
            dbCustomer.MobileNo     = custmorEntity.MobileNo;
            dbCustomer.PANCard      = custmorEntity.PanCard;
            dbCustomer.DOB          = custmorEntity.DOB;
            dbCustomer.Gender       = custmorEntity.Gender;
            dbCustomer.AnnualIncome = (decimal)custmorEntity.AnnualIncome;


            // Present Address
            tbl_Address presentAddress = new tbl_Address();

            presentAddress.Address1 = custmorEntity.PresentAddress.Address1;
            presentAddress.Address2 = custmorEntity.PresentAddress.Address2;
            presentAddress.City     = custmorEntity.PresentAddress.City;
            presentAddress.State    = custmorEntity.PresentAddress.State;
            presentAddress.District = custmorEntity.PresentAddress.District;
            presentAddress.PINCode  = custmorEntity.PresentAddress.Pincode;

            dbCustomer.PresentAddress = presentAddress;
        }
Пример #8
0
        public bool Save(CustomerBusinessEntity customer)
        {
            CustomerDAL ocustomerDAL = new CustomerDAL();

            return(ocustomerDAL.Save(customer));
        }