public static MobileModel Sale_SMS(int Id, String mobile, int collected, DateTime ExcTime, string detail = null) { s26webDataContext db = new s26webDataContext(); IntroductionModel intro = new IntroductionModel(); var msg = intro.Get_One(Id); var data = db.Volunteers.FirstOrDefault(f => f.Mobile == mobile); ///////////////////// msg.Content = msg.Content.Replace("<--end_time-->", ExcTime.AddHours(8).ToString("yyyy/MM/dd HH:mm")); msg.Content = msg.Content.Replace("<--collected-->", collected.ToString()); ///////////////////// var mm = SMS_Send(msg, mobile); SMS sms = new SMS { sms_id = mm.error_code, content = mm.error_msg, CreateTime = DateTime.UtcNow, mobile = mobile, detail = detail }; db.SMS.InsertOnSubmit(sms); db.SubmitChanges(); db.Connection.Close(); //return the response return mm; }
partial void DeleteSMS(SMS instance);
partial void UpdateSMS(SMS instance);
partial void InsertSMS(SMS instance);
public static MobileModel sendToServer(int Id, String mobile, string pwd = null, int signupId = 0, string OrdersStates = "",int InvoiceId = 0,string detail = null) { s26webDataContext db = new s26webDataContext(); IntroductionModel intro = new IntroductionModel(); var msg = intro.Get_One(Id); var data = db.Volunteers.FirstOrDefault(f => f.Mobile == mobile); ///////////////////// if (OrdersStates != "") if (msg.Content.IndexOf("<--orders_status-->") != -1) msg.Content = msg.Content.Replace("<--orders_status-->", OrdersStates); if (msg.Content.IndexOf("<--user_id-->") != -1) msg.Content = msg.Content.Replace("<--user_id-->", mobile); if (msg.Content.IndexOf("<--user_password-->") != -1) msg.Content = msg.Content.Replace("<--user_password-->", pwd); if (msg.Content.IndexOf("<--user_name-->") != -1) msg.Content = msg.Content.Replace("<--user_name-->", data.Name); if (msg.Content.IndexOf("<--user_mobile-->") != -1) msg.Content = msg.Content.Replace("<--user_mobile-->", data.Mobile); //課程 //if (signupId != 0) //{ // var signups = (from c in db.Course // join s in db.SignUp on c.Id equals s.CourseId // join city in db.City on c.CityId equals city.Id // where s.Id == signupId // select new { course = c, signup = s, city = city }).FirstOrDefault(); // db.SignUp.FirstOrDefault(f => f.Id == signupId); // if (msg.Content.IndexOf("<--course_name-->") != -1) // msg.Content = msg.Content.Replace("<--course_name-->", signups.signup.Name); // if (msg.Content.IndexOf("<--course_title-->") != -1) // msg.Content = msg.Content.Replace("<--course_title-->", signups.course.Title); // if (msg.Content.IndexOf("<--course_count-->") != -1) // msg.Content = msg.Content.Replace("<--course_count-->", signups.signup.SignUpNumbers.ToString()); // if (msg.Content.IndexOf("<--course_address-->") != -1) // msg.Content = msg.Content.Replace("<--course_address-->", signups.city.Name + signups.course.Address); // if (msg.Content.IndexOf("<--course_time-->") != -1) // msg.Content = msg.Content.Replace("<--course_time-->", signups.course.StartTime.AddHours(8).ToString("MM/dd(ddd) HH:mm") + "~" + signups.course.EndTime.AddHours(8).ToString("HH:mm")); //} //發票 //if (InvoiceId != 0) //{ // var inv = db.Invoice.FirstOrDefault(f => f.Id == InvoiceId); // if (inv.FailChoice == 0) // inv.FailReason = "發票無法辨識"; // else if (inv.FailChoice == 1) // inv.FailReason = "發票號碼重複"; // if (msg.Content.IndexOf("<--fail-->") != -1) // msg.Content = msg.Content.Replace("<--fail-->", inv.FailReason); //} var mm = SMS_Send(msg, mobile); if (detail == "SaleAct") { //msg.Content = msg.Content.Replace("",); } SMS sms = new SMS { sms_id = mm.error_code, content = mm.error_msg, CreateTime = DateTime.UtcNow, mobile = mobile, detail = detail }; db.SMS.InsertOnSubmit(sms); db.SubmitChanges(); db.Connection.Close(); //return the response return mm; }