Пример #1
0
        private string GetEmailProduction(int?group_id)
        {
            string email_list = "";

            using (var db = new TNC_ADMINEntities())
            {
                var query = (from a in db.View_Organization
                             where a.group_id == group_id
                             select a).FirstOrDefault();

                if (query != null)
                {
                    email_list += !string.IsNullOrEmpty(query.GroupMgr_email) ? "," + query.GroupMgr_email : string.Empty;
                    email_list += !string.IsNullOrEmpty(query.DeptMgr_email) ? "," + query.DeptMgr_email : string.Empty;

                    if (!string.IsNullOrEmpty(query.PlantMgr_email))
                    {
                        if (query.PlantMgr_email == "*****@*****.**")//BPK3
                        {
                            email_list += "," + query.PlantMgr_email + ";[email protected]";
                        }
                        else if (query.PlantMgr_email == "*****@*****.**")//VCP
                        {
                            email_list += "," + query.PlantMgr_email + ";[email protected];[email protected]";
                        }
                        else if (query.PlantMgr_email == "*****@*****.**")//RSP
                        {
                            email_list += "," + query.PlantMgr_email + ";[email protected];[email protected]";
                        }
                        else if (query.PlantMgr_email == "*****@*****.**")//T&D
                        {
                            email_list += "," + query.PlantMgr_email + ";[email protected]";
                        }
                        else
                        {
                            email_list += "," + query.PlantMgr_email;
                        }

                        email_list += ";[email protected];[email protected]";
                    }
                    else
                    {
                        email_list += string.Empty;
                    }
                }
            }
            return(email_list);
        }
Пример #2
0
        private string GetEmailQC(int plant)
        {
            string email_list = "";

            using (var db = new QISEntities())
            {
                var query = (from a in db.AuthUser
                             where a.plant_id == plant && a.utype_id == 3
                             select a).FirstOrDefault();
                if (query != null)
                {
                    using (var dbTNC = new TNC_ADMINEntities())
                    {
                        var get_mail = (from a in dbTNC.View_Organization
                                        where a.GroupMgr == query.user_code
                                        select a).FirstOrDefault();
                        if (get_mail != null)
                        {
                            email_list += !string.IsNullOrEmpty(get_mail.GroupMgr_email) ? "," + get_mail.GroupMgr_email : string.Empty;
                            email_list += !string.IsNullOrEmpty(get_mail.DeptMgr_email) ? "," + get_mail.DeptMgr_email : string.Empty;
                            //email_list += !string.IsNullOrEmpty(get_mail.PlantMgr_email) ? "," + get_mail.PlantMgr_email : string.Empty;
                        }
                        else
                        {
                            var get_mail_dept = (from a in dbTNC.View_Organization
                                                 where a.DeptMgr == query.user_code
                                                 select a).FirstOrDefault();
                            if (get_mail_dept != null)
                            {
                                email_list += !string.IsNullOrEmpty(get_mail_dept.DeptMgr_email) ? ","
                                              + get_mail_dept.DeptMgr_email : string.Empty;
                                //email_list += !string.IsNullOrEmpty(get_mail_dept.PlantMgr_email) ? ","
                                //    + get_mail_dept.PlantMgr_email : string.Empty;
                            }
                        }
                    }
                }
            }
            return(email_list);
        }
Пример #3
0
        private string GetEmailProdSupDown(int?group_id)
        {
            string email_list = "";

            using (var db = new TNC_ADMINEntities())
            {
                var query = from a in db.tnc_user
                            where a.emp_group == group_id && (a.email != null && a.email != "") &&
                            (a.emp_position == 3 || a.emp_position == 5)   //Staff or Supervisor
                            select a.email;

                if (query.Any())
                {
                    foreach (var item in query)
                    {
                        email_list += "," + item;
                    }
                    //email_list = email_list.Substring(1);
                }
            }
            return(email_list);
        }