public ActionResult ProvitionalDiagnosis(ProvitionalDiagnosis objProvitionalDiagnosis)
 {
     try
     {
         if (obj.CheckProvitionalDiagnosis(objProvitionalDiagnosis.ProvitionalDiagnosisID, objProvitionalDiagnosis.ProvitionalDiagnosisName))
         {
             if (objProvitionalDiagnosis.ProvitionalDiagnosisID > 0)
             {
                 if (obj.Save(objProvitionalDiagnosis))
                 {
                     ModelState.Clear();
                     TempData["msg"] = "Provisional Diagnosis Updated Successfully !";
                 }
             }
             else
             {
                 if (obj.Save(objProvitionalDiagnosis))
                 {
                     ModelState.Clear();
                     TempData["msg"] = "Provisional Diagnosis Saved Successfully !";
                 }
             }
         }
         else
         {
             TempData["msg"] = "Provisional Diagnosis Already Exists !";
         }
         return(RedirectToAction("ProvitionalDiagnosis", "ProvitionalDiagnosis"));
     }
     catch (Exception Ex)
     {
         TempData["msg"] = Ex.Message;
         return(RedirectToAction("ProvitionalDiagnosis", "ProvitionalDiagnosis"));
     }
 }
        public bool Save(ProvitionalDiagnosis obj)
        {
            Connect();
            SqlCommand cmd = new SqlCommand("IUProvitionalDiagnosis", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);
            if (obj.ProvitionalDiagnosisID == 0)
            {
                cmd.Parameters.AddWithValue("@ProvitionalDiagnosisID", 0);
                cmd.Parameters.AddWithValue("@Mode", "Add");
            }
            else
            {
                cmd.Parameters.AddWithValue("@ProvitionalDiagnosisID", obj.ProvitionalDiagnosisID);
                cmd.Parameters.AddWithValue("@Mode", "Edit");
            }
            cmd.Parameters.AddWithValue("@ProvitionalDiagnosisName", obj.ProvitionalDiagnosisName);
            if (obj.ReferenceCode == null)
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", string.Empty);
            }
            else
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", obj.ReferenceCode);
            }
            if (obj.ProvitionalDiagnosisDescription == null)
            {
                cmd.Parameters.AddWithValue("@ProvitionalDiagnosisDescription", DBNull.Value);
            }
            else
            {
                cmd.Parameters.AddWithValue("@ProvitionalDiagnosisDescription", obj.ProvitionalDiagnosisDescription);
            }
            cmd.Parameters.AddWithValue("@CreationID", UserID);
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }