Esempio n. 1
0
        public JsonResult Savepractical(string Flag, string Staffcode, string PlanID, string LicenseName,
                                        int ItemID, int QuestionNo, int HearingJudge, int ActualTime_Seconds, int PracticalJudge, int ActualTimeJudge, string OPID)
        {
            DataTable dt = new DataTable();
            mgrSQLcommand_Practical ObjRun_Practical = new mgrSQLcommand_Practical(_configuration);

            // TimeSpan ts = TimeSpan.FromTicks(486000000000)

            TimeSpan ActualTime = new TimeSpan();

            ActualTime = TimeSpan.FromSeconds(ActualTime_Seconds);

            int Judge;

            if (HearingJudge == 1 && PracticalJudge == 1 && ActualTimeJudge == 1)
            {
                Judge = 1;
            }
            else
            {
                Judge = 0;
            }

            dt = new DataTable();
            dt = ObjRun_Practical.sprPracticalSnapshot(Flag, Staffcode, PlanID, LicenseName, ItemID, QuestionNo, HearingJudge, ActualTime, PracticalJudge, Judge, OPID);

            if (dt.Rows.Count != 0)
            {
                string MS = dt.Rows[0][1].ToString();
                if (MS == "OK")
                {
                    return(Json(new { success = true, responetext = "บันทึกข้อมูลเรียบร้อยแล้ว", Judge = Judge, finish = false }));
                }
                else if (MS == "Finish")
                {
                    return(Json(new { success = true, responetext = " บันทึกข้อมูลเรียบร้อยแล้ว", Judge = Judge, finish = true }));
                }
                else
                {
                    return(Json(new { success = false, responetext = MS }));
                }
            }
            else
            {
                return(Json(new { success = false, responetext = "บันทึกข้อมูลไม่สำเร็จ" }));
            }
        }
Esempio n. 2
0
        public JsonResult MakeDisplayPractical(string OPID, string Staffcode, string PlanID, string ItemID, string LicenseName)
        {
            mgrSQLcommand_Practical ObjRun_Practical = new mgrSQLcommand_Practical(_configuration);
            DataTable dt = new DataTable();


            dt = ObjRun_Practical.sprMakeDisplayPractical(Staffcode, PlanID, ItemID, LicenseName);

            if (dt.Rows.Count != 0)
            {
                return(Json(new { success = true, responetext = dt.Rows[0][0].ToString() }));
                // return Json(new { success = true, responetext ="" });
            }
            else
            {
                return(Json(new { success = false, responetext = "ไม่พบแผนการสอบ" }));
            }
        }
Esempio n. 3
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 = "ไม่พบแผนการสอบ" }));
            }
        }