convert the code into django
don't use models
covnert the whole code line by line don't skip anything covert the whole code
private void Feasibility_Mannear(double custX, double custY, string cityName, string CustAddr, string bandwith, string pid, string fsid, string fid_module, string prov_name)
    {
        WaisBaseclass objDB = new WaisBaseclass();
        clsFeasibility objFSB = new clsFeasibility();
        string[] charArg = { "??" };
        string strInterface = "";
        double ospdist = 0;

        if (!string.IsNullOrEmpty(bandwith))
        {
            if (bandwith.ToUpper().Contains("K"))
            {
                bandwith = "2M";
            }
        }       

        DataTable dtHandle = new DataTable();
        DataTable dtNodeBso = new DataTable();
        DataTable dtBwCkt = new DataTable();
        DataTable dtIsCity = new DataTable();
        try
        { 
            double dmin = 100000000;
            double nearestHandleX = 0;
            double nearestHandleY = 0;
            string Remarks = "";
            string hh_name = string.Empty;
            string hh_id = string.Empty;

            string qry = string.Empty; string deliveryTimeline = string.Empty; prov_name = "MAN";
            qry = "Select delivery_time from delivery_timelines where Media_Type='" + prov_name + "' and Media_Category='MAN'";
            deliveryTimeline = Convert.ToString(objDB.Execute_Scalar(qry));
            qry = "Select IsOnnetCity,IsOffnetCity,IsMannearnetCity,IsWimaxCity,IsRFCity from  eeplus_citymaster where upper(city_name)='" + cityName.ToUpper() + "'";
            objDB.GetData(qry, ref dtIsCity);
            if (dtIsCity != null)
            {
                if (dtIsCity.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dtIsCity.Rows[0]["IsMannearnetCity"]) != 1)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
            qry = "select * from india_handle where city= '" + cityName.ToUpper().Trim() + "'";
            objDB.GetData(qry, ref dtHandle);

            if (dtHandle.Rows.Count > 0 && !fid_module.Contains("FIBER_AT_GATE"))
            {
                DataTable tblwireline = new DataTable();
                tblwireline.Columns.Add("Dist", typeof(double));
                tblwireline.Columns.Add("Content", typeof(string));

                for (int n = 0; n < dtHandle.Rows.Count; n++)
                {
                    double d = objDB.WGS84distance(custX, custY, Convert.ToDouble(dtHandle.Rows[n]["hh_long"]), Convert.ToDouble(dtHandle.Rows[n]["hh_lat"]), 1);
                    var ArrayData = dtHandle.Rows[n]["hh_lat"].ToString() + "##" + dtHandle.Rows[n]["hh_long"].ToString() + "##" + dtHandle.Rows[n]["hh_id"].ToString();
                    tblwireline.Rows.Add(d, ArrayData);
                    
                }
                DataView dvData = new DataView(tblwireline);
                dvData.Sort = "Dist";
                DataTable outdt = dvData.ToTable();
                
                clsDistanceMatrix googleDistanceMatrix = new clsDistanceMatrix();
                string xmlFileName = HttpContext.Current.Server.MapPath("xmlschemas/DistanceMatrix.xml");
                string srcLatLng = custY + "," + custX;
                if (googleDistanceMatrix.PostDistanceMatrixRequest(xmlFileName, srcLatLng, ref outdt) == true)
                {
                    ArrayList AlngRoadDistance = new ArrayList();
                    ArrayList arrAddress = new ArrayList();
                    googleDistanceMatrix.GetDistanceMatrixResponse(xmlFileName, ref AlngRoadDistance, ref arrAddress);

                    DataTable dmnewdt = new DataTable();
                    dmnewdt.Columns.Add("Dist", typeof(double));
                    dmnewdt.Columns.Add("Content", typeof(string));

                    string TempStorage = string.Empty;
                    for (int z = 0; z < AlngRoadDistance.Count; z++)
                    {
                        if (AlngRoadDistance[z].ToString().ToUpper() == "NO ROAD")
                        {
                            if (TempStorage == string.Empty)
                            {
                                TempStorage = z.ToString();
                            }
                            else
                            {
                                TempStorage = TempStorage + "," + z.ToString();
                            }

                        }
                    }

                    string[] TempStorageArray = { };

                    if (TempStorage != string.Empty)
                    {
                        if (TempStorage.Contains(',') == true)
                        {
                            TempStorageArray = TempStorage.Split(',');
                        }
                        else
                        {
                            TempStorageArray[0] = TempStorage;
                        }
                        foreach (string RemoveIndex in TempStorageArray.Reverse())
                        {
                            AlngRoadDistance.RemoveAt(Convert.ToInt32(RemoveIndex));
                        }
                    }

                    try
                    {
                        for (int j = 0; j < AlngRoadDistance.Count; j++)
                        {
                            string apstring = "##" + arrAddress[j].ToString() + "##onnet";
                            string tcontent = outdt.Rows[j]["Content"].ToString().Replace("##onnet", apstring);
                            dmnewdt.Rows.Add(AlngRoadDistance[j], AlngRoadDistance[j] + "##" + tcontent);
                        }

                        DataView dvSort = new DataView(dmnewdt);
                        dvSort.Sort = "Dist";
                        outdt = new DataTable();
                        outdt = dvSort.ToTable();
                        String[] sepHash = { "##" };
                        string currContent = outdt.Rows[0]["Content"].ToString();
                        string[] e = currContent.Split(sepHash, StringSplitOptions.None);
                        nearestHandleX = Convert.ToDouble(e[2]);
                        nearestHandleY = Convert.ToDouble(e[1]);
                        ospdist = Convert.ToDouble(e[0]);
                        hh_id = Convert.ToString(e[3]);
                        qry = "select hh_name from india_handle where hh_id= '" + hh_id + "'";
                        hh_name =Convert.ToString (objDB.Execute_Scalar(qry));

                        if (ospdist == 0)
                        {
                            Remarks = "Check with OSP team (Customer and Manhole are at same Location)";
                        }
                        else if (ospdist > 500)
                        {
                            ospdist = ospdist * 2.6;
                        }
                        outdt.Dispose(); outdt = null;
                        dvData.Dispose(); dvData = null;
                    }
                    catch
                    {
                        nearestHandleX = 0; nearestHandleY = 0; ospdist = 0;
                        Remarks = "Check with OSP team (Customer and Manhole are at same Location)";
                        dtFSB.Rows[4]["Remarks"] = "Check with OSP team (Customer and Manhole are at same Location)";
                    }
                }
                else
                {
                    nearestHandleX = 0; nearestHandleY = 0;
                    Remarks = "Check with OSP team (Customer and Manhole are at same Location)";
                    dtFSB.Rows[4]["Remarks"] = "Check with OSP team (Customer and Manhole are at same Location)";
                }

                tblwireline.Dispose(); tblwireline = null;
            }


            if (dtHandle.Rows.Count <= 0) { dmin = 0; nearestHandleX = 0; nearestHandleY = 0; }
            if (dmin == 0)
            {
                dtFSB.Rows[4]["IsApplicable"] = "Not Feasible";
                dtFSB.Rows[4]["Remarks"] = "Handle not found in DB;";
                Remarks = "Handle not found in DB;";
            }
            else
            {
                double min;
                double minX;
                double minY;
                string addr = "";
                DataTable dtManPop_3 = new DataTable();
                objFSB.GetNearestPopDetail(custX, custY, out min, out minX, out minY, out addr, ref objDB, cityName, out dtManPop_3);

                if (min == 0)
                {
                    dtFSB.Rows[4]["IsApplicable"] = "Not Feasible";
                    dtFSB.Rows[4]["Remarks"] = "POP details not found in DB;";
                    Remarks = "POP details not found in DB;";
                }
                else
                {
                    string strCD = ""; string ckt_type = "0"; 
                    
                    ArrayList arc_bwMan = new ArrayList(); ArrayList arc_otcMan = new ArrayList(); ArrayList arc_neMan = new ArrayList();
                    ArrayList total_priceMan = new ArrayList(); ArrayList arcDistMan = new ArrayList(); ArrayList arcAddrMan = new ArrayList();
                    ArrayList arcPopID = new ArrayList();                                    
                    strInterface = HttpContext.Current.Session["Interface"].ToString();
                    
                    int rowCountMan = 3;
                    if (dtManPop_3.Rows.Count < rowCountMan)
                    {
                        rowCountMan = dtManPop_3.Rows.Count;
                    }
                    for (int z = 0; z < rowCountMan; z++)
                    {
                        strCD = objFSB.GetCdCost_onnet(bandwith, strInterface, Convert.ToDouble(dtManPop_3.Rows[z]["MinDist"]));
                        if (string.IsNullOrEmpty(strCD) && z == 0)
                        {
                            
                            dtFSB.Rows[4]["IsApplicable"] = "Not Feasible";
                            dtFSB.Rows[4]["Remarks"] = "Cost details not found in DB(OTC,ARC,NRC);";
                            Remarks = "Cost details not found in DB(OTC,ARC,NRC);";
                        }
                        else
                        {
                            arc_bwMan.Add(strCD.Split(charArg, StringSplitOptions.None)[0]);
                            arc_otcMan.Add(strCD.Split(charArg, StringSplitOptions.None)[1]);
                            arc_neMan.Add(strCD.Split(charArg, StringSplitOptions.None)[2]);
                            total_priceMan.Add(strCD.Split(charArg, StringSplitOptions.None)[3]);
                            arcDistMan.Add(dtManPop_3.Rows[z]["MinDist"]);
                            arcAddrMan.Add(Convert.ToString(dtManPop_3.Rows[z]["ADDRESS"]));
                            arcPopID.Add(Convert.ToString(dtManPop_3.Rows[z]["POP_ID"]));
                           
                        }
                    }
                    if (rowCountMan == 1)
                    {

                        qry = "insert into mannearnet_feasibility(PID,FSID,MAN_City,FS_Status,POP_Address,POP_ID,0,OTC,ARC_BW,ARC_NE,handle_x,handle_y,cd_price,process_status,CityName,Cust_Addr,CustX,CustY,mannearnet_bw,mannearnet_capex_bw,ckt_type,Delivery_Time,customer_name,bulkdata, hh_name) values" +
                             "('" + pid + "','" + fsid + "','" + objFSB.IsCity(Convert.ToString(dtIsCity.Rows[0]["IsMannearnetCity"])) + "','','" + arcAddrMan[0] + "','" + arcPopID[0] + "'," + Math.Round(Convert.ToDouble(arcDistMan[0]), 3) + "," + arc_otcMan[0] + "," + arc_bwMan[0] + "," + arc_neMan[0] + "," + nearestHandleX + "," + nearestHandleY + "," + total_priceMan[0] + ",'Not Completed','" + cityName.ToUpper() + "','" + CustAddr.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ") + "'," + custX + "," + custY + ",'" + bandwith + "','" + bandwith.ToUpper().Replace("MBPS", "") + "'," + ckt_type + ",'" + deliveryTimeline + "','', 1,'" + hh_name + "')";


                    }
                    else if (rowCountMan == 2)
                    {
                        qry = "insert into mannearnet_feasibility(PID,FSID,MAN_City,FS_Status,POP_Address,POP_ID,CD,OTC,ARC_BW,ARC_NE,handle_x,handle_y,cd_price,process_status,CityName,Cust_Addr,CustX,CustY,mannearnet_bw,mannearnet_capex_bw,ckt_type,customer_name,POP_Address2,POP_ID2,CD2,OTC2,ARC_BW2,ARC_NE2,Total_Price2,Delivery_Time,bulkdata, hh_name) values" +
                            "('" + pid + "','" + fsid + "','" + objFSB.IsCity(Convert.ToString(dtIsCity.Rows[0]["IsMannearnetCity"])) + "','','" + arcAddrMan[0] + "','" + arcPopID[0] + "'," + Math.Round(Convert.ToDouble(arcDistMan[0]), 3) + "," + arc_otcMan[0] + "," + arc_bwMan[0] + "," + arc_neMan[0] + "," + nearestHandleX + "," + nearestHandleY + "," + total_priceMan[0] + ",'Not Completed','" + cityName.ToUpper() + "','" + CustAddr.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ") + "'," + custX + "," + custY + ",'" + bandwith + "','" + bandwith.ToUpper().Replace("MBPS", "") + "'," + ckt_type + ",'','" + arcAddrMan[1] + "','" + arcPopID[1] + "'," + Math.Round(Convert.ToDouble(arcDistMan[1]), 3) + "," + arc_otcMan[1] + "," + arc_bwMan[1] + "," + arc_neMan[1] + "," + total_priceMan[1] + ",'" + deliveryTimeline + "',1,'" + hh_name + "')";
                    }
                    else if (rowCountMan == 3)
                    {
                       qry = "insert into mannearnet_feasibility(PID,FSID,MAN_City,FS_Status,POP_Address,POP_ID,CD,OTC,ARC_BW,ARC_NE,handle_x,handle_y,cd_price,process_status,CityName,Cust_Addr,CustX,CustY,mannearnet_bw,mannearnet_capex_bw,ckt_type,customer_name,POP_Address2,POP_ID2,CD2,OTC2,ARC_BW2,ARC_NE2,Total_Price2,POP_Address3,POP_ID3,CD3,OTC3,ARC_BW3,ARC_NE3,Total_Price3,Delivery_Time, bulkdata,hh_name) values" +
                            "('" + pid + "','" + fsid + "','" + objFSB.IsCity(Convert.ToString(dtIsCity.Rows[0]["IsMannearnetCity"])) + "','','" + arcAddrMan[0] + "','" + arcPopID[0] + "'," + Math.Round(Convert.ToDouble(arcDistMan[0]), 3) + "," + arc_otcMan[0] + "," + arc_bwMan[0] + "," + arc_neMan[0] + "," + nearestHandleX + "," + nearestHandleY + "," + total_priceMan[0] + ",'Not Completed','" + cityName.ToUpper() + "','" + CustAddr.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ") + "'," + custX + "," + custY + ",'" + bandwith + "','" + bandwith.ToUpper().Replace("MBPS", "") + "'," + ckt_type + ",'','" + arcAddrMan[1] + "','" + arcPopID[1] + "'," + Math.Round(Convert.ToDouble(arcDistMan[1]), 3) + "," + arc_otcMan[1] + "," + arc_bwMan[1] + "," + arc_neMan[1] + "," + total_priceMan[1] + ",'" + arcAddrMan[2] + "','" + arcPopID[2] + "'," + Math.Round(Convert.ToDouble(arcDistMan[2]), 3) + "," + arc_otcMan[2] + "," + arc_bwMan[2] + "," + arc_neMan[2] + "," + total_priceMan[2] + ",'" + deliveryTimeline + "', 1,'" + hh_name + "')";
                    }
                    else
                    {
                    }
                    objDB.Execute_NonQuery(qry);
                    double osp_price = 0; double inb_price = 0; double mux_price = 0; double capex = 0; double cd_price = 0; double pricing = 0;
                    string multitenant = ""; string wimaxmigration = ""; string buildingname = "";

                    DataTable dtPricePermeter = new DataTable();
                    WaisBaseclass b = new WaisBaseclass();
                    try
                    {
                        string query = "select cost_permeter from eeplus_citymaster where upper(city_name)='" + cityName.ToUpper() + "'";
                        b.GetData(query, ref dtPricePermeter);

                        if (ospdist <= 50 && ospdist > 0)
                        {
                            osp_price = 40000;
                        }
                        else
                        {
                            osp_price = Convert.ToDouble(ospdist) * Convert.ToDouble(dtPricePermeter.Rows[0]["cost_permeter"]);
                        }
                       
                        query = "select INB_Cost from mannearnet_feasibility where upper(FSID)='" + fsid.ToUpper() + "'";
                        inb_price = Convert.ToDouble(b.Execute_Scalar(query));
                        if (fid_module.Contains("FIBER_AT_GATE"))
                        {
                            inb_price = 40000; ospdist = 0; osp_price = 0;

                            query = "SELECT `MultiTenant` FROM `fiber_at_gate_master` WHERE `ADDRESS` = '" + CustAddr + "'";
                            multitenant = Convert.ToString(objDB.Execute_Scalar(query));

                            query = "SELECT `WimaxMigration` FROM `fiber_at_gate_master` WHERE `ADDRESS` = '" + CustAddr + "'";
                            wimaxmigration = Convert.ToString(objDB.Execute_Scalar(query));

                            query = "SELECT `CUSTOMER_NAME` FROM `fiber_at_gate_master` WHERE `ADDRESS` = '" + CustAddr + "'";
                            buildingname = Convert.ToString(objDB.Execute_Scalar(query));
                        }

                        query = "select cd_price from mannearnet_feasibility where upper(FSID)='" + fsid.ToUpper() + "'";
                        cd_price = Convert.ToDouble(b.Execute_Scalar(query));
                        query = "select Mux_Cost from muxcost_revamp where Interface = '" + strInterface + "' and BW='" + bandwith + "' and Man=true";
                        mux_price = Convert.ToDouble(b.Execute_Scalar(query));
                        if (Remarks == " Check with OSP team (Customer and Manhole are at same Location)")
                        {
                            mux_price = 0; ospdist = 0; osp_price = 0;
                        }
                        capex = osp_price + mux_price + inb_price;

                        pricing = capex + cd_price;

                        double ospKmdist = (Convert.ToDouble(ospdist) / 1000);

                        string fs_status = objFSB.GetFs_statusInNearnet(ospKmdist);

                        if (!(fs_status.ToUpper() == "FEASIBLE"))
                        {
                            dtFSB.Rows[4]["IsApplicable"] = "Not Feasible";
                            dtFSB.Rows[4]["Remarks"] = "OSP more than 750 Mtrs;";
                            Remarks = "OSP more than 750 Mtrs;";
                        }
                        else
                        {
                            if (!(dtFSB.Rows[4]["Bandwith"].ToString() == "0"))
                            {
                                AddPriceToFeasibilityMatrix(2, pricing);
                                dtFSB.Rows[4]["IsApplicable"] = "Feasible";
                            }
                        }


                        if (Remarks == "Not Checked (Unable to compute OSP Distance)" || Remarks == "Check with OSP team (Customer and Manhole are at same Location)")
                        {
                            fs_status = Remarks;
                            mux_price = 0; ospdist = 0; osp_price = 0; inb_price = 0; capex = 0; cd_price = 0; pricing = 0;
                            query = "update mannearnet_feasibility set FS_Status='" + fs_status + "',OSP_dist='" + ospKmdist + "',OSP_Cost='" + osp_price + "',Mux_Cost='" + mux_price + "',Capex='" + capex + "',Pricing='" + pricing + "',process_status='Completed' ," + "Remarks='" + Remarks + "',INB_Cost='" + inb_price + "',CD=0,OTC=0,ARC_BW=0,ARC_NE=0,cd_price=0,delivery_time=0 where upper(FSID)='" + fsid.ToUpper() + "'";
                            b.Execute_NonQuery(query);
                        }
                        else
                        {
                            query = "update mannearnet_feasibility set FS_Status='" + fs_status + "',OSP_dist='" + ospKmdist + "',OSP_Cost='" + osp_price + "',Mux_Cost='" + mux_price + "',Capex='" + capex + "',Pricing='" + pricing + "',process_status='Completed' ," + "Remarks='" + Remarks + "',INB_Cost='" + inb_price + "', MultiTenant='" + multitenant + "',WimaxMigration='" + wimaxmigration + "',`BuildingName`='" + buildingname + "'  where upper(FSID)='" + fsid.ToUpper() + "'";
                            b.Execute_NonQuery(query);
                        }

                    }
                    catch (Exception ex)
                    {
                        clsExceptions.Instance.LogException(ex, "Feasibility_Mannearnet(clsBusiness.cs)");
                        string query = "update mannearnet_feasibility set FS_Status='Not Feasible',OSP_dist=0,OSP_Cost=0,Mux_Cost=0,Capex=0,Pricing=0,process_status='Completed',Remarks='" + Remarks + "',delivery_time=0 where upper(FSID)='" + fsid.ToUpper() + "'";
                        b.Execute_NonQuery(query);
                    }
                    finally
                    {

                        dtPricePermeter.Dispose();
                        dtPricePermeter = null;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            
            clsExceptions.Instance.LogException(ex, "Feasibility_Mannearnet(clsBusiness.cs)");

            string queryInsert = "insert into mannearnet_feasibility(PID,FSID,process_status) values('" + pid + "','" + fsid + "','Not Completed')";
            objDB.Execute_NonQuery(queryInsert);

        }

        finally
        {
            
            dtNodeBso.Dispose();
            dtNodeBso = null;

            dtBwCkt.Dispose();
            dtBwCkt = null;

            dtIsCity.Dispose();
            dtIsCity = null;

            dtHandle.Dispose();
            dtHandle = null;
            
        }
        
        string query1 = "update pid_master set IsfsCompleted=true where upper(FSID)='" + fsid.ToUpper() + "' and fid_module='" + fid_module + "'";
        objDB.Execute_NonQuery(query1);        

    }