コード例 #1
0
        private List <kiosk_transhead> GetLastTransHead(ChangeQueueModel param, List <PatientTransheadModel> patient, string q9)
        {
            try
            {
                List <kiosk_transhead> tranheadresult;
                using (var context = new KioskChulaiPadEntities())
                {
                    if (param != null && patient != null)
                    {
                        /* select  */
                        DateTime?regisdate = param.regis_date.Date;
                        string   hn_no     = patient[0].hn_no;

                        tranheadresult = (from val in context.kiosk_transhead
                                          where val.hn_no == hn_no && val.queue_no == q9 &&
                                          val.register_date == regisdate && val.queue_status != "C"
                                          select val).ToList();

                        return(tranheadresult);
                    }
                    else
                    {
                        return(new List <kiosk_transhead>());
                    }
                }
            }
            catch
            {
                return(new List <kiosk_transhead>());
            }
        }
コード例 #2
0
        private bool InsertLogQueue(ChangeQueueModel param, List <PatientTransheadModel> patient, List <InsFlowGenQueueComModel> inscom, string q9)
        {
            try
            {
                using (var context = new KioskChulaiPadEntities())
                {
                    if (param != null)
                    {
                        string queue_no_old   = patient[0].queue_no;
                        string flag_queue_old = "N";
                        string q_action_old   = "C";

                        string queue_no_express   = q9;
                        string flag_queue_express = "E";
                        string q_action_express   = "W";

                        string crdby = param.crtd_by;

                        /* insert log queue old*/
                        context.q_expr_ins_kiosk_qExpress_log_ipad(queue_no_old, flag_queue_old, q_action_old, crdby);
                        /* insert log queue express*/
                        context.q_expr_ins_kiosk_qExpress_log_ipad(queue_no_express, flag_queue_express, q_action_express, crdby);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }
コード例 #3
0
        private bool UpdateMapQueue(ChangeQueueModel param, List <PatientTransheadModel> patient, List <kiosk_transhead> tranheadresult, QueueNineModel q9)
        {
            try
            {
                using (var context = new KioskChulaiPadEntities())
                {
                    if (param != null && patient != null && tranheadresult != null)
                    {
                        /* insert */
                        int    slip_seq_express = tranheadresult[0].slip_seq;
                        string queue_no_express = q9.q_no;
                        int    slip_seq_old     = param.slip_seq;
                        string queue_no_old     = patient[0].queue_no;
                        string activeflag       = "Y";
                        string crdby            = param.crtd_by;

                        context.q_expr_ins_kiosk_map_qexpress_ipad(slip_seq_express, queue_no_express, slip_seq_old, queue_no_old, activeflag, crdby);

                        /*update queue_id to service chula*/
                        //bool updateslipseq = UpdateQ_SlipSeq(q9.q_id, slip_seq_express.ToString());

                        return(UpdateQ_SlipSeq(q9.q_id, slip_seq_express.ToString()));
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }
コード例 #4
0
        private bool InsertTranshead(ChangeQueueModel param, List <PatientTransheadModel> patient, List <InsFlowGenQueueComModel> inscom, string q9)
        {
            try
            {
                using (var context = new KioskChulaiPadEntities())
                {
                    if (param != null && patient != null && inscom != null)
                    {
                        /* insert */
                        string   sliptype                = "Q";
                        string   sliptypedetail          = "12";
                        string   sliptypeflag            = "1";
                        DateTime?regisdate               = param.regis_date.Date;
                        TimeSpan?registime               = param.regis_date.TimeOfDay;
                        TimeSpan?outtime                 = DateTime.Now.TimeOfDay;
                        string   buildingcode            = inscom[0].building_code != null ? inscom[0].building_code : "";
                        string   floor                   = inscom[0].floor != null ? inscom[0].floor : "";
                        string   zone                    = inscom[0].zone != null ? inscom[0].zone : "";
                        string   locatcode               = inscom[0].locat_code != null ? inscom[0].locat_code : "";
                        string   locatname               = inscom[0].locat_name != null ? inscom[0].locat_name : "";
                        string   comcode                 = inscom[0].com_code != null ? inscom[0].com_code : "";
                        int?     computercode            = inscom[0].computer_code;
                        string   computername            = inscom[0].com_name != null ? inscom[0].com_name : "";
                        string   kioskgroupcode          = inscom[0].kiosk_group_code != null ? inscom[0].kiosk_group_code : "";
                        string   timetype                = "I";
                        string   idcard                  = patient[0].idcard_no;
                        string   hn_no                   = patient[0].hn_no;
                        string   patientname             = patient[0].pateint_name;
                        DateTime?patientbirth            = patient[0].pateint_dob;
                        string   patientfilelocationtype = patient[0].patient_file_location_type;
                        string   patientfilelocationcode = patient[0].patient_file_location_code;
                        string   patientfilelocationname = patient[0].patient_file_location_name;
                        DateTime?patientfileasof         = patient[0].patient_file_asof;
                        string   patientflag             = patient[0].patient_flag;
                        string   queueno                 = q9;
                        string   queueflag               = patient[0].flag_queue;
                        string   queuestatus             = patient[0].queue_status;
                        string   flagchangeright         = patient[0].flag_change_right;
                        string   flagchooseright         = patient[0].flag_choose_right;
                        string   flagremarkright         = patient[0].flag_remark_right;
                        string   printresult             = patient[0].print_result;
                        string   crdby                   = param.crtd_by;

                        context.q_expr_ins_kiosk_transhead_ipad(sliptype, sliptypedetail, sliptypeflag, regisdate, registime, outtime, buildingcode, floor, zone,
                                                                locatcode, locatname, comcode, computercode, computername, kioskgroupcode, timetype, idcard, hn_no, patientname, patientbirth, patientfilelocationtype,
                                                                patientfilelocationcode, patientfilelocationname, patientfileasof, queueno, queueflag, queuestatus, patientflag,
                                                                flagchangeright, flagchooseright, flagremarkright, printresult, crdby);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }
コード例 #5
0
        /* http://www.mukeshkumar.net/articles/web-api/token-based-authentication-in-web-api reference*/
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var identity = new ClaimsIdentity(context.Options.AuthenticationType);

            context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
            using (KioskChulaiPadEntities db = new KioskChulaiPadEntities())
            {
                if (db != null)
                {
                    var userlist = db.kiosk_user.ToList();
                    if (userlist != null)
                    {
                        string encryppassword = Helper.Utility.Encrypt(context.Password, true); /*encrypt password*/
                        if (!string.IsNullOrEmpty(userlist.Where(x => x.username == context.UserName && x.password == encryppassword).FirstOrDefault().name))
                        {
                            string displayname     = userlist.Where(x => x.username == context.UserName && x.password == encryppassword).FirstOrDefault().name;
                            int    user_group_code = userlist.Where(x => x.username == context.UserName && x.password == encryppassword).FirstOrDefault().user_group_code;
                            identity.AddClaim(new Claim("Developer", "Naristhararuk"));
                            var props = new AuthenticationProperties(new Dictionary <string, string>
                            {
                                { "userdisplayname", context.UserName },
                                { "role", user_group_code.ToString() }
                            });
                            var ticket = new AuthenticationTicket(identity, props);
                            context.Validated(ticket);
                        }
                        else
                        {
                            context.SetError("invalid_grant", "UserName or Password is incorrect");
                            context.Rejected();
                        }
                    }
                }
                else
                {
                    context.SetError("invalid_grant", "Problem with Database User");
                    context.Rejected();
                }
                return;
            }
        }
コード例 #6
0
 private string UpdateQueueStatus(ChangeQueueModel param)
 {
     try
     {
         using (var context = new KioskChulaiPadEntities())
         {
             if (param != null)
             {
                 /* update old queue to "C" = Cancel */
                 context.q_expr_upd_kiosk_transhead_queue_status_ipad(param.slip_seq, "C", param.crtd_by);
                 return("true");
             }
             else
             {
                 return("param null");
             }
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
コード例 #7
0
 public InsertQExpressController()
 {
     db = new KioskChulaiPadEntities();
 }
コード例 #8
0
 public InsertTransheadController()
 {
     db = new KioskChulaiPadEntities();
 }
コード例 #9
0
 public SelectKioskComController()
 {
     db = new KioskChulaiPadEntities();
 }
コード例 #10
0
 public UpdateTransheadQStatusController()
 {
     db = new KioskChulaiPadEntities();
 }
コード例 #11
0
 public QueueController()
 {
     db = new KioskChulaiPadEntities();
 }