private void dataGridViewResult_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                AM = new AllMethodsClass();
                string articletype = string.Empty;
                string url         = string.Empty;
                if (dataGridViewResult.Rows.Count > 0)
                {
                    DataGridViewRow selectedRow = dataGridViewResult.SelectedRows[0];
                    string          selId       = selectedRow.Cells[0].Value.ToString();
                    string          code        = AM.getSingleCode(selId);
                    articletype = (selectedRow.Cells[2].Value.ToString() == "SNIPPET") ? "snippets" : "article";
                    url         = selectedRow.Cells[3].Value.ToString();

                    string htmlView = string.Format("<HTML><HEAD><TITLE></TITLE></HEAD><BODY>{0}</BODY></HTML>", code);
                    webBrowserResult.DocumentText = htmlView;
                }
                else
                {
                    string htmlView = string.Format("<HTML><HEAD><TITLE></TITLE></HEAD><BODY><H5>{0}<H5></BODY></HTML>", "No result found");
                    webBrowserResult.DocumentText = htmlView;
                }

                webBrowserGoogleView.Navigate("https://www.google.co.in/?gfe_rd=cr&ei=Vu1NV5C3EPTI8Ae7pLHYDA#q=lazzycoder");
                webBrowserlazzycoderView.Navigate(string.Format("http://www.lazzycoder.com/{0}/{1}", articletype, url));
                webBrowserlazzycoderView.ScriptErrorsSuppressed = true;
            }
            catch
            { }
        }
Пример #2
0
        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;
        }
Пример #4
0
        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 LazzyCoderSearchHome_Load(object sender, EventArgs e)
        {
            Cursor.Current   = Cursors.WaitCursor;
            this.WindowState = FormWindowState.Maximized;

            panelAddNew.Visible        = false;
            splitContainerMain.Visible = true;
            splitContainerMain.Dock    = DockStyle.Fill;
            panelHead.Visible          = true;


            AM = new AllMethodsClass();
            newCategoryList = AM.getCategoryList();
            foreach (KeyValuePair <string, string> category in newCategoryList)
            {
                comboBoxCatagory.Items.Add(category.Key);
                comboBoxCategoryAdd.Items.Add(category.Key);
            }

            loadDataGrid();
            Cursor.Current = Cursors.Default;
        }
Пример #6
0
        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;
        }