Пример #1
0
        private static void Process_Update_Phone(DataTable table)
        {
            classDataAccess dwDataAccess = new classDataAccess();

            dwDataAccess.OpenConnection("CW_DW");

            int    result    = 0;
            int    resu_aud1 = 0;
            int    resu_aud2 = 0;
            int    count     = 0;
            int    count_err = 0;
            string phone_p   = "";


            foreach (DataRow row in table.Rows)
            {
                result = 0;
                if (dwDataAccess.Check_Exist_Card(row.ItemArray[1].ToString()) == "1") //cif co tren cw
                {
                    phone_p = dwDataAccess.Get_Inf_Cus(row.ItemArray[1].ToString());   //phone from CW
                    //if (phone_p != "")
                    {
                        resu_aud1 = dwDataAccess.Insert_UPD_INF_AUD(UPDATE_TYPE, row.ItemArray[1].ToString(), phone_p, row.ItemArray[0].ToString(), 1);
                        resu_aud2 = dwDataAccess.Insert_UPD_INF_AUD(UPDATE_TYPE, row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), row.ItemArray[0].ToString(), 2);
                    }


                    result = dwDataAccess.Update_CIF(row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), row.ItemArray[3].ToString(), row.ItemArray[0].ToString());

                    if (result == 1)                                                                                                             //update cif thanh cong
                    {
                        int flag_in_dw = dwDataAccess.Insert_Update_InfDW(UPDATE_TYPE, row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), //row.ItemArray[3].ToString(),
                                                                          row.ItemArray[0].ToString(), "S");
                        if (flag_in_dw != 0)                                                                                                     //insert DW thanh cong
                        {
                            count++;
                        }
                    }
                    else
                    {
                        classUpdatePhoneLogWriter.WriteLog("cif: " + row.ItemArray[1].ToString() + " can't update from FCC");
                        count_err++;
                    }
                }
                else
                {
                    dwDataAccess.Insert_Update_InfDW(UPDATE_TYPE, row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), //row.ItemArray[3].ToString(),
                                                     row.ItemArray[0].ToString(), "D");                                     //D: cif don't have on CW
                }
            }

            dwDataAccess.CloseConnection();
            classUpdatePhoneLogWriter.WriteLog("so cif da update thanh cong: " + count);
            classUpdatePhoneLogWriter.WriteLog("so cif update loi: " + count_err);
        }