public bool Forward(string caller, string destination) { TapiAddress ad = GetAddress(caller); bool success = false; if (ad != null) { if (destination != "") { log.Debug("Unconditional forward from " + ad.ToString() + " to " + destination); ForwardInfo[] fis = new ForwardInfo[1]; fis[0] = new ForwardInfo(ForwardingMode.Unconditional, "", 0, destination); log.Debug("Forwarding " + ad.ToString() + ": " + fis[0].ToString()); try { MakeCallParams mcp = new MakeCallParams(); mcp.NoAnswerTimeout = 0; if (ad.Forward(fis, 3, mcp) != null) { success = true; } } catch (Exception e) { log.Error("Unable to forward " + ad.ToString() + " " + e.Message); } } else { ad.CancelForward(); success = true; } } return(success); }
/// <summary> /// 预约书 /// </summary> /// <param name="userId"></param> /// <param name="bookId"></param> /// <returns></returns> public int ResvervationBook(int userId, int bookId) { BookInfo book = bookServer.GetBookModel(bookId); if (book.B_StatuId == 3) return -1; //已被预约 book.B_StatuId = 3; ForwardInfo model = new ForwardInfo() { UserId = userId, BookId = bookId, F_StartTime = DateTime.Now, F_EndTime = DateTime.Now.AddHours(1), Fo_TypeId = 1 }; int result = reservationServer.Insert(model); if (result == 1) { bookServer.Update(book); Notice notice = new Notice() { NoticeTime = DateTime.Now, N_TypeId = 3, NoticeTitle = "预约成功提醒", NoticeContent = "恭喜您成功预约《" + book.BookName + "》这本书!请在一小时之内取走,否则需要您重新预约", UserId = userId, LibId = 1001 }; noticeServer.Insert(notice); return 1; } else { return 0; } }
public bool Forward(string caller, string destination) { TapiAddress ad = GetAddress(caller); bool success = false; if (ad != null) { if (destination != "") { log.Debug("Unconditional forward from " + ad.ToString() + " to " + destination); ForwardInfo[] fis = new ForwardInfo[1]; fis[0] = new ForwardInfo(ForwardingMode.Unconditional, "", 0, destination); log.Debug("Forwarding " + ad.ToString() + ": " + fis[0].ToString()); try { MakeCallParams mcp = new MakeCallParams(); mcp.NoAnswerTimeout = 0; if (ad.Forward(fis, 3, mcp) != null) { success = true; } } catch (Exception e) { log.Error("Unable to forward " + ad.ToString() + " " + e.Message); } } else { ad.CancelForward(); success = true; } } return success; }
private void btnAdd_Click(object sender, EventArgs e) { ForwardInfo fi = new ForwardInfo((ForwardingMode)cbForwardEntryTypes.SelectedItem, textCaller.Text, 0, textDestination.Text); lbEntries.Items.Add(fi); }
public int UpdateResvervation(ForwardInfo forwardInfo) { return reservationServer.Update(forwardInfo); }