Ejemplo n.º 1
0
        public async Task SendEmail(Transfer_Form_Generate_Dto dataItem, string pathFileExcel)
        {
            var dataPar = _settingSupplierRepository.FindAll();

            var dataMail = dataPar.Where(x => x.Supplier_No == dataItem.T3_Supplier).FirstOrDefault();

            if (dataItem.T3_Supplier == "")
            {
                dataMail = dataPar.Where(x => x.Supplier_No == "ZZZZ").FirstOrDefault();
            }

            if (dataItem.T3_Supplier == "0000")
            {
                dataMail = dataPar.Where(x => x.Supplier_No == dataItem.T3_Supplier && x.Subcon_ID == dataItem.Subcon_ID).FirstOrDefault();
            }
            var    dateNow = DateTime.Now.ToString("yyyy/MM/dd");
            var    timeNow = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            string subject = dataMail.Subject + "-" + dateNow;

            if (dataItem.Is_Release == "Y")
            {
                subject = "Released " + subject;
            }
            var    t3SupplierName = dataItem.T3_Supplier == "" ? "ZZZZ" : dataItem.T3_Supplier + "-" + dataItem.T3_Supplier_Name;
            string content        = "通知時間:" + timeNow + "\n"
                                    + "Notification time: " + timeNow + "\n"
                                    + "T3 廠商:" + t3SupplierName + "\n"
                                    + "T3 Supplier: " + t3SupplierName + "\n"
                                    + dataMail.Content;
            List <string> listMail = dataMail.Email.Split(";").ToList();
            await _iMailUtility.SendListMailAsync(listMail, subject, content, pathFileExcel);
        }
Ejemplo n.º 2
0
        public async Task <bool> CreatSettingSupplier(Setting_Mail_Supplier_Dto model)
        {
            var item = await _iSettingMailSupplierReopo.FindAll(x => x.Factory == model.Factory && x.Supplier_No == model.Supplier_No && x.Subcon_ID == model.Subcon_ID).FirstOrDefaultAsync();

            if (item == null)
            {
                model.Updated_Time = timeNow;
                _iSettingMailSupplierReopo.Add(_mapper.Map <WMSB_Setting_Supplier>(model));
                try
                {
                    return(await _iSettingMailSupplierReopo.SaveAll());
                }
                catch (System.Exception)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }