protected void btn_add_Click(object sender, System.EventArgs e) { if (Page.IsValid) { //// Add new administrator DictionaryBLL.Add(txt_value.Text, int.Parse(drp_type.SelectedValue)); ShowMessage("new value added"); txt_value.Text = ""; BindList(); } }
/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> private bool Insert(HrDictionary model) { UserInfo currentUser = new UserInfoService().GetCurrentUser(); string userName = currentUser == null ? "" : currentUser.LoginName; model.CreateDate = DateTime.Now; model.CreateUser = userName; model.SystemNeed = "0"; if (string.IsNullOrEmpty(bll.Add(model))) { return(false); } return(true); }
private void BtnAdd_Click(object sender, EventArgs e) { try { MyDictionary myDict = new MyDictionary(); myDict.TurkishWord = txtTurkish.Text; myDict.EnglishWord = txtEnglish.Text; _dictBLL.Add(myDict); //RefreshList(); MessageBox.Show("Sözcük Eklendi"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ActionResult proc() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <JGN_Dictionary>(json); if (DictionaryBLL.CheckValue(_context, data.value, data.type)) { return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_record_exist"].Value })); } if (data.id > 0) { // Update Operation DictionaryBLL.Update(_context, data); } else { // Add Operation data = DictionaryBLL.Add(_context, data); } return(Ok(new { status = "success", record = data, message = SiteConfig.generalLocalizer["_records_processed"].Value })); }
public void ProcessRequest(HttpContext context) { var json = new StreamReader(context.Request.InputStream).ReadToEnd(); var responseMsg = new Dictionary <string, string>(); bool isUpdate = false; int Records = 0; string Keywords = ""; string Text = ""; string Order = ""; int PageNumnber = 0; var _dictionaryobj = new DictionaryBLL(); var _ld_dictionary = JsonConvert.DeserializeObject <Dictionary_Struct>(json); var _ld_dictionary_data = new Dictionary <string, DictionaryObject>(); if ((context.Request.Params["action"] != null)) { switch (context.Request.Params["action"]) { case "add": // Authentication if (!context.User.Identity.IsAuthenticated) { responseMsg["status"] = "error"; responseMsg["message"] = "Authentication Failed"; context.Response.Write(responseMsg); return; } DictionaryBLL.Add(_ld_dictionary.Value, _ld_dictionary.Type); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "delete": DictionaryBLL.Delete(_ld_dictionary.ID); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "load": DictionaryBLL.Load(_ld_dictionary.Type); responseMsg["status"] = "success"; context.Response.Write(responseMsg); break; case "return_value": DictionaryBLL.Return_Values(_ld_dictionary.Type); responseMsg["status"] = "success"; context.Response.Write(responseMsg); break; case "process_screening": if (context.Request.Params["text"] != null) { Text = context.Request.Params["text"].ToString(); } DictionaryBLL.Process_Screening(Text); responseMsg["status"] = "success"; context.Response.Write(responseMsg); break; case "is_match": if (context.Request.Params["text"] != null) { Text = context.Request.Params["text"].ToString(); } if (context.Request.Params["keywords"] != null) { Keywords = context.Request.Params["keywords"].ToString(); } DictionaryBLL.isMatch(Text, Keywords); responseMsg["status"] = "success"; context.Response.Write(responseMsg); break; case "validate_search_word": if (context.Request.Params["text"] != null) { Text = context.Request.Params["text"].ToString(); } DictionaryBLL.Validate_Search_Word(Text); responseMsg["status"] = "success"; context.Response.Write(responseMsg); break; } } else { // No action found responseMsg["status"] = "error"; responseMsg["message"] = "No action found"; context.Response.Write(JsonConvert.SerializeObject(responseMsg)); } }