Exemple #1
0
        public string BuildTrainingAlarmBody(ttrtraing tra, string emno)
        {
            StringBuilder sb = new StringBuilder();

            //sb.Append("<>"

            string registerURL = "ContextInfo.contextPath+\'/trtratt.mvc/";

            sb.Append("Click <a href='http://" + registerURL + "register?trcd=" + tra.trcd + "&emno=" + emno + "'>here</a> to register the training.");
            sb.Append("<BR/>");

            return(sb.ToString());
        }
Exemple #2
0
        public void Register(string trcd, string emno)
        {
            try
            {
                List <ColumnInfo> lstParams = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "trcd", ColumnValue = trcd
                    }
                };

                ttrtraing training = GetSelectedObject <ttrtraing>(lstParams);

                lstParams.Add(new ColumnInfo()
                {
                    ColumnName = "emno", ColumnValue = emno
                });

                ttrtraatt att = GetSelectedObject <ttrtraatt>(lstParams);
                if (att == null)
                {
                    return;
                }

                if (training.endt != null && training.endt < DateTime.Now)
                {
                    throw new UtilException("The training is out-of-date.");
                }

                if (att.isrg == "Y")
                {
                    throw new UtilException("You have registered the training.Don't need register again.");
                }

                using (TransactionScope scope = new TransactionScope())
                {
                    att.isrg = "Y";
                    att.rgtm = DateTime.Now;
                    att.rgur = Function.GetCurrentUser();

                    DoUpdate <ttrtraatt>(att, lstParams);

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        public void UpdateTrainingResult(List <ttrtrarst> list)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    ttrtraing traObj = null;
                    for (int i = 0; i < list.Count; i++)
                    {
                        list[i].lmtm = DateTime.Now;
                        list[i].lmur = Function.GetCurrentUser();

                        if (traObj == null)
                        {
                            List <ColumnInfo> p1 = new List <ColumnInfo>()
                            {
                                new ColumnInfo()
                                {
                                    ColumnName = "trcd", ColumnValue = list[0].trcd
                                }
                            };
                            traObj = GetSelectedObject <ttrtraing>(p1);
                        }

                        List <ColumnInfo> parameters = new List <ColumnInfo>()
                        {
                            new ColumnInfo()
                            {
                                ColumnName = "trcd", ColumnValue = list[i].trcd
                            },
                            new ColumnInfo()
                            {
                                ColumnName = "emno", ColumnValue = list[i].emno
                            }
                        };

                        ttrtrarst oldObj = GetSelectedObject <ttrtrarst>(parameters);

                        if (oldObj != null)
                        {
                            //update
                            DoUpdate <ttrtrarst>(list[i], parameters);
                        }
                        else
                        {
                            //insert
                            DoInsert <ttrtrarst>(list[i]);
                        }

                        //Certificate
                        if (list[i].isce == "Y")
                        {
                            tpstraing psTraining = new tpstraing();
                            psTraining.bnag = traObj.bnag;
                            psTraining.crcd = traObj.crcd;
                            psTraining.ctpw = traObj.ctpw;
                            psTraining.cufe = traObj.cufe;
                            psTraining.cunm = traObj.cunm;
                            psTraining.emno = list[i].emno;
                            psTraining.endt = traObj.endt;
                            psTraining.incm = traObj.incm;
                            psTraining.lmtm = DateTime.Now;
                            psTraining.lmur = Function.GetCurrentUser();
                            psTraining.loca = traObj.loca;
                            psTraining.natu = traObj.natu;
                            psTraining.orga = traObj.orga;
                            psTraining.paby = traObj.paby;
                            psTraining.redt = traObj.redt;
                            psTraining.remk = traObj.remk;
                            psTraining.sqno = 1;
                            psTraining.stdt = traObj.stdt;
                            psTraining.tmpe = traObj.tmpe;
                            psTraining.trcd = traObj.trcd;
                            psTraining.ttcd = traObj.ttcd;
                            psTraining.tttm = traObj.tttm;

                            tpstraing psOldTraining = GetSelectedObject <tpstraing>(parameters);
                            if (psOldTraining != null)
                            {
                                //Update
                                DoUpdate <tpstraing>(psTraining, parameters);
                            }
                            else
                            {
                                //Insert
                                DoInsert <tpstraing>(psTraining);
                            }
                        }

                        if (list[i].issk == "Y")
                        {
                            //tpsskill.
                        }
                        //Skill
                    }

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }