protected void ShowGv(object sender, EventArgs e)
        {
            DataTable dtVerification = new DataTable();

            ToolCalibrationRepository RepoCalibration = new ToolCalibrationRepository();
            var ParameterProductionLine  = ComboBox_ProductionLine.SelectedItem == null ? "0" : ComboBox_ProductionLine.SelectedItem.Value;
            var ParameterStation         = ComboBox_Station.SelectedItem == null ? "0" : ComboBox_Station.SelectedItem.Value.ToString();
            var ParameterInventoryNumber = ComboBox_InventoryNumber.SelectedItem == null ? "0" : ComboBox_InventoryNumber.SelectedItem.Value.ToString();
            var ParameterToolNumber      = ComboBox_ToolNumber.SelectedItem == null ? "0" : ComboBox_ToolNumber.SelectedItem.Value.ToString();

            dtVerification            = RepoCalibration.RetrieveGridData("usp_Tool_GetPendingVerifications", ParameterToolNumber.ToString(), ParameterProductionLine.ToString(), ParameterStation.ToString(), ParameterInventoryNumber.ToString());
            dtVerification.PrimaryKey = new DataColumn[] { dtVerification.Columns["Id"] };

            //store datasource in session
            Session["dtVerification"] = dtVerification;
            GridviewToolVerification.DataBind();
        }
        protected void SaveCalibration(object sender, EventArgs e)
        {
            var SumRowData = GridviewToolVerification.VisibleRowCount;

            //ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Calibration Success !');", true);
            for (int i = 0; i < SumRowData; i++)
            {
                //GridviewToolVerification.GetCurrentPageRowValues("ToolSetupId")[i];


                var varGetData = GridviewToolVerification.FindDetailRowTemplateControl(i, "LayoutDetails") as ASPxFormLayout;

                if (varGetData != null)
                {
                    var ValueInventory = GridviewToolVerification.GetRowValues(i, "Id");
                    var InvString      = ValueInventory.ToString();
                    var ValueId        = GridviewToolVerification.GetRowValues(i, "ToolId");
                    var ValAttempt     = lbl_Attempt.Text == "0" ? 1 : int.Parse(lbl_Attempt.Text) + 1;
                    var GetVerDate     = varGetData.FindControl("lblVerificationDate") as ASPxLabel;
                    var GetToolSetupId = varGetData.FindControl("lblInventoryNumber") as ASPxLabel;
                    var MinNMGet       = GridviewToolVerification.GetRowValues(i, "MinNM");
                    var MaxNMGet       = GridviewToolVerification.GetRowValues(i, "MaxNM");
                    var ValSetNm       = GridviewToolVerification.GetRowValues(i, "SetNM");
                    for (int u = 0; u < ValAttempt; u++)
                    {
                        var      GetCollaboration1 = varGetData.FindControl("Text_VerValue_" + ValAttempt + "_" + "1") as ASPxTextBox;
                        var      GetCollaboration2 = varGetData.FindControl("Text_VerValue_" + ValAttempt + "_" + "2") as ASPxTextBox;
                        var      GetCollaboration3 = varGetData.FindControl("Text_VerValue_" + ValAttempt + "_" + "3") as ASPxTextBox;
                        var      GetCollaboration4 = varGetData.FindControl("Text_VerValue_" + ValAttempt + "_" + "4") as ASPxTextBox;
                        var      GetCollaboration5 = varGetData.FindControl("Text_VerValue_" + ValAttempt + "_" + "5") as ASPxTextBox;
                        var      GetRemarks        = varGetData.FindControl("RemarksDetail") as ASPxMemo;
                        var      GetCallDate       = DateTime.Now;
                        var      GetDateNext       = varGetData.FindControl("DateDetails") as ASPxTextBox;
                        DateTime today             = DateTime.Now;
                        var      DayPlus           = int.Parse(GetDateNext.Text);
                        DateTime ValueNext         = today.AddDays(DayPlus);
                        // var ValText_VerDate = iList[0].LastVerificationDate.ToString();
                        var  ValCalNumber         = "1";
                        var  ValTollSetupId       = ValueId.ToString();
                        var  ValTollInv           = ValueInventory.ToString();
                        var  ValText_NM           = ValSetNm.ToString();
                        var  ValText_Min          = MinNMGet.ToString();
                        var  ValText_Max          = MaxNMGet.ToString();
                        var  ValText_Calibration1 = GetCollaboration1 == null ? "0" : GetCollaboration1.Text;
                        var  ValText_Calibration2 = GetCollaboration2 == null ? "0" : GetCollaboration2.Text;
                        var  ValText_Calibration3 = GetCollaboration3 == null ? "0" : GetCollaboration3.Text;
                        var  ValText_Calibration4 = GetCollaboration4 == null ? "0" : GetCollaboration4.Text;
                        var  ValText_Calibration5 = GetCollaboration5 == null ? "0" : GetCollaboration5.Text;
                        var  ValMemo_Remarks      = GetRemarks.Text;
                        var  NextVerDate          = ValueNext.ToString();
                        User user      = (User)Session["user"];
                        var  CreatedBy = user.UserName;
                        ToolCalibrationRepository.SaveDataToolCalibration(InvString, ValCalNumber, ValTollSetupId, ValTollInv, ValText_NM, ValText_Min, ValText_Max, ValText_Calibration1, ValText_Calibration2, ValText_Calibration3, ValText_Calibration4, ValText_Calibration5, NextVerDate, ValMemo_Remarks, CreatedBy);
                        //ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Mark As Scrap successfully !');", true);
                    }
                }
            }
            Response.Write(@"
                <script>
                alert('Record successful.');
                setTimeout(function(){            
                window.location = '" + Request.RawUrl + @"';   
                }, 2000);
                </script>");
            //Response.Redirect(Request.RawUrl);
        }