コード例 #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     lblError.Text      = string.Empty;
     lblError.Visible   = false;
     lblSave.Text       = string.Empty;
     lblSave.Visible    = false;
     lblMessage.Visible = false;
     lblMessage.Text    = string.Empty;
     try
     {
         bool exists = ReportedToInsurerManager.IsExist(txtReportedToInsurer.Text.Trim(), Convert.ToInt32(hdId.Value));
         if (exists)
         {
             lblMessage.Text    = "Insurer Name allready exists.";
             lblMessage.Visible = true;
             txtReportedToInsurer.Focus();
             return;
         }
         ReportedToInsurerMaster obj = ReportedToInsurerManager.GetReportedToInsurerId(Convert.ToInt32(hdId.Value));
         obj.ReportedToInsurer = txtReportedToInsurer.Text;
         obj.Status            = true;
         ReportedToInsurerManager.Save(obj);
         saveMsg = hdId.Value == "0" ? "Record Saved Sucessfully." : "Record Updated Sucessfully.";
         btnCancel_Click(null, null);
         lblSave.Text    = saveMsg;
         lblSave.Visible = true;
     }
     catch (Exception ex)
     {
         lblError.Visible = true;
         lblError.Text    = "Record Not Saved !!!";
     }
 }
コード例 #2
0
        private void DoBind()
        {
            List <ReportedToInsurerMaster> lst = ReportedToInsurerManager.GetAll();

            if (lst.Count > 0)
            {
                dvData.Visible    = true;
                PagerRow.Visible  = true;
                lvData.DataSource = lst;
                lvData.DataBind();
            }
            else
            {
                dvData.Visible   = false;
                PagerRow.Visible = false;
            }
        }
コード例 #3
0
 protected void lvData_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     lblError.Text      = string.Empty;
     lblSave.Text       = string.Empty;
     lblMessage.Text    = string.Empty;
     lblMessage.Visible = false;
     lblError.Visible   = false;
     lblSave.Visible    = false;
     if (e.CommandName.Equals("DoEdit"))
     {
         int ReportedtoinsId = Convert.ToInt32(e.CommandArgument);
         hdId.Value = ReportedtoinsId.ToString();
         Label lblReportedToInsurer = (Label)e.Item.FindControl("lblReportedToInsurer");
         txtReportedToInsurer.Text = lblReportedToInsurer.Text;
     }
     else if (e.CommandName.Equals("DoDelete"))
     {
         // In Case of delete
         try
         {
             var list = CheckPrimaryValue.CheckPrimaryValueExists(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Convert.ToInt32(e.CommandArgument), 0, 0, 0);
             if (list.ToList().Count > 0)
             {
                 lblMessage.Text    = "Reported To Insurer is used so you can't delete !!!";
                 lblMessage.Visible = true;
                 return;
             }
             var adjuster = ReportedToInsurerManager.GetReportedToInsurerId(Convert.ToInt32(e.CommandArgument));
             adjuster.Status = false;
             ReportedToInsurerManager.Save(adjuster);
             DoBind();
             lblSave.Text    = "Record Deleted Sucessfully.";
             lblSave.Visible = true;
         }
         catch (Exception ex)
         {
             lblError.Text    = "Record Not Deleted.";
             lblError.Visible = true;
         }
     }
 }