Exemple #1
0
        public IActionResult ParcticalDispaly(string OPID, string Staffcode, string ItemID, string PlanID, string LicenseName)
        {
            var dt     = new DataTable();
            var SqlCMD = new SqlCommand();

            try
            {
                mgrSQL_ObjCommand ObjRun = new mgrSQL_ObjCommand(_configuration);
                //------------ check permit ----------
                string Strsql = "select *   FROM [SPTOSystem].[dbo].[vewPlan_Trainee] where [Staffcode] = '" + Staffcode + "' and [Trianer] = '" + OPID + "' and  [Plan_ID] = '" + PlanID + "' and License_Name = '" + LicenseName + "' ";
                SqlCMD             = new SqlCommand();
                SqlCMD.CommandType = CommandType.Text;
                SqlCMD.CommandText = Strsql;
                dt = ObjRun.GetDataTable(SqlCMD);
            }
            catch (Exception)
            {
                return(RedirectToAction(nameof(PracticalExamController.Index), "PracticalExam"));

                throw;
            }


            if (dt.Rows.Count > 0)
            {
                return(View());
            }
            else
            {
                return(RedirectToAction(nameof(PracticalExamController.Index), "PracticalExam"));
            }
        }
Exemple #2
0
        public JsonResult GetViewPlan(string OPID)
        {
            mgrSQL_ObjCommand ObjRun = new mgrSQL_ObjCommand(_configuration);
            DataTable         dt     = new DataTable();


            List <vewPlan_Trainee> Detail = new List <vewPlan_Trainee>();

            SqlCommand SqlCMD = new SqlCommand();
            string     Strdql = "SELECT *  FROM [SPTOSystem].[dbo].[vewPlan_Trainee]  where [Trianer] = '" + OPID + "'order by   [Plan_ID],	   [Staffcode]       asc";


            SqlCMD.CommandType = CommandType.Text;
            SqlCMD.CommandText = Strdql;
            dt = new DataTable();
            dt = ObjRun.GetDataTable(SqlCMD);



            if (dt.Rows.Count != 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    Detail.Add(new vewPlan_Trainee()
                    {
                        Staffcode        = row["Staffcode"].ToString(),
                        Plan_ID          = row["Plan_ID"].ToString(),
                        Training_Section = row["Training_Section"].ToString(),
                        License_Name     = row["License_Name"].ToString(),
                        Trianer          = row["Trianer"].ToString(),
                        ControlBy        = row["ControlBy"].ToString(),
                        Start_Training   = row["Start_Training"].ToString().Substring(0, 10),
                        End_Training     = row["End_Training"].ToString().Substring(0, 10),
                        License_Type     = row["License_Type"].ToString(),
                        Plan_Type_Name   = row["Plan_Type_Name"].ToString(),
                        Test_Pass        = row["Test_Pass"].ToString(),
                    });
                }
                return(Json(new { success = true, Detail = Detail }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Exemple #3
0
        public JsonResult IndexDashBoard(string OPID)
        {
            mgrSQL_ObjCommand ObjRun = new mgrSQL_ObjCommand(_configuration);
            DataTable         dt     = new DataTable();


            List <vewPracticalSnapshotRemainList> Detail = new List <vewPracticalSnapshotRemainList>();


            SqlCommand SqlCMD = new SqlCommand();
            string     Strdql = "SELECT*   FROM[SPTOSystem].[dbo].[vewPracticalSnapshotRemainList] where[Trianer] = '" + OPID + "'";


            SqlCMD.CommandType = CommandType.Text;
            SqlCMD.CommandText = Strdql;
            dt = new DataTable();
            dt = ObjRun.GetDataTable(SqlCMD);



            if (dt.Rows.Count != 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    Detail.Add(new vewPracticalSnapshotRemainList()
                    {
                        Staffcode   = row["Staffcode"].ToString(),
                        PlanID      = row["PlanID"].ToString(),
                        LicenseName = row["LicenseName"].ToString(),
                        LicenseType = row["LicenseType"].ToString(),
                        RemainCnt   = Convert.ToInt32(row["RemainCnt"].ToString()),
                        Trianer     = row["Trianer"].ToString(),
                    });
                }

                return(Json(new { success = true, Detail = Detail }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Exemple #4
0
        public IActionResult GetPlanID(string OPID, string Staffcode)
        {
            mgrSQL_ObjCommand ObjRun = new mgrSQL_ObjCommand(_configuration);
            DataTable         dt     = new DataTable();
            string            Strsql = "SELECT  [PlanID],[LicenseName]  FROM [dbo].[vewPracticalSnapshotRemainList] where Staffcode = '" + Staffcode + "' and Trianer = '" + OPID + "' group by [PlanID],[LicenseName]  ";

            SqlCommand SqlCMD = new SqlCommand();

            SqlCMD             = new SqlCommand();
            SqlCMD.CommandType = CommandType.Text;
            SqlCMD.CommandText = Strsql;

            dt = ObjRun.GetDataTable(SqlCMD);


            if (dt.Rows.Count != 0)
            {
                return(Json(new { success = true, planID = dt.Rows[0]["PlanID"].ToString(), licenseName = dt.Rows[0]["LicenseName"].ToString() }));
            }

            return(Json(new { success = false }));
        }
Exemple #5
0
        public JsonResult LoginPratical_Staffcode(string OPID, string Staffcode)
        {
            mgrSQL_ObjCommand       ObjRun           = new mgrSQL_ObjCommand(_configuration);
            mgrSQLcommand_Practical ObjRun_Practical = new mgrSQLcommand_Practical(_configuration);


            //     List<SelectListItem> listItems = new List<SelectListItem>();
            DataTable dt  = new DataTable();
            DataTable dt2 = new DataTable();
            DataSet   DS  = new DataSet();

            SqlCommand SqlCMD = new SqlCommand();

            string Plan_ID;

            string License_Name;
            string Strsql = "SELECT *  FROM [dbo].[vewPlan_Trainee] where Staffcode = '" + Staffcode + "' and Trianer = '" + OPID + "'";

            SqlCMD             = new SqlCommand();
            SqlCMD.CommandType = CommandType.Text;
            SqlCMD.CommandText = Strsql;

            dt = ObjRun.GetDataTable(SqlCMD);

            //   DateTime ActualTime = DateTime.Now;


            TimeSpan ActualTime     = new TimeSpan();
            bool     CheckDuplicate = true;

            if (dt.Rows.Count != 0)
            {
                //--------------  Make snapshot -------------------
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Plan_ID      = dt.Rows[i]["Plan_ID"].ToString();
                    License_Name = dt.Rows[i]["License_Name"].ToString();
                    dt2          = new DataTable();
                    dt2          = ObjRun_Practical.sprPracticalSnapshot("ADD", Staffcode, Plan_ID, License_Name, 0, 0, 0, ActualTime, 0, 0, OPID);

                    if (Convert.ToBoolean(dt2.Rows[0][0]) != true)
                    {
                        CheckDuplicate = false;
                    }
                }


                if (CheckDuplicate == true)
                {
                    return(Json(new { success = true, responetext = Staffcode }));
                }
                else
                {
                    return(Json(new { success = false, responetext = "รหัสพนักงานนี้ ถูกทดสอบไปแล้ว  หรือ ถูกสร้างแผนข้อสอบไปแล้ว กรุณเช็คข้อมูลที่ตารางด้านล่าง   " }));
                }
            }
            else
            {
                return(Json(new { success = false, responetext = "ไม่พบแผนการสอบ" }));
            }
        }