protected bool SavedAppraisalValues()
        {
            bool result = false;

            try
            {
                int       qid           = SubmitAppraisalGrid.PageIndex + 1;
                ArrayList saveAppraisal = new ArrayList();
                string    uid           = Session["UserID"].ToString();
                DateTime  systemend     = (DateTime)Session["EndTime"];
                DateTime  todaydate     = DateTime.Today;

                for (int i = 0; i < SubmitAppraisalGrid.Rows.Count; i++)
                {
                    GridView gve = (GridView)SubmitAppraisalGrid.Rows[i].FindControl("StaffAppraisalGrid"); // for grid
                    if (gve != null)
                    {
                        for (int j = 0; j < gve.Rows.Count; j++)
                        {
                            RadioButtonList bblist = (RadioButtonList)gve.Rows[j].Cells[2].FindControl("RadioList");
                            TextBox         tbx    = (TextBox)gve.Rows[j].Cells[3].FindControl("RemarksTbx");

                            ArrayList staffList = (ArrayList)Session["AllStaff"];
                            string    staff     = staffList[j].ToString();
                            string    rate      = bblist.SelectedValue;
                            double    rate2;
                            if (rate.Equals("N/A"))
                            {
                                rate2 = 1.1;
                            }
                            else
                            {
                                rate2 = Convert.ToDouble(rate);
                            }
                            string remarks = tbx.Text;

                            staffappraisal stfapp = new staffappraisal(uid, qid, staff, Convert.ToDouble(rate2), remarks, todaydate, systemend);
                            saveAppraisal.Add(stfapp);
                        }
                    }
                    int count = 0;
                }

                //check if there is exist and save in database
                bool exist = dbmanager.CheckAppraisalSave(uid, qid, systemend);
                if (exist == true)
                {
                    dbmanager.DeleteAppraisalSaved(uid, qid, systemend);
                }
                dbmanager.InsertSavedData(saveAppraisal);
                result = true;
            }
            catch
            {
                result = false;
            }



            return(result);
        }
        protected bool FindAppraisalValues()
        {
            int       count              = 0;
            int       index              = 0;
            bool      result             = false;
            ArrayList list               = FindValues(this.Page);
            ArrayList listofqn           = (ArrayList)Session["AllQuestion"];
            ArrayList listofstf          = (ArrayList)Session["AllStaff"];
            ArrayList listofallappraisal = new ArrayList();
            ArrayList listofunans        = new ArrayList();
            int       countpage          = 1;

            foreach (Question qn in listofqn)
            {
                if (countpage == SubmitAppraisalGrid.PageIndex + 1)
                {
                    for (int i = 0; i < list.Count;)
                    {
                        string rate = list[i].ToString();
                        int    num  = (i / 2) + 1;

                        if (rate == "0.0")
                        {
                            count++;
                        }
                        if (rate == "N/A")
                        {
                            rate = "1.1";
                        }
                        string remarks = list[i + 1].ToString().Trim();

                        string   staff     = listofstf[index].ToString();
                        string   uid       = Session["UserID"].ToString();
                        DateTime todaydate = DateTime.Today;
                        DateTime systemend = (DateTime)Session["EndTime"];

                        staffappraisal stfapp = new staffappraisal(uid, qn.QuestionID, staff, Convert.ToDouble(rate), remarks, todaydate, systemend);

                        if (Session["AllAppraisal"] != null)
                        {
                            ArrayList listtodelete = new ArrayList();
                            listofallappraisal = (ArrayList)Session["AllAppraisal"];

                            foreach (staffappraisal allstaf in listofallappraisal)
                            {
                                if (stfapp.Questionid == allstaf.Questionid)
                                {
                                    if (stfapp.Appstaffuid == allstaf.Appstaffuid)
                                    {
                                        listtodelete.Add(allstaf);
                                        //remove past data to prevent stack
                                    }
                                }
                            }
                            //delete all past data
                            foreach (staffappraisal deletestf in listtodelete)
                            {
                                listofallappraisal.Remove(deletestf);
                            }
                            listofallappraisal.Add(stfapp);
                        }
                        else
                        {
                            listofallappraisal.Add(stfapp);
                        }
                        i++;
                        i++;
                        index++;
                    }
                }
                countpage++;
            }
            if (count == 0)
            {
                result = true;
                Session["AllAppraisal"] = listofallappraisal;
                ViewState["answers" + SubmitAppraisalGrid.PageIndex + 1] = list;
            }
            return(result);
        }