Exemple #1
0
        public IHttpActionResult PuttblInsuranceClaim(int id, tblInsuranceClaim tblInsuranceClaim)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblInsuranceClaim.CliamId)
            {
                return(BadRequest());
            }

            db.Entry(tblInsuranceClaim).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblInsuranceClaimExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 protected void BtnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         ddlPatient.Enabled = false;
         tblInsuranceClaim tblins = new tblInsuranceClaim();
         tblins.ClaimId   = Convert.ToInt32(Session["ClaimId"]);
         tblins.AdmitId   = Convert.ToInt32(ddlPatient.SelectedValue);
         tblins.CompanyId = Convert.ToInt32(ddlInsuranceComName.SelectedValue);
         tblins.ClaimDate = Convert.ToDateTime(txtClaimDate.Text);
         tblins.Total     = Convert.ToDecimal(txtClaimAmount.Text);
         List <EntityinsuranceClaimDetails> inslst = (List <EntityinsuranceClaimDetails>)Session["ClaimCharges"];
         MobjClaim.Update(tblins, inslst);
         lblMessage.Text = "Record Updated Successfully.....";
         Clear();
         List <EntityinsuranceClaimDetails> lst = new List <EntityinsuranceClaimDetails>();
         dgvChargeDetails.DataSource = lst;
         dgvChargeDetails.DataBind();
         BindInsuranceClaim();
         Session["ClaimCharges"] = null;
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
     MultiView1.SetActiveView(View1);
 }
Exemple #3
0
        public IHttpActionResult Post([FromUri] int Id, int adminId)
        {
            tblInsuranceClaim tblInsuranceClaim = db.tblInsuranceClaims.Find(Id);

            tblInsuranceClaim.ApprovalStatus  = "Approved";
            tblInsuranceClaim.ApprovalAdminId = adminId;
            db.Entry(tblInsuranceClaim).State = EntityState.Modified;
            db.SaveChanges();
            return(Ok("OK"));
        }
Exemple #4
0
        public IHttpActionResult GettblInsuranceClaim(int id)
        {
            tblInsuranceClaim tblInsuranceClaim = db.tblInsuranceClaims.Find(id);

            if (tblInsuranceClaim == null)
            {
                return(NotFound());
            }

            return(Ok(tblInsuranceClaim));
        }
Exemple #5
0
        public IHttpActionResult PosttblInsuranceClaim(tblInsuranceClaim tblInsuranceClaim)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tblInsuranceClaims.Add(tblInsuranceClaim);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tblInsuranceClaim.CliamId }, tblInsuranceClaim));
        }
Exemple #6
0
        public IHttpActionResult DeletetblInsuranceClaim(int id)
        {
            tblInsuranceClaim tblInsuranceClaim = db.tblInsuranceClaims.Find(id);

            if (tblInsuranceClaim == null)
            {
                return(NotFound());
            }

            db.tblInsuranceClaims.Remove(tblInsuranceClaim);
            db.SaveChanges();

            return(Ok(tblInsuranceClaim));
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                tblInsuranceClaim tblins = new tblInsuranceClaim();

                tblins.AdmitId   = Convert.ToInt32(ddlPatient.SelectedValue);
                tblins.CompanyId = Convert.ToInt32(ddlInsuranceComName.SelectedValue);
                tblins.ClaimDate = Convert.ToDateTime(txtClaimDate.Text);
                tblins.Total     = Convert.ToDecimal(txtClaimAmount.Text);

                tblPatientAdmitDetail objFac = MobjClaim.GetEmployee(Convert.ToInt32(ddlPatient.SelectedValue));
                if (objFac != null)
                {
                    tblInsuranceClaim objExist = MobjClaim.CheckExistRecord(objFac.AdmitId);
                    if (objExist == null)
                    {
                        if (MobjClaim.ValidateAllocation(tblins))
                        {
                            List <EntityinsuranceClaimDetails> inslst = (List <EntityinsuranceClaimDetails>)Session["Charges"];
                            int ClaimId = Convert.ToInt32(MobjClaim.Save(tblins, inslst));
                            lblMessage.Text = "Record Saved Successfully.....";
                            Clear();
                            Session["Charges"] = null;
                        }
                    }
                    else
                    {
                        Clear();
                        List <EntityinsuranceClaimDetails> lst = new List <EntityinsuranceClaimDetails>();
                        dgvChargeDetails.DataSource = lst;
                        dgvChargeDetails.DataBind();
                        lblMsg.Text = string.Empty;
                        MultiView1.SetActiveView(View1);
                        lblMessage.Text = "Insurance Is Already Allocated To Patient!!";
                    }
                }
                else
                {
                    lblMsg.Text = "Invalid Patient";
                }
                Session["Charges"] = new List <EntityinsuranceClaimDetails>();
                BindInsuranceClaim();
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
            MultiView1.SetActiveView(View1);
        }
