Exception "Function does not exist" calling existing function in Webservice (Json)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ReshmaNadh
    New Member
    • Jan 2013
    • 2

    Exception "Function does not exist" calling existing function in Webservice (Json)

    The exception is "Function does not exist".But the fuction is actually exist and which is already working in a button click.A particular user only have the permission to do this.And in button click which is written using conditions.Is there any problem of mysql function permission?Webs ervice is in the form of url and i already pass the specific user id.Please reply me..
    This is the code,
    Code:
    public ActionResult AddPatientTreatment(string patientid, string treatmentid, string treatmentdate, string doctorname, string remarks, string doctorid, string paymentstatus, string paymentpaiddate,string ipid)
            { 
             string result = string.Empty, DateTimeFormat = string.Empty;
                try
                {
                    _performtreatmentBAL.PatientId = Convert.ToInt32(patientid);
                    _performtreatmentBAL.TreatmentId = Convert.ToInt32(treatmentid);
                    if (treatmentdate != string.Empty)
                    {
                        DateTimeFormat = ClinicSettingsBLL.GetDateTimeFormate();
                        _performtreatmentBAL.TreatmentDate = Common.ChangeFormat(DateTimeFormat, treatmentdate);
                    }
                    else
                    {
                        _performtreatmentBAL.TreatmentDate = DateTime.Now;
                    }
                    _performtreatmentBAL.Doctor = doctorname;
                    _performtreatmentBAL.Remarks = remarks;
                    _performtreatmentBAL.DoctorID = Convert.ToInt32(doctorid);
                    _performtreatmentBAL.PaymentPaidStatus = false;
                    _performtreatmentBAL.PaymentPaidDate = DateTime.Now;
                    _performtreatmentBAL.IPId = ipid;
                    result = Convert.ToString(AddPatientTreatments());
    
                    var data = new { status = 200, message = "{'AddPatientTreatmentResult' : [{'result':'" + result + "'}]}" };
                    return Json(data, JsonRequestBehavior.AllowGet);
                    //return GetXmlForResult("AddPatientTreatmentResult", result);
    
                }
                catch (Exception ex)
                {
                    var data = new { status = 501, message =ex.Message };
                    return Json(data, JsonRequestBehavior.AllowGet);
                    //return GetXmlForResult("Error", ex.Message);
                }
            
            }
    
      public int AddPatientTreatments()
            {
                try
                {
                     
                        
                    //ActivityLog.InsertActivity(Convert.ToString(DateTime.Now), "AddPatientTreatment()", "Use for insert patient treatment", "Doctor", "Before", System.Web.HttpContext.Current.Session["UserID"].ToString(), "", "");
                    //********************************************************************************************************************************************************************************************************
                    MySqlConnection conn = new MySqlConnection(ConnectionString());
                    MySqlCommand cmd = new MySqlCommand("insertpatienttreatment", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new MySqlParameter("param1", _performtreatmentBAL.PatientId));
                    cmd.Parameters.Add(new MySqlParameter("param2", _performtreatmentBAL.TreatmentId));
                    cmd.Parameters.Add(new MySqlParameter("param3", string.Format("{0:s}", Convert.ToDateTime(_performtreatmentBAL.TreatmentDate))));
                    cmd.Parameters.Add(new MySqlParameter("param4", _performtreatmentBAL.Doctor));
                    cmd.Parameters.Add(new MySqlParameter("param5", _performtreatmentBAL.Remarks));
                    cmd.Parameters.Add(new MySqlParameter("param6", _performtreatmentBAL.DoctorID));
                    cmd.Parameters.Add(new MySqlParameter("param8", _performtreatmentBAL.PaymentPaidStatus));
                    cmd.Parameters.Add(new MySqlParameter("param9", _performtreatmentBAL.PaymentPaidDate));
                    cmd.Parameters.Add(new MySqlParameter("?param7", MySqlDbType.Int32));
                    cmd.Parameters["?param7"].Direction = ParameterDirection.ReturnValue;
                    cmd.Parameters.Add(new MySqlParameter("param10", _performtreatmentBAL.IPId));
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    object obj = new object();
                    obj = (object)(cmd.Parameters["?param7"].Value);
                    this._performtreatmentBAL.PatientTreatmentId = Convert.ToInt32(obj);
                    cmd.Connection.Close();
                    conn.Close();
                    //********************************************************************************************************************************************************************************************************
                    //ActivityLog.InsertActivity(Convert.ToString(DateTime.Now), "AddPatientTreatment()", "Use for insert patient treatment", "Doctor", "After", System.Web.HttpContext.Current.Session["UserID"].ToString(), "", "");
                    return this._performtreatmentBAL.PatientTreatmentId;
                }
                catch (Exception e)
                {
                    //ActivityLog.InsertActivity(Convert.ToString(DateTime.Now), "AddPatientTreatment()", "Use for insert patient treatment", "Doctor", "Error", System.Web.HttpContext.Current.Session["UserID"].ToString(), "", e.Message.ToString());
                    //********************************************************************************************************************************************************************************************************
                    ErrorLogBAL.InsertException(e.Message, "InsertPatientTreatment");
                    return 0;
    
                }
            }
    Last edited by Rabbit; Jan 17 '13, 04:23 PM. Reason: Please use code tags when posting code.
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    Without seeing your code it's near impossible for us to offer any kind of assistance. When you post your code please format it with the <CODE/> button

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      You need to tell us which function is throwing the error and which line of code is causing it. I'm not going to read through hundreds of lines of code to try to find it for you when you can just tell us.

      Comment

      • ReshmaNadh
        New Member
        • Jan 2013
        • 2

        #4
        Function AddPatientTreat ments shows error

        Function AddPatientTreat ments shows error.While debugging it run upto line 62.then it goes to exception"Funct ion does not exist"

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          I can't find a reference to a function named object().

          Comment

          Working...