private void InsertTemp(string receiver, int qc_reject_id) { using (var db = new QISEntities()) { try { var emails = receiver.Split(','); foreach (string email in emails) { if (email != "") { var demail = ""; if (email == "*****@*****.**")//QC OSP1 { demail = email + ",[email protected],[email protected],[email protected]"; } else if (email == "*****@*****.**")//QC OSP2 { demail = email + ",[email protected],[email protected]"; } else if (email == "*****@*****.**")//QC PPP { demail = email + ",[email protected]"; } else { demail = email; } var tbTemp = new TempEmail(); tbTemp.qc_reject_id = qc_reject_id; tbTemp.email = demail; //tbTemp.email = "*****@*****.**";//For Test tbTemp.create_date = DateTime.Now; tbTemp.type = 2;//2 = Alarm Mail db.TempEmail.Add(tbTemp); } } db.SaveChanges(); } catch (Exception ex) { Console.WriteLine("InsertTemp Error Message: " + ex.Message); } } }
private void InsertTemp(string receiver, int qc_reject_id) { using (var db = new QISEntities()) { try { //char[] delimiters = new char[] { ',', ';' }; //var emails = receiver.Split(delimiters, StringSplitOptions.RemoveEmptyEntries); var emails = receiver.Split(','); foreach (string email in emails) { if (email != "") { var demail = ""; if (email == "*****@*****.**")//PPP { demail = email + ",[email protected]"; } else if (email == "*****@*****.**")//OSP2 { demail = email + ",[email protected]"; } else if (email == "*****@*****.**")//QC OSP1 { demail = email + ",[email protected]"; } //else if (email == "*****@*****.**")//T&D //{ // demail = email + ",[email protected]"; //} //else if (email == "*****@*****.**")//PTN //{ // demail = email + ",[email protected]"; //} //Add by Monchit 2016-02-11 else if (email == "*****@*****.**")//Plant RSP { demail = email + ",[email protected]"; } else if (email == "*****@*****.**")//Plant RSP { demail = email + ",[email protected]"; } //-- else { demail = email; } var tbTemp = new TempEmail(); tbTemp.qc_reject_id = qc_reject_id; tbTemp.email = demail; //tbTemp.email = "*****@*****.**";//For Test tbTemp.create_date = DateTime.Now; tbTemp.type = 2;//2 = Alarm Mail db.TempEmail.Add(tbTemp); } } db.SaveChanges(); } catch (Exception ex) { Console.WriteLine("InsertTemp Error Message: " + ex.Message); } } }