Exemple #8
0
        public void Update(tblInsuranceClaim obj, List <EntityinsuranceClaimDetails> lst)
        {
            try
            {
                tblInsuranceClaim objcurrent = (from tbl in objData.tblInsuranceClaims
                                                where tbl.ClaimId == obj.ClaimId
                                                select tbl).FirstOrDefault();
                if (objcurrent != null)
                {
                    objcurrent.AdmitId   = obj.AdmitId;
                    objcurrent.CompanyId = obj.CompanyId;
                    objcurrent.ClaimDate = obj.ClaimDate;
                    objcurrent.Total     = obj.Total;
                }

                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.ClaimId    = item.ClaimId;
                        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(obj.ClaimId)
                        };
                        objData.tblInsuranceClaimDetails.InsertOnSubmit(objsal);
                    }
                }
                objData.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #9
0
 public bool ValidateAllocation(tblInsuranceClaim sal)
 {
     try
     {
         var res = (from tbl in objData.tblInsuranceClaims
                    where tbl.AdmitId == sal.AdmitId
                    select tbl).FirstOrDefault();
         if (res != null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public HttpResponseMessage postclaiminsurance(tblInsuranceClaim insuranceClaim)
 {
     //check for farmerid in session matches with farmerid in tblinsurance(this says he applied for insurance)
     if (insuranceClaim.Policyno == entities.tblInsurances.Select(t => t.InsuranceApplicationId).FirstOrDefault())
     {
         if (insuranceClaim.SumInsured == entities.tblInsurances.Select(t => t.SumInsured).FirstOrDefault())
         {
             insuranceClaim.ClaimStatus = "pending";
             Convert.ToDecimal(insuranceClaim.SumInsured);
             entities.tblInsuranceClaims.Add(insuranceClaim);
             entities.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.OK, "your insurance is claimed"));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "you should enter the correct suminsured by company"));
         }
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "policy no mismatch"));
     }
 }
Exemple #11
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);
        }
 public void post([FromBody] tblInsuranceClaim insuranceCliam)
 {
     insuranceCliam.ApprovalStatus = "Not Approved";
     db.tblInsuranceClaims.Add(insuranceCliam);
     db.SaveChanges();
 }
        public void InsertData(tblInsuranceClaim tblins, EntityCustomerTransaction objPatient, EntityCustomerTransaction objBank, bool IsCash, bool IsNeft, bool IsCheque)
        {
            try
            {
                tblInsuranceClaim objcurrent = (from tbl in objData.tblInsuranceClaims
                                                where tbl.ClaimId == tblins.ClaimId
                                                select tbl).FirstOrDefault();
                if (objcurrent != null)
                {
                    objcurrent.ApprovedAmount = tblins.ApprovedAmount;
                    objcurrent.ApprovedDate   = tblins.ApprovedDate;
                    objcurrent.IsApproved     = tblins.IsApproved;
                    objcurrent.TDS            = tblins.TDS;
                    //objcurrent.Discount = tblins.Discount;
                    int TransactionId = new PatientInvoiceBLL().GetTransactionId();
                    if (IsCash)
                    {
                        tblCustomerTransaction tblcust = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = true,
                            ISCheque         = false,
                            TransactionDocNo = objPatient.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = 0,
                            PayAmount        = objPatient.PayAmount,
                            PatientId        = objPatient.PatientId,
                            IsDelete         = false,
                            ReceiptDate      = objPatient.ReceiptDate,
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcust);
                    }
                    else if (IsNeft)
                    {
                        tblCustomerTransaction tblcust = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = false,
                            TransactionDocNo = objPatient.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = 0,
                            PayAmount        = objPatient.PayAmount,
                            PatientId        = objPatient.PatientId,
                            IsDelete         = false,
                            ReceiptDate      = objPatient.ReceiptDate,
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcust);
                        tblCustomerTransaction tblcustBank = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = false,
                            TransactionDocNo = objBank.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = objBank.BillAmount,
                            PayAmount        = 0,
                            PatientId        = 0,
                            IsDelete         = false,
                            ReceiptDate      = objBank.ReceiptDate,
                            BankId           = objBank.BankId
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcustBank);
                    }
                    else if (IsCheque)
                    {
                        tblCustomerTransaction tblcust = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = true,
                            TransactionDocNo = objPatient.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = 0,
                            PayAmount        = objPatient.PayAmount,
                            PatientId        = objPatient.PatientId,
                            IsDelete         = false,
                            ReceiptDate      = objPatient.ReceiptDate,
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcust);
                        tblCustomerTransaction tblcustnew = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = true,
                            TransactionDocNo = objBank.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = objBank.BillAmount,
                            PayAmount        = 0,
                            PatientId        = 0,
                            IsDelete         = false,
                            ReceiptDate      = objBank.ReceiptDate,
                            BankName         = objBank.BankName,
                            ChequeDate       = objBank.ChequeDate,
                            ChequeNo         = objBank.ChequeNo
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcustnew);
                    }
                }

                objData.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }