Inserting customer care database analysis detail records
With ToArray() you create an in-memory copy of all queried data. If you have 10m records this is incredibly expensive (both for CPU and memory). Avoid that and fetch data from DB each time you use it without needless copies. See also this question post for further details.

First change it to:

var query = from p in behzad.Customer_Care_Database_Analysis_TEMPs select p;


Your query does nothing then you may simply drop it if you don't need to perform any filtering.
Instead of for use foreach and do not (re)count collection each time. Even if LINQ should be smart enough (it was an array and it may cast and directly access .Length property) it's useless (see also Eric Lippert's answer about purpose) and with a pure enumeration it'll hit database with SELECT COUNT(*) ... multiple times.

foreach (var temp in behzad.Customer_Care_Database_Analysis_TEMPs)
{
    var detail = new Customer_Care_Database_Analysis_DETAIL();
    detail.code_faaliyat = temp.code_faaliyat.Trim();
    detail.code_markaz = temp.code_markaz.Trim();

    // And so on...

    behzad.Customer_Care_Database_Analysis_DETAILs.InsertOnSubmit(detail);
    behzad.SubmitChanges();
}

Now you should move SubmitChanges() outside your loop, this is 2nd big step to improve performance. Start searching from this question but there are many (better) posts out there about this topic. See also this question.

foreach (var temp in behzad.Customer_Care_Database_Analysis_TEMPs)
{
    var detail = new Customer_Care_Database_Analysis_DETAIL();
    detail.code_faaliyat = temp.code_faaliyat.Trim();
    detail.code_markaz = temp.code_markaz.Trim();

    // And so on...

    behzad.Customer_Care_Database_Analysis_DETAILs.InsertOnSubmit(detail);
}

behzad.SubmitChanges();


Performance impact of removing multiple array item deferencing and of introducing enumeration is absolutely negligible in this case.
Note that you may also partition your inputs. This is something you should profile for your specific case but you may get better performance working on batches of input data.

You may find many good implementations of Partition() function (also on Stack Overflow, for example or one of linked duplicates) then here I just provide pseudo-code for that:

const int batchSize = 100;
var batches = Partition(behzad.Customer_Care_Database_Analysis_TEMPs, batchSize);

foreach (var batch in batches)
{
    foreach (var temp in partition)
    {
        var detail = new Customer_Care_Database_Analysis_DETAIL();
        detail.code_faaliyat = temp.code_faaliyat.Trim();
        detail.code_markaz = temp.code_markaz.Trim();

        // And so on...

        behzad.Customer_Care_Database_Analysis_DETAILs.InsertOnSubmit(detail);
    }

    behzad.SubmitChanges();
}