private void buttonLogin_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); int userKey = 0; if (!string.IsNullOrEmpty(textBoxUserId.Text) && !string.IsNullOrEmpty(textBoxPassword.Text)) { if (AM.checkUserLogin(textBoxUserId.Text, textBoxPassword.Text, out userKey)) { UtilityClass.UtilityOperations.updateRegistryValue(textBoxUserId.Text, textBoxPassword.Text, userKey, true); this.Close(); UtilityOperations.showMessage("User is set. Please restart the application"); } else { UtilityClass.UtilityOperations.updateRegistryValue(" ", " ", 0, false); UtilityOperations.showMessage("User not found. Please signup"); } } else { UtilityOperations.showMessage("Please enter userid and password"); } //UtilityClass.UtilityOperations.updateRegistryValue("", "", true); Cursor.Current = Cursors.Default; }
private void buttonSearch_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); resultList = new List <PropertyClass>(); int userKey = 0; if (!string.IsNullOrEmpty(textBoxSearch.Text)) { int cDbKey = 0; if (string.IsNullOrEmpty(comboBoxCatagory.Text)) { UtilityOperations.showMessage("Please select some category"); } else { if (newCategoryList.ContainsKey(comboBoxCatagory.Text)) { cDbKey = Convert.ToInt32(newCategoryList[comboBoxCatagory.Text]); } if (checkBoxAllorMine.Checked) { userKey = UtilityOperations.getUserKey(); } else { userKey = 0; } resultList = AM.getResultList(textBoxSearch.Text, cDbKey, userKey); } } else { UtilityOperations.showMessage("Please enter the search text"); } loadDataGrid(); foreach (PropertyClass pClass in resultList) { dataGridViewResult.Rows.Add(pClass.Id, pClass.Title, pClass.ArticleType, pClass.URL); } Cursor.Current = Cursors.Default; }
private void buttonShare_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { AM = new AllMethodsClass(); if (!string.IsNullOrEmpty(textBoxCode.Text)) { string resultId = AM.addSharedCode(userInfo, textBoxCode.Text, "0"); //textBoxLink.Text = EncryptDecrypt.EncryptDecrypt.Encrypt(resultId, true); textBoxLink.Text = Encrypt(resultId); } else { UtilityOperations.showMessage("Please write some code."); } } catch { } Cursor.Current = Cursors.Default; }
private void buttonGet_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { AM = new AllMethodsClass(); if (!string.IsNullOrEmpty(textBoxLink.Text)) { string keyVal = textBoxLink.Text; //string key = EncryptDecrypt.EncryptDecrypt.Decrypt(keyVal, true); string key = Decrypt(keyVal); string result = AM.getShareKey(Convert.ToString(Convert.ToInt32(key))); textBoxCode.Text = result; } else { UtilityOperations.showMessage("Please verify the key."); } } catch { } Cursor.Current = Cursors.Default; }
private void buttonAddArticle_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); if (!string.IsNullOrEmpty(textBoxTitleAdd.Text) && !string.IsNullOrEmpty(textBoxCodeAdd.Text)) { int cDbKey = 0; if (string.IsNullOrEmpty(comboBoxCategoryAdd.Text)) { UtilityOperations.showMessage("Please select some category"); } else { if (newCategoryList.ContainsKey(comboBoxCategoryAdd.Text)) { cDbKey = Convert.ToInt32(newCategoryList[comboBoxCategoryAdd.Text]); } bool status = AM.addArticle("<pre><xmp>" + textBoxCodeAdd.Text + "</xmp></pre>", textBoxTitleAdd.Text, cDbKey); if (status) { UtilityOperations.showMessage("Article added successfully"); clearAddFields(); } else { UtilityOperations.showMessage("Error adding article"); } } } else { UtilityOperations.showMessage("Please enter the required fields"); } Cursor.Current = Cursors.Default; }