public DataTable pensionVolunteerMappingProc(pensionModel obj)
 {
     try
     {
         OracleCommand cmd = new OracleCommand();
         cmd.InitialLONGFetchSize = 1000;
         cmd.CommandType          = CommandType.StoredProcedure;
         cmd.CommandText          = "GSWS_PENSION_VV_MAPPING_PROC";
         cmd.Parameters.Add("ptype", OracleDbType.Varchar2).Value         = obj.type;
         cmd.Parameters.Add("psec_id", OracleDbType.Varchar2).Value       = obj.gsws_code;
         cmd.Parameters.Add("pPENSIONID", OracleDbType.Varchar2).Value    = obj.pension_id;
         cmd.Parameters.Add("pvv_id", OracleDbType.Varchar2).Value        = obj.vv_id;
         cmd.Parameters.Add("pUPDATED_ON", OracleDbType.TimeStamp).Value  = DateTime.Now;
         cmd.Parameters.Add("pUPDATED_BY", OracleDbType.Varchar2).Value   = obj.updated_by;
         cmd.Parameters.Add("pvv_name", OracleDbType.Varchar2).Value      = obj.vv_name;
         cmd.Parameters.Add("pCLUSTER_ID", OracleDbType.Varchar2).Value   = obj.cluster_id;
         cmd.Parameters.Add("pCLUSTER_NAME", OracleDbType.Varchar2).Value = obj.cluster_name;
         cmd.Parameters.Add("pcur", OracleDbType.RefCursor).Direction     = ParameterDirection.Output;
         DataTable dt = GetyouthserviceDataAdapter(cmd);                //db.executeProcedure(cmd, oradb_youth_service);
         return(dt);
     }
     catch (Exception ex)
     {
         string mappath         = HttpContext.Current.Server.MapPath("pensionVolunteerMappingProcedure");
         string serialized_data = JsonConvert.SerializeObject(obj);
         Task   WriteTask       = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, serialized_data));
         throw ex;
     }
 }
        public dynamic unassignPensioner(pensionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "8";
                int count = pensionVolunteerMappingProc1(obj);
                if (count > 0)
                {
                    objdata.status = 200;
                    objdata.result = "Pensioner Unassigned Successfully !!!";
                }
                else
                {
                    objdata.status = 400;
                    objdata.result = "Failed to update record, Please try again!!!";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
        public dynamic assignedPensionerData(pensionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "7";
                DataTable dt = pensionVolunteerMappingProc(obj);
                if (dt != null && dt.Rows.Count > 0)
                {
                    objdata.status = 200;
                    objdata.result = dt;
                }
                else
                {
                    objdata.status = 400;
                    objdata.result = "No data available with the entered Pensioner ID";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
        public dynamic assignSecretariatToPensioners(pensionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "6";
                DataTable dt = pensionVolunteerMappingProc(obj);
                if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1")
                {
                    objdata.status = 200;
                    objdata.result = "Record Updated Successfully !!!";
                }
                else
                {
                    objdata.status = 400;
                    objdata.result = "Failed to update record, Please try again!!!";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
        public dynamic individualPensionData(pensionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "5";
                DataTable dt = pensionVolunteerMappingProc(obj);
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["STATUS"].ToString() != "1")
                    {
                        objdata.status = 200;
                        objdata.result = dt;
                    }
                    else
                    {
                        objdata.status = 400;
                        objdata.result = "Pensioner already assigned to " + dt.Rows[0]["DISTRICT_NAME"].ToString() + " District, " + dt.Rows[0]["MANDAL_NAME"].ToString() + " Mandal, " + dt.Rows[0]["SACHIVALAYAM_NAME"].ToString() + " Sachivalayam, " + dt.Rows[0]["CLUSTER_NAME"].ToString() + " cluster";
                    }
                }
                else
                {
                    objdata.status = 400;
                    objdata.result = "No data available with the entered Pensioner ID";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
        public dynamic loadClusters(pensionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "2";
                DataTable dt = pensionVolunteerMappingProc(obj);
                if (dt != null && dt.Rows.Count > 0)
                {
                    objdata.status = 200;
                    objdata.result = dt;
                }
                else
                {
                    objdata.status = 400;
                    objdata.result = "No Clusters available for this secretariat !!!";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }