Esempio n. 1
0
        public int Insert(CustomerPaymentDetail obj)
        {
            CustomerPaymentDetail newCustomerPaymentDetail = new CustomerPaymentDetail();

            newCustomerPaymentDetail.cust_Id       = obj.cust_Id;
            newCustomerPaymentDetail.balanceAmount = obj.balanceAmount;
            newCustomerPaymentDetail.PaidAmount    = obj.PaidAmount;
            newCustomerPaymentDetail.date          = obj.date;
            newCustomerPaymentDetail.received      = obj.received;

            newCustomerPaymentDetail.remark = obj.remark;
            if (obj.signature != null)
            {
                newCustomerPaymentDetail.signature = obj.signature;
            }
            context.CustomerPaymentDetails.Add(newCustomerPaymentDetail);
            context.SaveChanges();

            CustomerDetail objCustomerDetails = context.CustomerDetails.Where(ite => ite.cust_id == obj.cust_Id).FirstOrDefault();

            if (objCustomerDetails != null)
            {
                objCustomerDetails.openingBalance = objCustomerDetails.openingBalance - obj.PaidAmount;
                context.SaveChanges();
            }
            return(newCustomerPaymentDetail.cust_Id);
        }
Esempio n. 2
0
        public void Delete(int id)
        {
            CustomerPaymentDetail newCustomerPaymentDetail = context.CustomerPaymentDetails.Where(obj => obj.cust_Id == id).FirstOrDefault();

            context.CustomerPaymentDetails.Where(obj => obj.cust_Id == id).ToList().ForEach(obj => context.CustomerPaymentDetails.Remove(obj));
            context.CustomerPaymentDetails.Remove(newCustomerPaymentDetail);
            context.SaveChanges();
        }
Esempio n. 3
0
        public void Update(CustomerPaymentDetail obj)
        {
            CustomerPaymentDetail newCustomerPaymentDetail = new CustomerPaymentDetail();

            newCustomerPaymentDetail.cust_Id       = obj.cust_Id;
            newCustomerPaymentDetail.balanceAmount = obj.balanceAmount;
            newCustomerPaymentDetail.PaidAmount    = obj.PaidAmount;
            newCustomerPaymentDetail.date          = obj.date;
            newCustomerPaymentDetail.received      = obj.received;
            newCustomerPaymentDetail.remark        = obj.remark;
            newCustomerPaymentDetail.signature     = obj.signature;
            context.CustomerPaymentDetails.Add(newCustomerPaymentDetail);
            context.SaveChanges();
        }