Exemple #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 !!!";
     }
 }
Exemple #2
0
        public static ReportedToInsurerMaster Save(ReportedToInsurerMaster objReportedToInsurerMaster)
        {
            if (objReportedToInsurerMaster.ReportedToInsurerId == 0)
            {
                //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                objReportedToInsurerMaster.InsertDate        = DateTime.Now;
                objReportedToInsurerMaster.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.Add(objReportedToInsurerMaster);
            }

            //secUser.UpdatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            objReportedToInsurerMaster.UpdateMachineIfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
            objReportedToInsurerMaster.UpdateDate       = DateTime.Now;
            DbContextHelper.DbContext.SaveChanges();

            return(objReportedToInsurerMaster);
        }