Example #1
0
        private void cmbxPositionRC_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbxPositionRC.SelectedIndex > 0)
            {
                DSL      obj   = new DSL();
                string[] qList = obj.get_quiz_List(Convert.ToInt32(cmbxPositionRC.SelectedValue)).Split('#');

                int i = 1;//quiz_id_starting no
                foreach (Control control in pnl_QuizList.Controls)
                {
                    CheckBox quizNo = (CheckBox)pnl_QuizList.Controls.Find(i.ToString(), true).FirstOrDefault();
                    quizNo.Checked = false;
                    i++;
                }
                foreach (string quiz in qList)
                {
                    CheckBox quizNo = (CheckBox)pnl_QuizList.Controls[quiz];
                    quizNo.Checked = true;
                }
                switch (Convert.ToString(cmbxPositionRC.SelectedValue))
                {
                case "1":
                    selected_candidate_row["Category"] = "Standard";
                    break;

                case "2":
                    selected_candidate_row["Category"] = "Subcontactor";
                    break;

                case "3":
                    selected_candidate_row["Category"] = "Superitendent";
                    break;
                }
            }
        }
        private async Task checkInternet()
        {
            try
            {
                DSL obj = new DSL();
                await Task.Delay(1000);

                // return "complete";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        private async void upload_results_Load(object sender, EventArgs e)
        {
            panel1.Visible            = false;
            label5.Visible            = false;
            progressBarUpload.Visible = false;
            try
            {
                wait_form = new Loader();
                // wait_form.MdiParent = this;
                //wait_form.StartPosition = FormStartPosition.Manual;
                //wait_form.Top = (Login_formYPos + Login_formHeight) / 2;
                //wait_form.Left = (Login_formXPos + Login_formWidth) / 2;
                wait_form.Show();
                Application.DoEvents();

                DSL obj = new DSL();
                jobList = await obj.getAllJobs();

                if (jobList == null)
                {
                    DSL_offline obj_ = new DSL_offline();
                    jobList = obj_.get_jobList();
                }
                DataRow row = jobList.NewRow();
                row["Name"] = "--Select--";
                jobList.Rows.InsertAt(row, 0);
                cmbxJobList.DataSource    = jobList;
                cmbxJobList.DisplayMember = jobList.Columns["Name"].ToString();
                cmbxJobList.ValueMember   = jobList.Columns["Name"].ToString();
            }
            catch (Exception ex)
            {
                // MessageBox.Show(ex.Message);
                //throw;
                if (ex.Message.Contains("A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible"))
                {
                    MessageBox.Show("This feature requires stable internet connection, Kindly check internet connection and try again!");
                    this.Close();
                    wait_form.Close();
                }
                else
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Example #4
0
        private void SplashForm_Shown(object sender, EventArgs ex)
        {
            bw.RunWorkerAsync();


            bw.DoWork += (sender1, e) =>
            {
                toolStripStatusLabel1.Text = "Connecting to Database";



                DataTable dt_allQuestions = new DataTable();
                dt_allQuestions.TableName = "qBank_V2";
                DataTable dt_allCategory = new DataTable();
                dt_allCategory.TableName = "Category";

                DataTable dt_allQuiz = new DataTable();
                dt_allQuiz.TableName = "QuizList$";
                DataTable dt_VideoLinks = new DataTable();
                dt_VideoLinks.TableName = "Quiz_Video";
                DataTable dt_QuizCategory_relation = new DataTable();
                dt_QuizCategory_relation.TableName = "Quiz_Category_Relation";

                string local_data_path = Create_Directory();
                qBank = new DataTable();
                string filename_Qbank          = local_data_path + "\\" + "qBank_V2.xml";
                string filename_Category       = local_data_path + "\\" + "Category.xml";
                string filename_QuizList       = local_data_path + "\\" + "QuizList$.xml";
                string filename_Vid_Links      = local_data_path + "\\" + "Quiz_Video.xml";
                string filename_quiz_cat_reltn = local_data_path + "\\" + "Quiz_Category_Relation.xml";
                try
                {
                    DSL obj = new DSL();
                    e.Result                 = obj;
                    dt_allQuestions          = obj.getallQuestions_offline();
                    dt_allCategory           = obj.getCategories_offline();
                    dt_allQuiz               = obj.get_all_quizes_offline();
                    dt_VideoLinks            = obj.get_QuizLinks_offline();
                    dt_QuizCategory_relation = obj.get_QuizCategory_offline();
                    SerializeDataSet(dt_allQuestions, "qBank_V2.xml");
                    SerializeDataSet(dt_allCategory, "Category.xml");
                    SerializeDataSet(dt_allQuiz, "QuizList$.xml");
                    SerializeDataSet(dt_VideoLinks, "Quiz_Video.xml");
                    SerializeDataSet(dt_QuizCategory_relation, "Quiz_Category_Relation.xml");
                    dataBank.Tables.Add(dt_allQuestions);
                    dataBank.Tables.Add(dt_allCategory);
                    dataBank.Tables.Add(dt_allQuiz);
                    dataBank.Tables.Add(dt_VideoLinks);
                    dataBank.Tables.Add(dt_QuizCategory_relation);
                }
                catch (Exception exception)
                {
                    if (!checkLocalDataStore_DB())
                    {
                        MessageBox.Show("Could not load Local Data.");
                    }
                    else
                    {
                        dt_allQuestions.ReadXml(filename_Qbank);
                        dt_allCategory.ReadXml(filename_Category);
                        dt_allQuiz.ReadXml(filename_QuizList);
                        dt_VideoLinks.ReadXml(filename_Vid_Links);
                        dt_QuizCategory_relation.ReadXml(filename_quiz_cat_reltn);
                        dataBank.Tables.Add(dt_allQuestions);
                        dataBank.Tables.Add(dt_allCategory);
                        dataBank.Tables.Add(dt_allQuiz);
                        dataBank.Tables.Add(dt_VideoLinks);
                        dataBank.Tables.Add(dt_QuizCategory_relation);
                    }
                }



                //Boolean localdataLoaded = false;

                //    if (readXmls(dt_allQuestions, filename_Qbank) && readXmls(dt_allQuiz, filename_QuizList) && readXmls(dt_allCategory, filename_Category) && readXmls(dt_VideoLinks, filename_Vid_Links))
                //        localdataLoaded = true;
                //    else
                //        localdataLoaded = false;


                //if (localdataLoaded)
                //{
                //    toolStripStatusLabel1.Text = "Connecting to Local Database";

                //}
                //else
                //{

                //    DSL obj = new DSL();

                //    e.Result = obj;
                //    dt_allQuestions = obj.getallQuestions_offline();
                //    dt_allCategory = obj.getCategories_offline();
                //    dt_allQuiz = obj.get_all_quizes_offline();
                //    dt_VideoLinks = obj.get_QuizLinks_offline();
                //    SerializeDataSet(dt_allQuestions, "qBank_V2.xml");
                //    SerializeDataSet(dt_allCategory, "Category.xml");
                //    SerializeDataSet(dt_allQuiz, "QuizList$.xml");
                //    SerializeDataSet(dt_VideoLinks, "Quiz_Video.xml");

                //}
            };
            bw_sharepoint.DoWork += Bw_sharepoint_DoWork;

            bw.RunWorkerCompleted += Bw_RunWorkerCompleted;

            bw_sharepoint.RunWorkerCompleted += Bw_sharepoint_RunWorkerCompleted;

            bw_sharepoint_safety_site.DoWork             += Bw_sharepoint_safety_site_DoWork;
            bw_sharepoint_safety_site.RunWorkerCompleted += Bw_sharepoint_safety_site_RunWorkerCompleted;

            bw_sharepoint_safety_site_lib.DoWork             += Bw_sharepoint_safety_site_lib_DoWork;
            bw_sharepoint_safety_site_lib.RunWorkerCompleted += Bw_sharepoint_safety_site_lib_RunWorkerCompleted;

            bw_sharepoint_safety_site_list.DoWork             += Bw_sharepoint_safety_site_list_DoWork;
            bw_sharepoint_safety_site_list.RunWorkerCompleted += Bw_sharepoint_safety_site_list_RunWorkerCompleted;
        }
Example #5
0
        private void cmbxCandidateList_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbxCandidateList.SelectedIndex > 0)
            {
                this.llViewHistory.Links.RemoveAt(0);
                cmbxPositionRC.SelectedIndex = 0;
                pnl_QuizList.Controls.Clear();
                pnl_configureTest.Visible = true;
                txtBox_remaining_tst.Text = "";
                lblTestCountPlcHldr.Text  = "";
                lblFirstName.Visible      = true;
                lblLastName.Visible       = true;
                lblfName.Visible          = true;
                lbllName.Visible          = true;
                lblDOB.Visible            = true;
                dtmDOB.Visible            = true;

                dtmDOB.Text                    = "";
                lblSelectJob.Visible           = true;
                cmxJobList.Visible             = true;
                lblTestDetails.Visible         = true;
                panel_test_Status.Visible      = true;
                lblHireStatusPlcHolder.Visible = true;
                lblHireStatus.Visible          = true;
                DataRowView rowView = (DataRowView)cmbxCandidateList.SelectedItem;
                selected_candidate_row = rowView.Row;
                lblfName.Text          = Convert.ToString(selected_candidate_row["First_name"]);
                lbllName.Text          = Convert.ToString(selected_candidate_row["Last_name"]);
                string job = Convert.ToString(selected_candidate_row["Job"]);
                lblLastDateTime.Text        = Convert.ToString(selected_candidate_row["Date"]);
                lblHireStatusPlcHolder.Text = Convert.ToString(selected_candidate_row["Hire_Status"]);
                dtmDOB.Format = DateTimePickerFormat.Short;
                if (Convert.ToString(selected_candidate_row["DOB"]) == "")
                {
                    dtmDOB.CustomFormat = " ";
                    dtmDOB.Format       = DateTimePickerFormat.Custom;
                }
                else
                {
                    dtmDOB.Text = Convert.ToString(selected_candidate_row["DOB"]);
                }

                foreach (var item in cmxJobList.Items)
                {
                    if (Convert.ToString(item) == job)
                    {
                        cmxJobList.SelectedItem = item;
                        break;
                    }
                }
                lblLastJob.Text = Convert.ToString(selected_candidate_row["Job"]);
                llViewHistory.Links.Add(0, llViewHistory.Text.Length, Convert.ToString(selected_candidate_row["FolderURL"]));
                qrcode.Data        = Convert.ToString(selected_candidate_row["FolderURL"]);
                qrcode.DataMode    = OnBarcode.Barcode.QRCodeDataMode.Auto;
                qrcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
                qrcode.drawBarcode();



                Size s = new Size(75, 75);
                qrcode.Size = s;
                QRCode_Panel.Controls.Add(qrcode);


                lblPositionPlcHlder.Text = Convert.ToString(selected_candidate_row["Category"]);
                string[] remaining_test       = Convert.ToString(selected_candidate_row["Remaining_Test"]).Split(';');
                int      count_remaining_test = 0;
                if (remaining_test.Count() > 0)
                {
                    foreach (string test in remaining_test)
                    {
                        if (test != "")
                        {
                            txtBox_remaining_tst.AppendText(test + "\n");
                            count_remaining_test++;
                        }
                    }
                    lblTestCountPlcHldr.Text = Convert.ToString(count_remaining_test);
                }
                else
                {
                    txtBox_remaining_tst.AppendText("No Remaining Test");
                    lblTestCountPlcHldr.Text = "0";
                }
                string previous_pos = lblPositionPlcHlder.Text;
                if (Convert.ToString(selected_candidate_row["Hire_Status"]) == "Conditional Hire")
                {
                    cmbxPositionRC.Enabled = false;
                    cmxJobList.Enabled     = false;
                }
                else
                {
                    cmbxPositionRC.Enabled = true;
                    cmxJobList.Enabled     = true;
                }
                DSL       obj  = new DSL();
                DataTable Quiz = obj.get_all_quizes();
                CheckBox  box;
                int       i = 1;

                foreach (DataRow Quizrow in Quiz.Rows)
                {
                    box      = new CheckBox();
                    box.Tag  = Convert.ToString(Quizrow["QuizDescription"]);
                    box.Name = Convert.ToString(Quizrow["Quiz"]);

                    box.Text     = "Quiz" + i;
                    box.AutoSize = true;
                    pnl_QuizList.Controls.Add(box);
                    i++;
                    ToolTip toolTip1 = new ToolTip();
                    box.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
                    // Set up the delays for the ToolTip.
                    toolTip1.AutoPopDelay = 5000;
                    toolTip1.InitialDelay = 1000;
                    toolTip1.ReshowDelay  = 500;
                    // Force the ToolTip text to be displayed whether or not the form is active.
                    toolTip1.ShowAlways = true;

                    // Set up the ToolTip text for the Button and Checkbox.
                    toolTip1.SetToolTip(box, Convert.ToString(Quizrow["QuizDescription"]));
                    if (Convert.ToString(selected_candidate_row["Hire_Status"]) == "Conditional Hire")
                    {
                        box.Enabled = false;
                    }
                }
                if (count_remaining_test > 0)
                {
                    Panel qListPanel = (Panel)this.Controls.Find("pnl_QuizList", true).FirstOrDefault();
                    //qListPanel.Controls.Clear();
                    foreach (Control control in qListPanel.Controls)
                    {
                        foreach (string test in remaining_test)
                        {
                            if (test != "")
                            {
                                string temp = test.Split(':')[0];
                                if (temp != "")
                                {
                                    string   checkBoxName = temp.Split(' ')[1];
                                    CheckBox quizNo       = (CheckBox)qListPanel.Controls[checkBoxName];
                                    quizNo.Checked = true;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        public Login()
        {
            InitializeComponent();
            logger = new LogWriter("Login Form Opened");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("es");
            DSL       obj      = new DSL();
            DataTable category = obj.getCategories();
            DataRow   cat_row  = category.NewRow();

            cat_row["CategoryID"]   = -1;
            cat_row["CategoryName"] = "--Select--";
            category.Rows.InsertAt(cat_row, 0);
            cmxCategory.DataSource    = category;
            cmxCategory.DisplayMember = "CategoryName";
            cmxCategory.ValueMember   = "CategoryID";
            DataTable categoryRC     = obj.getCategories();
            DataRow   categoryRC_row = categoryRC.NewRow();

            categoryRC_row["CategoryID"]   = -1;
            categoryRC_row["CategoryName"] = "--Select--";
            categoryRC.Rows.InsertAt(categoryRC_row, 0);
            cmbxPositionRC.DataSource    = categoryRC;
            cmbxPositionRC.DisplayMember = "CategoryName";
            cmbxPositionRC.ValueMember   = "CategoryID";
            worker = new BackgroundWorker();
            worker.WorkerReportsProgress = true;
            worker.DoWork          += Worker_DoWork;
            worker.ProgressChanged += Worker_ProgressChanged;
            // worker.RunWorkerAsync();
            qrcode = new QRCodeWinForm();
            QRCode_Panel.Controls.Add(qrcode);
            Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);

            spJobsite       = Convert.ToString(config.AppSettings.Settings["SharePointJobSite"].Value);
            spCandidateSite = Convert.ToString(config.AppSettings.Settings["SharePointSafetySite"].Value);
            CandidateList   = Convert.ToString(config.AppSettings.Settings["quizListName"].Value);
            O365UserName    = Convert.ToString(config.AppSettings.Settings["O365UserName"].Value);
            string tempString = config.AppSettings.Settings["O365Password"].Value;

            O365Password = new SecureString();
            candidates   = new DataTable();
            candidates.Columns.Add("CandidateID", typeof(string));
            candidates.Columns.Add("First_name", typeof(string));
            candidates.Columns.Add("Last_name", typeof(string));
            candidates.Columns.Add("Job", typeof(string));
            candidates.Columns.Add("Hire_Status", typeof(string));
            candidates.Columns.Add("FolderURL", typeof(string));
            candidates.Columns.Add("Remaining_Test", typeof(string));
            candidates.Columns.Add("DisplayCombobox", typeof(string));
            candidates.Columns.Add("Category", typeof(string));
            candidates.Columns.Add("Date", typeof(string));
            candidates.Columns.Add("DOB", typeof(string));
            foreach (char c in tempString)
            {
                O365Password.AppendChar(c);
            }

            JobListName = Convert.ToString(config.AppSettings.Settings["jobListName"].Value);
            using (Microsoft.SharePoint.Client.ClientContext context = new Microsoft.SharePoint.Client.ClientContext(spJobsite))
            {
                try
                {
                    context.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(O365UserName, O365Password);
                    context.Load(context.Web, w => w.Title);
                    context.ExecuteQuery();
                    Microsoft.SharePoint.Client.List list = context.Web.Lists.GetByTitle(JobListName);
                    context.Load(list);

                    Microsoft.SharePoint.Client.ListItemCollection listitems = list.GetItems(Microsoft.SharePoint.Client.CamlQuery.CreateAllItemsQuery());
                    context.Load(listitems);
                    context.ExecuteQuery();
                    foreach (Microsoft.SharePoint.Client.ListItem item in listitems)
                    {
                        cmxJobList.Items.Add(item["JobNumber"] + " - " + item["Title"]);
                    }
                    cmxJobList.Items.Insert(0, "--Select--");
                    logger.LogWrite("JobComboBox Populated");
                }
                catch (Exception ex)
                {
                    logger.LogWrite("JobComboBox Population Failed");
                    logger.LogWrite(ex.StackTrace);
                }
            }
            using (Microsoft.SharePoint.Client.ClientContext context = new Microsoft.SharePoint.Client.ClientContext(spCandidateSite))
            {
                context.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(O365UserName, O365Password);
                context.Load(context.Web, w => w.Title);
                context.ExecuteQuery();
                Microsoft.SharePoint.Client.List list = context.Web.Lists.GetByTitle(CandidateList);
                context.Load(list);

                Microsoft.SharePoint.Client.ListItemCollection listitems = list.GetItems(Microsoft.SharePoint.Client.CamlQuery.CreateAllItemsQuery());
                context.Load(listitems);
                context.ExecuteQuery();
                DataRow row_select = candidates.NewRow();
                row_select["DisplayCombobox"] = "--Select--";
                row_select["CandidateID"]     = -1;
                candidates.Rows.Add(row_select);
                foreach (Microsoft.SharePoint.Client.ListItem item in listitems)
                {
                    // cmbxCandidateList.Items.Add(item["CandidateID"] + " - " + item["First_name"]+"_"+item["Last_name"]);
                    DataRow row = candidates.NewRow();
                    row["CandidateID"] = item["CandidateID"];
                    row["First_name"]  = item["First_name"];
                    row["Last_name"]   = item["Last_name"];
                    row["Job"]         = item["Job"];
                    row["Hire_Status"] = item["Hire_Status"];
                    Microsoft.SharePoint.Client.FieldUrlValue _url = (Microsoft.SharePoint.Client.FieldUrlValue)item["FolderUrl"];
                    row["FolderUrl"]       = _url.Url;
                    row["Remaining_Test"]  = item["Remaining_Test"];
                    row["DisplayCombobox"] = item["CandidateID"] + " - " + item["First_name"] + "_" + item["Last_name"];
                    row["Category"]        = item["Category"];
                    row["Date"]            = item["Modified"];
                    row["DOB"]             = item["DOB"];
                    candidates.Rows.Add(row);
                }
                cmbxCandidateList.DataSource = candidates;
                //cmbxCandidateList.Items.Add(new { Text = "---Select---", Value = -1 });
                cmbxCandidateList.DisplayMember = "DisplayCombobox";
                cmbxCandidateList.ValueMember   = "CandidateID";
                cmxJobList.SelectedIndex        = 0;
            }
        }