Example #1
0
 public void Update(List <EntityinsuranceClaimDetails> lst)
 {
     try
     {
         foreach (EntityinsuranceClaimDetails item in lst)
         {
             tblInsuranceClaimDetail objsal = new tblInsuranceClaimDetail();
             objsal = (from tbl in objData.tblInsuranceClaimDetails
                       where tbl.ClaimDetailId == item.ClaimDetailId &&
                       tbl.IsDelete == false
                       select tbl).FirstOrDefault();
             if (objsal != null)
             {
                 objsal.BillNo     = item.BillNo;
                 objsal.BillType   = item.BillType;
                 objsal.BillDate   = item.BillDate;
                 objsal.BillAmount = item.BillAmount;
                 objsal.IsDelete   = item.IsDelete;
             }
             else
             {
                 objsal = new tblInsuranceClaimDetail()
                 {
                     BillNo = item.BillNo, BillAmount = item.BillAmount, BillType = item.BillType, BillDate = item.BillDate, IsOtherBill = item.IsOtherBill, ClaimId = Convert.ToInt32(item.ClaimId)
                 };
                 objData.tblInsuranceClaimDetails.InsertOnSubmit(objsal);
             }
         }
         objData.SubmitChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        public int?Save(tblInsuranceClaim tblins, List <EntityinsuranceClaimDetails> lst)
        {
            int?ClaimId = 0;

            try
            {
                objData.STP_Insert_tblInsuranceClaim(Convert.ToInt32(tblins.AdmitId), Convert.ToInt32(tblins.CompanyId), Convert.ToDateTime(tblins.ClaimDate), Convert.ToDecimal(tblins.Total), tblins.IsApproved, ref ClaimId);
                foreach (EntityinsuranceClaimDetails item in lst)
                {
                    tblInsuranceClaimDetail tbl = new tblInsuranceClaimDetail()
                    {
                        BillNo = item.BillNo, BillAmount = item.BillAmount, BillType = item.BillType, BillDate = item.BillDate, IsOtherBill = item.IsOtherBill, ClaimId = Convert.ToInt32(ClaimId)
                    };
                    objData.tblInsuranceClaimDetails.InsertOnSubmit(tbl);
                }
                objData.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ClaimId);
        }