public static DataTable citizenGrevProc(NewaadherModel obj)
 {
     try
     {
         OracleCommand cmd = new OracleCommand();
         cmd.InitialLONGFetchSize = 1000;
         cmd.CommandType          = CommandType.StoredProcedure;
         cmd.CommandText          = "GSWS_GRIEVIANCE_PROC";
         cmd.Parameters.Add("REPORT_TYPE", OracleDbType.Varchar2).Value        = obj.type;
         cmd.Parameters.Add("P_UID_NUM", OracleDbType.Varchar2).Value          = obj.uidNum;
         cmd.Parameters.Add("P_NAME", OracleDbType.Varchar2).Value             = obj.citizenName;
         cmd.Parameters.Add("P_GENDER", OracleDbType.Varchar2).Value           = obj.gender;
         cmd.Parameters.Add("P_DISTRICT_NAME", OracleDbType.Varchar2).Value    = obj.districtName;
         cmd.Parameters.Add("P_DISTRICT_ID", OracleDbType.Varchar2).Value      = obj.districtId;
         cmd.Parameters.Add("P_MANDAL_NAME", OracleDbType.Varchar2).Value      = obj.mandalName;
         cmd.Parameters.Add("P_MANDAL_ID", OracleDbType.Varchar2).Value        = obj.mandalId;
         cmd.Parameters.Add("P_SECRETARIAT_ID", OracleDbType.Varchar2).Value   = obj.secId;
         cmd.Parameters.Add("P_SECRETARIAT_NAME", OracleDbType.Varchar2).Value = obj.secId;
         cmd.Parameters.Add("P_MOBILE_NUMBER", OracleDbType.Varchar2).Value    = obj.mobileNumber;
         cmd.Parameters.Add("P_CLUSTER_ID", OracleDbType.Varchar2).Value       = obj.clusterId;
         cmd.Parameters.Add("P_CLUSTER_NAME", OracleDbType.Varchar2).Value     = obj.clusterName;
         cmd.Parameters.Add("P_STATUS", OracleDbType.Varchar2).Value           = obj.status;
         cmd.Parameters.Add("P_UPDATED_BY", OracleDbType.Varchar2).Value       = obj.updatedBy;
         cmd.Parameters.Add("P_CUR", OracleDbType.RefCursor).Direction         = ParameterDirection.Output;
         DataTable dtstatus = _Hel.GetProdgswsDataAdapter(cmd);
         return(dtstatus);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static dynamic citizenUpdate(NewaadherModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "6";
                DataTable dt = citizenGrevProc(obj);
                if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1")
                {
                    objdata.success = true;
                    objdata.result  = "Citizen Details Mapped Successfully !!!";
                }
                else
                {
                    objdata.success = false;
                    objdata.result  = "Failed to submit details, Please try again !!!";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message.ToString();
                objdata.success = false;
                objdata.result  = message;
            }


            return(objdata);
        }
        public static dynamic secList(NewaadherModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.type = "3";
                DataTable dt = citizenGrevProc(obj);
                if (dt != null && dt.Rows.Count > 0)
                {
                    objdata.success = true;
                    objdata.result  = dt;
                }
                else
                {
                    objdata.success = false;
                    objdata.result  = "No Secretariats available to load, Please try again !!!";
                }
            }
            catch (Exception ex)
            {
                objdata.success = false;
                objdata.result  = ex.Message.ToString();
            }
            return(objdata);
        }
        public static dynamic citizenDetailsSub(NewaadherModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                string captchaverify = new captchahelper().GetCaptchVerify(obj);
                if (captchaverify == "Success")
                {
                    obj.type = "4";
                    DataTable dt = citizenGrevProc(obj);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        objdata.success = true;
                        objdata.result  = dt;

                        string message = "క్లస్టర్ నందు హౌస్ హోల్డ్ మాపింగ్ చేసుకొనుటకు మీ యొక్క రిక్వెస్ట్ ను మీ సచివాలయం యొక్క పంచాయితీ సెక్రటరీ కు పంపబడినది.\n";
                        message += "మీ యొక్క రిక్వెస్ట్ ఐ డి నెంబర్ : " + dt.Rows[0]["GREVIANCE_ID"].ToString() + "\n";
                        message += "పంచాయితీ సెక్రటరీ మొబైల్ నెంబర్ : " + dt.Rows[0]["MOBILE_NUMBER"].ToString() + "\n";
                        message += "సచివాలయం పేరు : " + dt.Rows[0]["SEC_NAME"].ToString() + "\n";
                        SMSService.SMSService objSMS = new SMSService.SMSService();
                        objSMS.SendTeluguSMS(obj.mobileNumber, message);
                    }
                    else
                    {
                        objdata.success = false;
                        objdata.result  = "Failed to submit details, Please try again !!!";
                    }
                }
                else
                {
                    objdata.Status = false;
                    objdata.result = "Invalid Captcha";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message.ToString();
                if (message.Contains("ORA-00001"))
                {
                    objdata.success = false;
                    objdata.result  = "Grevenance Aleary raised, Please contact your secretariat Panchayat Secretary !!!";
                }
                else
                {
                    objdata.success = false;
                    objdata.result  = message;
                }
            }


            return(objdata);
        }
        public IHttpActionResult districtList(dynamic data)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                string         serialized_data = JsonConvert.SerializeObject(data);
                NewaadherModel rootobj         = JsonConvert.DeserializeObject <NewaadherModel>(serialized_data);
                return(Ok(KYVHelper.districtList(rootobj)));
            }
            catch (Exception ex)
            {
                objdata.status = false;
                objdata.result = ex.Message.ToString();
            }
            return(Ok(objdata));
        }
        public IHttpActionResult citizenDetails(dynamic data)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                string         serialized_data = token_gen.Authorize_aesdecrpty(data);
                NewaadherModel rootobj         = JsonConvert.DeserializeObject <NewaadherModel>(serialized_data);
                return(Ok(KYVHelper.citizenDetails(rootobj)));
            }
            catch (Exception ex)
            {
                objdata.status = false;
                objdata.result = ex.Message.ToString();
            }
            return(Ok(objdata));
        }
        public IHttpActionResult citizenUpdate(dynamic data)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                string         serialized_data = token_gen.Authorize_aesdecrpty(data);
                string         mappath2        = HttpContext.Current.Server.MapPath("citizenUpdateLogs");
                Task           WriteTask       = Task.Factory.StartNew(() => new Logdatafile().Write_Log(mappath2, serialized_data));
                NewaadherModel rootobj         = JsonConvert.DeserializeObject <NewaadherModel>(serialized_data);
                return(Ok(KYVHelper.citizenUpdate(rootobj)));
            }
            catch (Exception ex)
            {
                objdata.status = false;
                objdata.result = ex.Message.ToString();
            }
            return(Ok(objdata));
        }