public ActionResult AddQuestion(int idPuzzle, int num = 1) { AddInfo model = new AddInfo() { Categories = _entities.Categories.ToList(), }; var questions = _entities.Complies_Puzzle_Question.Where(x => x.Id_Puzzle == idPuzzle).OrderBy(x => x.Index).Select(x => x.Question).ToList(); if (num > questions.Count()) { if (num - questions.Count() > 1) { num = questions.Count + 1; } model.PuzzleId = idPuzzle; model.Num = num; model.Question = new Question(); model.All = questions.Count() + 1; model.Answer = new Answers(); } else if (num <= questions.Count()) { model.PuzzleId = idPuzzle; model.Num = num; model.Question = questions.Skip(num - 1).FirstOrDefault(); model.All = questions.Count(); model.Answer = _entities.Answers.Where(x => x.Id_Question == model.Question.Id).FirstOrDefault(); model.Tips = _entities.Tips.Where(x => x.Id_Question == model.Question.Id).ToList(); } else { return(HttpNotFound()); } return(View(model)); }
private void AddSong_Click(object sender, EventArgs e) { string playlistName = Microsoft.VisualBasic.Interaction.InputBox("Please type in your new song link", "Add song", ""); string[] array = playlistName.Split('?'); if (playlistName == "") { } else if (array[0] != "https://www.youtube.com/watch" && array[0] != "https://www.youtube.com/playlist") { MessageBox.Show("We only support Youtube.com links"); } else if (array[0] == "https://www.youtube.com/watch") { //fix adding AddInfo addInfo = new AddInfo(); addInfo.addSong(playlistName); MessageBox.Show("Your song has been added"); updateList(); } else if (array[0] == "https://www.youtube.com/playlist") { DialogResult dr = MessageBox.Show("This is a song play list do you want to add it ?", "Add song", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { AddInfo addInfo = new AddInfo(); UserGetSet.input(); addInfo.addSongs(UserGetSet.selectedPlaylis, playlistName, "No"); MessageBox.Show("Your songs have been added"); updateList(); } } }
protected AddInfo ReadAddInfo() { AddInfo info = new AddInfo(); info.Tempo = ReadInt(); if (Version.Minor != "00") { stream.Seek(1, SeekOrigin.Current); } /*info.Key =*/ ReadInt(); /*info.Octave =*/ ReadByte(); for (int i = 0; i < MidiChannelCount; i++) { info.MidiChannels[i] = ReadMidiChannel(); } stream.Seek(42, SeekOrigin.Current); info.MeasuresNumber = ReadInt(); info.TracksNumber = ReadInt(); return(info); }
public int addOrder(Bill bill, List <Combo> listCombo, Account cus, ref string error) { foreach (Combo com in listCombo) { try { Order order = new Order(1, com.Drink.Id, com.Drink.Price, com.Drink.Ghichu); OrderDAO.Instance.insertOrder(order, ref error); order = OrderDAO.Instance.getLastOrder(); BillInfo billInfo = new BillInfo(bill.Id, order.Id, com.Count); BillInfoBUS.Instance.insertBillInfo(billInfo, ref error); CartBUS.Instance.insertCart(new Cart(cus.Id, order.Id, com.Count, order.Ghichu), ref error); foreach (Topping top in com.ListTopping) { AddInfo addInfo = new AddInfo(order.Id, top.Id, 1); AddInfoBUS.Instance.insertAddInfo(addInfo, ref error); } } catch (Exception ex) { error = ex.Message; return(0); } } return(1); }
int IComparable <EpisodeData> .CompareTo(EpisodeData other) { if (other == null) { return(1); } var compare = SortName.CompareTo(other.SortName); if (compare == 0) { compare = SeasonNumber.PadLeft(2, '0').CompareTo(other.SeasonNumber.PadLeft(2, '0')); } if (compare == 0) { compare = EpisodeNumber.CompareTo(other.EpisodeNumber); } if (compare == 0) { compare = AddInfo.CompareTo(other.AddInfo); } return(compare); }
public void SetContextInfo(int iIndex, AddInfo contextInfo) { this.contextInfo = contextInfo; m_iIndex = iIndex; SetNO(iIndex); SetTag("暂无"); SetContext(contextInfo.Context); ShowMode(); }
private void Update_Click(object sender, EventArgs e) { GetInfo getInfo = new GetInfo(); LinksFromPlaylist linksFromPlaylist = new LinksFromPlaylist(); List <string> playlistUrls = getInfo.playlistUrls(); List <int> videoCount = getInfo.getPlaylistData(playlistUrls); List <int> updatedInfoCount = new List <int>(); List <string> infoCount = new List <string>(); foreach (string url in playlistUrls) { infoCount = linksFromPlaylist.getLinks(url); updatedInfoCount.Add(infoCount.Count); } bool noUpdate = false; for (int i = 0; i < updatedInfoCount.Count; i++) { if (videoCount[i] < updatedInfoCount[i]) { List <string> databaseVideoId = getInfo.getVideoIdUpdate(playlistUrls[i]); List <string> updatedVideoList = new List <string>(); List <string> newSongs = linksFromPlaylist.getLinks(playlistUrls[i]); for (int j = 0; j < newSongs.Count; j++) { bool foundVideo = false; for (int z = 0; z < databaseVideoId.Count; z++) { if (newSongs[j] == databaseVideoId[z]) { foundVideo = true; break; } } if (foundVideo == false) { updatedVideoList.Add(newSongs[j]); } } AddInfo addInfo = new AddInfo(); addInfo.addUpdatedSongs(updatedVideoList, playlistUrls[i]); noUpdate = true; } } if (noUpdate == false) { MessageBox.Show("There are no available updates"); } else { updateList(); MessageBox.Show("Playlists have been updated"); } }
public static PaymentAddInfoViewModel ToViewModel(this AddInfo model) { var viewModel = new PaymentAddInfoViewModel(); viewModel.Id = model.Id; viewModel.Required = model.Required; viewModel.Name = model.Name; viewModel.Value = model.Value; return(viewModel); }
public static AddInfo ToModel(this PaymentAddInfoViewModel viewModel) { var model = new AddInfo(); model.Id = viewModel.Id; model.Required = viewModel.Required; model.Name = viewModel.Name; model.Value = viewModel.Value; return(model); }
private void Save_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(usernameText.Text)) { MessageBox.Show("Please type in your username"); } else if (String.IsNullOrEmpty(passwrodText.Text)) { MessageBox.Show("Please type in your password"); } else if (String.IsNullOrEmpty(repeatPasswordText.Text)) { MessageBox.Show("Please type in your repeat password"); } else if (String.IsNullOrEmpty(apiKeyText.Text)) { MessageBox.Show("Please type in your Api key"); } else if (passwrodText.Text != repeatPasswordText.Text) { MessageBox.Show("Your passwords don't mach"); } //GetUsersUsername getUsersUsername = new GetUsersUsername(); GetInfo getInfo = new GetInfo(); List <string> usernames = getInfo.getUserUsername(); bool isRegistered = false; foreach (string data in usernames) { if (data == usernameText.Text) { MessageBox.Show("Change ussername"); isRegistered = true; } } if (isRegistered == false) { TestApiKey testApiKey = new TestApiKey(); string testRezult = testApiKey.testApiKey(apiKeyText.Text); if (testRezult == "Bad") { MessageBox.Show("Your Api key is invalid"); } else { AddInfo addInfo = new AddInfo(); addInfo.addNewUser(usernameText.Text, passwrodText.Text, apiKeyText.Text); MessageBox.Show("Your have registered successfully"); this.Hide(); Login login = new Login(); login.Show(); } } }
public bool insertAddInfo(AddInfo addInfo, ref string error) { //string query = string.Format("EXECUTE sp_addOrder({0},{1},{2})", idthucUong, idtopping, count); //return DataProvider.Instance.ExecuteNonQuery(query, ref error); string query = string.Format("INSERT INTO NGOCHOANG2.CHITIETTHEM (IDORDER,IDTHEM,SOLUONG) VALUES ({0},{1},{2})", addInfo.IdOrder, addInfo.IdThem, addInfo.Count); int result = DataProvider.Instance.ExecuteNonQuery(query, ref error); return(result > 0); }
private string PrepareAddInfoData(AddInfo addInfo) { StringBuilder addInfoData = new StringBuilder(); addInfoData.Append(addInfoHeader) .Append(delimiterL3).Append(addInfo.Id) .Append(delimiterL3).Append(addInfo.Value); //can optimize via return char[] return(addInfoData.ToString()); }
private AddInfo PrepareAddInfo(string[] addInfoParts, string vendorServiceId) { var addInfo = new AddInfo(); addInfo.Name = addInfoParts[3]; addInfo.Id = addInfoParts[1]; addInfo.Required = addInfoParts[2] == "no" ? false : true; addInfo.VendorServiceId = vendorServiceId; addInfo.Value = addInfoParts.Length >= 5?addInfoParts[4]:""; return(addInfo); }
public void AddWord(string strBookName, string strWord, AddInfo addInfo) { BookVO book = null; if (!m_dicBooks.ContainsKey(strBookName)) { book = AddBook(strBookName); } else { book = m_dicBooks[strBookName]; } book.AddWord(strWord, addInfo); }
public List <Topping> loadAddInfoListTopping(AddInfo addInfo) { List <Topping> orderListTopping = new List <Topping>(); string query = string.Format("SELECT * FROM NGOCHOANG2.THEM D where D.ID={0}"); DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { Topping topping = new Topping(item); orderListTopping.Add(topping); } return(orderListTopping); }
public List <AddInfo> loadOrderList() { List <AddInfo> addInfoList = new List <AddInfo>(); string query = "SELECT * FROM NGOCHOANG2.Orders"; DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { AddInfo addInfo = new AddInfo(item); addInfoList.Add(addInfo); } return(addInfoList); }
public static void CleanUp() { if (Globals.Script_Debugging) { Globals.l2net_home.Add_Debug("cleanup tick"); } if (Globals.gamedata.running) { AddInfo.CleanUp_Char(); AddInfo.CleanUp_NPC(); AddInfo.CleanUp_Item(); } }
protected override void OnSingleInitialization() { keyElements = new List <ElementMember <TKey> >(); valueElements = new List <ElementMember <TValue> >(); addInfo = new AddInfo(); addKeyInfo = new EditorMember(typeof(AddInfo).Field("key"), addInfo, unityTarget, id); addValueInfo = new EditorMember(typeof(AddInfo).Field("value"), addInfo, unityTarget, id); perKeyDrawing = attributes.AnyIs <PerKeyAttribute>(); perValueDrawing = attributes.AnyIs <PerValueAttribute>(); ignoreAddArea = attributes.AnyIs <IgnoreAddAreaAttribute>(); Readonly = attributes.AnyIs <ReadonlyAttribute>(); var formatMember = attributes.OfType <FormatMemberAttribute>().FirstOrDefault(); if (formatMember == null || string.IsNullOrEmpty(formatMember.pattern)) { dictionaryName = niceName; dictionaryName += " (" + memberType.GetNiceName() + ")"; } else { dictionaryName = formatMember.Format(niceName, memberType.GetNiceName()); } var pairFormat = attributes.GetAttribute <FormatPairAttribute>(); if (pairFormat != null) { if (!string.IsNullOrEmpty(pairFormat.Method)) { pairFormatMethod = rawTarget.GetType().DelegateForCallMethod(pairFormat.Method, Flags.InstanceAnyVisibility, typeof(TKey), typeof(TValue)); } else if (!string.IsNullOrEmpty(pairFormat.Pattern)) { pairFormatPattern = pairFormat.Pattern; } } if (Readonly) { dictionaryName += " (Readonly)"; } #if DBG Log("Dictionary drawer Initialized (" + dictionaryName + ")"); #endif }
protected AddInfo ReadAddInfo() { AddInfo info = new AddInfo() { Tempo = ReadInt(), Key = (Key)(SByte)ReadInt(), Octave = ReadByte() }; for (int i = 0; i < MidiChannelCount; i++) info.MidiChannels[i] = ReadMidiChannel(); info.MeasuresNumber = ReadInt(); info.TracksNumber = ReadInt(); return info; }
internal static void SetAddInfo(AddInfo info) { if (info == null) { return; } SafeProcedure.ExecuteNonQuery( Database.GetDatabase(D4DDefine.DBInstanceName), "dbo.Add_infos_Set", info.ObjectId, info.ObjectType, info.Info1, info.Info2, info.Info3, info.Info4, info.Info5, info.Info6, info.Info7, info.Info8 ); }
public void CheckQueue() { if (m_isAddProduction) { return; } if (m_addExpQueue.Count <= 0) { return; } m_addInfo = m_addExpQueue.Dequeue(); SimpleSoundManager.Instance.PlaySE_2D(SoundNameSE.ExpUp); m_isAddProduction = true; m_timeCount = 0.0f; }
protected AddInfo ReadAddInfo() { AddInfo info = new AddInfo() { Tempo = ReadInt(), /* Key = ReadKey()*/ /* Octave = ReadInt()*/ }; ReadInt(); for (int i = 0; i < MidiChannelCount; i++) info.MidiChannels[i] = ReadMidiChannel(); info.MeasuresNumber = ReadInt(); info.TracksNumber = ReadInt(); return info; }
public void AddWord(string strBookName, string strWord, string strContext) { BookVO book = null; if (!m_dicBooks.ContainsKey(strBookName)) { book = AddBook(strBookName); } else { book = m_dicBooks[strBookName]; } AddInfo addInfo = new AddInfo(Util.GetUUID(), strContext, "", strWord, Util.GetCurTimeStamp()); book.AddWord(strWord, addInfo); //DB_AddWordIfNotExist(strWord); //DB_AddAddInfo(addInfo.ID, addInfo.Tag, addInfo.RelatedWord, addInfo.Context, addInfo.AddTime); }
protected AddInfo ReadAddInfo() { AddInfo info = new AddInfo() { Tempo = ReadInt(), Key = (Key)(SByte)ReadInt(), Octave = ReadByte() }; for (int i = 0; i < MidiChannelCount; i++) { info.MidiChannels[i] = ReadMidiChannel(); } info.MeasuresNumber = ReadInt(); info.TracksNumber = ReadInt(); return(info); }
private void Add_Click(object sender, EventArgs e) { string[] array = playlistLink.Text.Split('?'); if (String.IsNullOrEmpty(playlistName.Text)) { MessageBox.Show("Please type in your playlist name"); } else if (String.IsNullOrEmpty(playlistLink.Text)) { MessageBox.Show("Please insert your youtube link"); } else if (array[0] != "https://www.youtube.com/watch" && array[0] != "https://www.youtube.com/playlist") { MessageBox.Show("We only support Youtube.com links"); } else if (array[0] == "https://www.youtube.com/watch") { DialogResult dr = MessageBox.Show("It's a single song do you want to add it ?", "Download", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { //SaveNewPlaylist saveNewPlaylist = new SaveNewPlaylist(); AddInfo addInfo = new AddInfo(); addInfo.addNewPlaylist(playlistName.Text, playlistLink.Text, "No"); //test it more } } else if (array[0] == "https://www.youtube.com/playlist") { DialogResult dr = MessageBox.Show("This is a song play list do you want to add it ?", "Download", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { //SaveNewPlaylist saveNewPlaylist = new SaveNewPlaylist(); AddInfo addInfo = new AddInfo(); addInfo.addNewPlaylist(playlistName.Text, playlistLink.Text, "No"); MessageBox.Show("Your playlist has been added successfully"); this.Hide(); YourTube yourTube = new YourTube(); yourTube.Show(); //test it more } } }
public bool themOrder(Order order, List <Topping> listTopping, Account account, int count, ref string error) { try { OrderDAO.Instance.insertOrder(order, ref error); Order lastOrder = OrderDAO.Instance.getLastOrder(); CartDAO.Instance.insertCart(new Cart(account.Id, lastOrder.Id, count, null), ref error); foreach (Topping topping in listTopping) { AddInfo addInfo = new AddInfo(lastOrder.Id, topping.Id, 1); AddInfoDAO.Instance.insertAddInfo(addInfo, ref error); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
protected AddInfo ReadAddInfo() { AddInfo info = new AddInfo() { Tempo = ReadInt(), /* Key = ReadKey()*/ /* Octave = ReadInt()*/ }; ReadInt(); for (int i = 0; i < MidiChannelCount; i++) { info.MidiChannels[i] = ReadMidiChannel(); } info.MeasuresNumber = ReadInt(); info.TracksNumber = ReadInt(); return(info); }
protected AddInfo ReadAddInfo() { AddInfo info = new AddInfo(); info.Tempo = ReadInt(); if (Version.Minor != "00") stream.Seek(1, SeekOrigin.Current); /*info.Key =*/ ReadInt(); /*info.Octave =*/ ReadByte(); for (int i = 0; i < MidiChannelCount; i++) info.MidiChannels[i] = ReadMidiChannel(); stream.Seek(42, SeekOrigin.Current); info.MeasuresNumber = ReadInt(); info.TracksNumber = ReadInt(); return info; }
internal static Dictionary <int, AddInfo> GetAddInfos20(List <int> ids, int objectType) { Dictionary <int, AddInfo> dic = new Dictionary <int, AddInfo>(); if (ids != null && ids.Count > 0) { SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName), "dbo.Add_infos_GetTags20", delegate(IParameterSet parameters) { parameters.AddWithValue("@objecttype", objectType); int maxCount = ids.Count > 20 ? 20 : ids.Count; for (int i = 0; i < maxCount; i++) { parameters.AddWithValue("@tid" + (i + 1).ToString(), ids[i]); } }, delegate(IRecord record) { AddInfo info = new AddInfo(); info.ObjectId = record.GetInt32OrDefault(0, 0); info.ObjectType = record.GetInt32OrDefault(1, 0); info.Info1 = record.GetStringOrEmpty(2); info.Info2 = record.GetStringOrEmpty(3); info.Info3 = record.GetStringOrEmpty(4); info.Info4 = record.GetStringOrEmpty(5); info.Info5 = record.GetStringOrEmpty(6); info.Info6 = record.GetStringOrEmpty(7); info.Info7 = record.GetStringOrEmpty(8); info.Info8 = record.GetStringOrEmpty(9); if (!dic.ContainsKey(info.ObjectId)) { dic.Add(info.ObjectId, info); } } ); } return(dic); }
internal static AddInfo GetAddInfo(int objectId, int objectType) { AddInfo info = new AddInfo(); SafeProcedure.ExecuteAndMapRecords( Database.GetDatabase(D4DDefine.DBInstanceName), "dbo.Add_infos_Get", delegate(IRecord record) { info.ObjectId = record.GetInt32OrDefault(0, 0); info.ObjectType = record.GetInt32OrDefault(1, 0); info.Info1 = record.GetStringOrEmpty(2); info.Info2 = record.GetStringOrEmpty(3); info.Info3 = record.GetStringOrEmpty(4); info.Info4 = record.GetStringOrEmpty(5); info.Info5 = record.GetStringOrEmpty(6); info.Info6 = record.GetStringOrEmpty(7); info.Info7 = record.GetStringOrEmpty(8); info.Info8 = record.GetStringOrEmpty(9); }, objectId, objectType); return(info); }
/// <summary> /// Ответ OE /// </summary> public void MakeAnswer() { StringBuilder sb = new StringBuilder(); StringBuilder sb1 = new StringBuilder(); sb1.AppendFormat("\t<{0} code=\"{1}\">{2}</{0}>", "error", ErrCode, HttpUtility.HtmlEncode(ErrDesc)); if (!string.IsNullOrEmpty(Outtid)) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "transaction", Outtid); } if (Acceptdate != DateTime.MinValue && (State == 6 || State == 10)) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "accept-date", XConvert.AsDate(Acceptdate).Replace('T', ' ')); } if (!string.IsNullOrEmpty(Fio)) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "fio", Fio); } if (!string.IsNullOrEmpty(Opname)) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "opname", Opname); } if (!string.IsNullOrEmpty(Account)) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "account", Account); } if (!string.IsNullOrEmpty(AddInfo)) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "info", AddInfo.Length <= 250 ? HttpUtility.HtmlEncode(AddInfo) : HttpUtility.HtmlEncode(AddInfo.Substring(0, 250))); } if (Recpay != null) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "recpay", XConvert.AsAmount(Recpay.Value)); } if (Balance != null) { sb1.AppendFormat("\r\n\t<{0}>{1}</{0}>", "balance", XConvert.AsAmount(Balance.Value)); } sb.AppendFormat("<{0}>\r\n{1}\r\n</{0}>\r\n", "response", sb1.ToString()); stResponse = sb.ToString(); if (tid > 0) { UpdateState(Tid, state: State, locked: 1); } // Log("Подготовлен ответ:\r\n{0}", stResponse); }
public void AddQuestion(AddInfo addInfo, List <string> tip_answ, List <string> tip, HttpPostedFileBase image) { if (image != null) { addInfo.Question.ImgMimeType = image.ContentType; addInfo.Question.Img = new byte[image.ContentLength]; image.InputStream.Read(addInfo.Question.Img, 0, image.ContentLength); } if (addInfo.Question.Id == 0) { _entities.Question.Add(addInfo.Question); IEnumerable <Complies_Puzzle_Question> compouse = _entities.Complies_Puzzle_Question.Where(x => x.Id_Puzzle == addInfo.PuzzleId).ToList(); int index; if (compouse.Count() > 0) { index = compouse.Max(x => x.Index).Value + 1; } else { index = 0; } _entities.Complies_Puzzle_Question.Add(new Complies_Puzzle_Question { Id_Puzzle = addInfo.PuzzleId, Id_Question = addInfo.Question.Id, Index = index }); Answers ans = new Answers { Id_Question = addInfo.Question.Id }; ans.Answer = addInfo.Answer.Answer; _entities.Answers.Add(ans); for (int i = 0; i < tip_answ.Count; i++) { if (tip_answ[i] != "") { _entities.Tips.Add(new Tips { Id_Question = addInfo.Question.Id, Answers = tip_answ[i], Text = tip[i] }); } } } else { Question que = _entities.Question.Where(x => x.Id == addInfo.Question.Id).FirstOrDefault(); que.Img = addInfo.Question.Img; que.ImgMimeType = addInfo.Question.ImgMimeType; que.Text = addInfo.Question.Text; Answers ans = _entities.Answers.FirstOrDefault(x => x.Id_Question == que.Id); ans.Answer = addInfo.Answer.Answer; foreach (var item in _entities.Tips.Where(x => x.Id_Question == que.Id)) { _entities.Tips.Remove(item); } for (int i = 0; i < tip_answ.Count; i++) { if (tip_answ[i] != "") { _entities.Tips.Add(new Tips { Id_Question = addInfo.Question.Id, Answers = tip_answ[i], Text = tip[i] }); } } } _entities.SaveChanges(); Response.Redirect(Url.Action("AddQuestion", new { idPuzzle = addInfo.PuzzleId, num = addInfo.Num + 1 })); }
public void SetAddInfo(AddInfo info) { AddInfoDao.SetAddInfo(info); }