Ejemplo n.º 1
0
        private void stt()
        {
            ss = new SpeechSynthesizer();

            STT.StreamingMicRecognizeAsync(5);
            ResultText(5);
        }
Ejemplo n.º 2
0
        public void Run(string command, MainWindowViewModel dataContext)
        {
            _invoker     = new Invoker();
            _interpreter = new Interpreter(command.ToLower());

            if (dataContext.Text.ToLower().Split(' ').ToList().Count == 2 && dataContext.TabControlName.SelectedItem.ToString() == "TabLearning")
            {
                _interpreter.LearnTwoWordCommand(dataContext.Text);
            }

            _context = new Context(_interpreter.Execute());


            if (_context._action == "let's learn it")
            {
                dataContext.TabControlName.SelectedItem = dataContext.TabControlName.Items[1];
                MessageBox.Show("Что вы имели ввиду?", "Неизвестная команда", MessageBoxButton.OK);
                return;
            }

            STT.getInstance().Voice($"Выполняю {dataContext.Text}");

            _context._object = new ActionStrategy();
            var result = _context.Execute();

            _invoker.SetCommand(result);
            _invoker.Run();

            dataContext.CommandList.Add(dataContext.Text);
            dataContext.Text = "";
        }
Ejemplo n.º 3
0
        public static async System.Threading.Tasks.Task <string> SpeechToTextAsync(System.IO.MemoryStream stream)
        {
            int sampleRate = await Audio.GetSampleRateAsync(Options.options.tempFolderPath + Options.options.audio.speechSynthesisFileName);

            System.Collections.Generic.Dictionary <string, string> apiArgs = new System.Collections.Generic.Dictionary <string, string>()
            {
                { "sampleRate", sampleRate.ToString() }
            };
            foreach (ISpeechToTextService STT in SpeechToTextServices.PreferredOrderingSpeechToTextServices)
            {
                string text;
                ISpeechToTextServiceResponse r = await STT.SpeechToTextAsync(stream.ToArray(), apiArgs);

                if (r.StatusCode == 200)
                {
                    text = r.ResponseResult;
                    Console.WriteLine(r.service.Name + ":\"" + text + "\" Total Elapsed ms:" + r.TotalElapsedMilliseconds + " Request Elapsed ms:" + r.RequestElapsedMilliseconds);
                    return(text);
                }
                else
                {
                    Console.WriteLine(r.service.Name + " not available.");
                }
            }
            throw new Exception("All SpeechToText responses have failed. Are you properly connected to the Internet?");
        }
Ejemplo n.º 4
0
 void Start()
 {
     LogSystem.InstallDefaultReactors();
     _source              = GetComponent <AudioSource>();
     _sttService          = GetComponent <STT_Watson>();
     _source.spatialBlend = 0.0f;
     _source.playOnAwake  = false;
     _source.volume       = 1.0f;
     _source.loop         = false;
 }
Ejemplo n.º 5
0
        //private static System.Speech.Recognition.SpeechRecognizedEventArgs WakeUpWordResults;

        public static async System.Threading.Tasks.Task <string> MicrophoneToTextAsync()
        {
            CallServices <ISpeechToTextService, ISpeechToTextServiceResponse> wSTT = new CallServices <ISpeechToTextService, ISpeechToTextServiceResponse>(null);

            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(Options.options.locale.language);
            using (System.Speech.Recognition.SpeechRecognitionEngine RecognitionEngine = new System.Speech.Recognition.SpeechRecognitionEngine(ci))
            {
                RecognitionEngine.SetInputToDefaultAudioDevice();
                RecognitionEngine.LoadGrammar(new System.Speech.Recognition.DictationGrammar());
                System.Speech.Recognition.RecognitionResult WakeUpWordResult = RecognitionEngine.Recognize();
                if (WakeUpWordResult == null)
                {
                    return(null);
                }
                using (System.IO.FileStream waveStream = new System.IO.FileStream(Options.options.tempFolderPath + Options.options.audio.speechSynthesisFileName, System.IO.FileMode.Create))
                {
                    WakeUpWordResult.Audio.WriteToWaveStream(waveStream);
                    waveStream.Flush();
                    waveStream.Close();
                }
                byte[] bytes = await Helpers.ReadBytesFromFileAsync(Options.options.audio.speechSynthesisFileName);

                System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes);
                string text       = WakeUpWordResult.Text;
                int    sampleRate = await Audio.GetSampleRateAsync(Options.options.tempFolderPath + Options.options.audio.speechSynthesisFileName);

                System.Collections.Generic.Dictionary <string, string> apiArgs = new System.Collections.Generic.Dictionary <string, string>()
                {
                    { "sampleRate", sampleRate.ToString() }
                };
                foreach (ISpeechToTextService STT in new FindServices <ISpeechToTextService>(Options.commandservices["SpeechToText"].preferredServices).PreferredOrderingOfServices)
                {
                    // ISpeechToTextService STT = (ISpeechToTextService)constructor.Invoke(Type.EmptyTypes);;
                    SpeechToTextServiceResponse r = await STT.SpeechToTextServiceAsync(bytes, apiArgs);

                    if (r.StatusCode == 200)
                    {
                        text = r.ResponseResult;
                        Console.WriteLine(r.Service.name + ":\"" + text + "\" Total Elapsed ms:" + r.TotalElapsedMilliseconds + " Request Elapsed ms:" + r.RequestElapsedMilliseconds);
                        return(text);
                    }
                    else
                    {
                        Console.WriteLine(r.Service.name + " not available.");
                    }
                }
                CallServiceResponse <ISpeechToTextServiceResponse> response = await wSTT.CallServiceAsync(bytes, apiArgs);

                text = response.ResponseResult;
                Console.WriteLine("Windows STT (default):\"" + text + "\" Total Elapsed ms:" + response.TotalElapsedMilliseconds + " Request Elapsed ms:" + response.RequestElapsedMilliseconds);
                return(text);
            }
        }
Ejemplo n.º 6
0
    // Gestion instancia singleton
    void Awake()
    {
        this.gameObject.name = "STTUnity"; // para comunicacion con el plugin
        if (STT.instance == null)
        {
            instance = this;
        }

        else
        {
            Destroy(gameObject);
        }
    }
Ejemplo n.º 7
0
 public SimpleTweenObject(GameObject gameObject, float startValue, float endValue, float tweenTime)
 {
     this.gameObject = gameObject;
     this.tweenTime  = tweenTime;
     this.startValue = startValue;
     this.endValue   = endValue;
     lastID++;
     ID             = lastID;
     maxValue       = (endValue >= startValue) ? endValue : startValue;
     minValue       = (endValue <= startValue) ? endValue : startValue;
     currValue      = startValue;
     dValue         = endValue - startValue;
     EaseFunc       = EaseLinear;
     stt            = STT.FloatTween;
     IsFree         = false;
     IsCycled       = false;
     UpdateCallBack = null;
 }
Ejemplo n.º 8
0
            public SimpleTweenObject(GameObject gameObject, Vector3 startPosition, Vector3 endPosition, float tweenTime, bool move)
            {
                this.gameObject = gameObject;
                this.tweenTime  = tweenTime;

                this.startPosition = startPosition;
                this.endPosition   = endPosition;
                currPosition       = startPosition;
                dPosition          = endPosition - startPosition;

                lastID++;
                ID = lastID;

                EaseFunc         = EaseLinear;
                stt              = (!move)? STT.Vector3Tween : STT.Vector3TweenMove;
                IsFree           = false;
                IsCycled         = false;
                UpdateCallBackV3 = null;
            }
Ejemplo n.º 9
0
            private bool onComplete = false; // it(true) run completeCallBack after cancel

            public SimpleTweenObject(GameObject gameObject, float startValue, float endValue, float tweenTime)
            {
                this.gameObject = gameObject;
                this.tweenTime  = tweenTime;
                this.startValue = startValue;
                this.endValue   = endValue;
                lastID++;
                id              = lastID;
                maxValue        = (endValue >= startValue) ? endValue : startValue;
                minValue        = (endValue <= startValue) ? endValue : startValue;
                currValue       = startValue;
                dValue          = endValue - startValue;
                EaseFunc        = EaseLinear;
                stt             = STT.FloatTween;
                isFree          = false;
                isCycled        = false;
                cancelCondition = CancelCondition.AsIs;
                isCanceled      = false;
                onComplete      = false;
            }
Ejemplo n.º 10
0
        public MainWindow()
        {
            InitializeComponent();

            instance                   = STT.getInstance();
            dataContext                = new MainWindowViewModel();
            dataContext.Accept         = "Сказать команду";
            dataContext.Apply          = "Применить";
            dataContext.TabControlName = tabcontrol;

            DataContext = dataContext;

            if (!File.Exists("Data.json"))
            {
                ActionWordFactory factory = new StartWordFactory();
                factory.Create();

                factory = new StopWordFactory();
                factory.Create();

                Prepare.InitalizeProgramms();
            }

            Word.Read();

            foreach (var values in Word.Items.Values)
            {
                foreach (var item in values.list)
                {
                    if (item.type == "action")
                    {
                        cbAction.Items.Add(values.word);
                    }
                    else if (item.type == "target")
                    {
                        cbTarget.Items.Add(values.word);
                    }
                }
            }
        }
Ejemplo n.º 11
0
            public SimpleTweenObject(GameObject gameObject, Vector3 startPosition, Vector3 endPosition, float tweenTime, bool move)
            {
                this.gameObject = gameObject;
                this.tweenTime  = tweenTime;

                this.startPosition = startPosition;
                this.endPosition   = endPosition;
                currPosition       = startPosition;
                dPosition          = endPosition - startPosition;

                lastID++;
                id = lastID;


                EaseFunc        = EaseLinear;
                stt             = (!move)? STT.Vector3Tween : STT.Vector3TweenMove;
                isFree          = false;
                isCycled        = false;
                cancelCondition = CancelCondition.AsIs;
                isCanceled      = false;
                onComplete      = false;
            }
Ejemplo n.º 12
0
        private void button_ExportGrid_Click(object sender, EventArgs e)
        {
            int numObject = objects.Count();

            System.IO.File.WriteAllText("output.txt", string.Empty);
            System.IO.File.AppendAllText("output.txt", numObject.ToString() + Environment.NewLine);
            int tempid = 0;
            int STT;

            foreach (var item in objects)
            {
                if (txtSTT.Text == null)
                {
                    STT = 0;
                }
                STT = Int32.Parse(txtSTT.Text) + tempid;
                string line = STT.ToString() + " " + item.Value.Output();
                System.IO.File.AppendAllText("output.txt", line + Environment.NewLine);
                tempid++;
            }
            MessageBox.Show("Da Xuat Ra file output.txt trong debug");
        }
Ejemplo n.º 13
0
            internal void Rebuild(GameObject gameObject, Vector3 startPosition, Vector3 endPosition, float tweenTime, bool move)
            {
                this.gameObject = gameObject;
                this.tweenTime  = tweenTime;
                lastID++;
                ID = lastID;

                this.startPosition = startPosition;
                this.endPosition   = endPosition;
                currPosition       = startPosition;
                dPosition          = endPosition - startPosition;

                EaseFunc         = EaseLinear;
                currTime         = 0.0f;
                delay            = 0.0f;
                stt              = (move) ? STT.Vector3TweenMove : STT.Vector3Tween;
                IsFree           = false;
                IsCycled         = false;
                completeCallBack = null;
                UpdateCallBack   = null;
                UpdateCallBackV3 = null;
                // Debug.Log("Rebuild " + ID + gameObject);
            }
Ejemplo n.º 14
0
 internal void Rebuild(GameObject gameObject, float startValue, float endValue, float tweenTime)
 {
     this.gameObject = gameObject;
     this.tweenTime  = tweenTime;
     this.startValue = startValue;
     this.endValue   = endValue;
     lastID++;
     ID               = lastID;
     maxValue         = (endValue >= startValue) ? endValue : startValue;
     minValue         = (endValue <= startValue) ? endValue : startValue;
     currValue        = startValue;
     dValue           = endValue - startValue;
     EaseFunc         = EaseLinear;
     currTime         = 0.0f;
     delay            = 0.0f;
     stt              = STT.FloatTween;
     IsFree           = false;
     IsCycled         = false;
     completeCallBack = null;
     UpdateCallBackV3 = null;
     UpdateCallBack   = null;
     //  Debug.Log("Rebuild " + ID + gameObject);
 }
Ejemplo n.º 15
0
 internal void Rebuild(GameObject gameObject, float startValue, float endValue, float tweenTime)
 {
     this.gameObject = gameObject;
     this.tweenTime  = tweenTime;
     this.startValue = startValue;
     this.endValue   = endValue;
     lastID++;
     id               = lastID;
     maxValue         = (endValue >= startValue) ? endValue : startValue;
     minValue         = (endValue <= startValue) ? endValue : startValue;
     currValue        = startValue;
     dValue           = endValue - startValue;
     EaseFunc         = EaseLinear;
     currTime         = 0.0f;
     delay            = 0.0f;
     stt              = STT.FloatTween;
     isFree           = false;
     isCycled         = false;
     completeCallBack = null;
     UpdateCallBack   = null;
     cancelCondition  = CancelCondition.AsIs;
     isCanceled       = false;
     onComplete       = false;
 }
Ejemplo n.º 16
0
            internal void Rebuild(GameObject gameObject, Vector3 startPosition, Vector3 endPosition, float tweenTime, bool move)
            {
                this.gameObject = gameObject;
                this.tweenTime  = tweenTime;
                lastID++;
                id = lastID;

                this.startPosition = startPosition;
                this.endPosition   = endPosition;
                currPosition       = startPosition;
                dPosition          = endPosition - startPosition;

                EaseFunc         = EaseLinear;
                currTime         = 0.0f;
                delay            = 0.0f;
                stt              = (move) ? STT.Vector3TweenMove : STT.Vector3Tween;
                isFree           = false;
                isCycled         = false;
                completeCallBack = null;
                UpdateCallBack   = null;
                cancelCondition  = CancelCondition.AsIs;
                isCanceled       = false;
                onComplete       = false;
            }
Ejemplo n.º 17
0
        public Message UpdateBankAccountInfo(STT objUI)
        {
            Message msg = null;

            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    STT objDb = GetById(objUI.ID);

                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForUpdateBanks(objUI, ELogAction.Update);
                            // Update info by objUI
                            objDb.BankName = objUI.BankName;
                            objDb.BankAccount = objUI.BankAccount;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;

                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.ID + " "+ objDb.FirstName + " " + objDb.MiddleName + " " + objDb.LastName + "'", "updated");
                        }
                    }
                }
            }
            catch
            {
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
Ejemplo n.º 18
0
        public Message UpdateAddressInfo(STT objUI)
        {
            Message msg = null;

            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    STT objDb = GetById(objUI.ID);

                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForUpdateAddress(objUI, ELogAction.Update);
                            // Update info by objUI
                            objDb.PermanentAddress = objUI.PermanentAddress;
                            objDb.PermanentArea = objUI.PermanentArea;
                            objDb.PermanentDistrict = objUI.PermanentDistrict;
                            objDb.PermanentCityProvince = objUI.PermanentCityProvince;
                            objDb.PermanentCountry = objUI.PermanentCountry;
                            objDb.TempAddress = objUI.TempAddress;
                            objDb.TempArea = objUI.TempArea;
                            objDb.TempDistrict = objUI.TempDistrict;
                            objDb.TempCityProvince = objUI.TempCityProvince;
                            objDb.TempCountry = objUI.TempCountry;
                            objDb.VnPermanentAddress = objUI.VnPermanentAddress;
                            objDb.VnPermanentArea = objUI.VnPermanentArea;
                            objDb.VnPermanentDistrict = objUI.VnPermanentDistrict;
                            objDb.VnPermanentCityProvince = objUI.VnPermanentCityProvince;
                            objDb.VnPermanentCountry = objUI.VnPermanentCountry;
                            objDb.VnTempAddress = objUI.VnTempAddress;
                            objDb.VnTempArea = objUI.VnTempArea;
                            objDb.VnTempDistrict = objUI.VnTempDistrict;
                            objDb.VnTempCityProvince = objUI.VnTempCityProvince;
                            objDb.VnTempCountry = objUI.VnTempCountry;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;

                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.ID + " " + objDb.FirstName + " " + objDb.MiddleName + " " + objDb.LastName + "'", "updated");
                        }
                    }
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Ejemplo n.º 19
0
        public Message Update(STT objUI)
        {
            Message msg = null;
            try
            {
                if (objUI != null)
                {
                    STT objDb = GetById(objUI.ID);
                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForSTT(null, objUI, ELogAction.Update);
                            objDb.FirstName = objUI.FirstName;
                            objDb.MiddleName = objUI.MiddleName;
                            objDb.LastName = objUI.LastName;
                            objDb.Major = objUI.Major;
                            objDb.DOB = objUI.DOB;
                            objDb.ManagerId = objUI.ManagerId;
                            objDb.Project = objUI.Project;
                            objDb.POB = objUI.POB;
                            objDb.PlaceOfOrigin = objUI.PlaceOfOrigin;
                            objDb.Nationality = objUI.Nationality;
                            objDb.IDNumber = objUI.IDNumber;
                            objDb.IssueDate = objUI.IssueDate;
                            objDb.Gender = objUI.Gender;
                            objDb.Religion = objUI.Religion;
                            objDb.MarriedStatus = objUI.MarriedStatus;
                            objDb.STTStatusId = objUI.STTStatusId;
                            objDb.JR = objUI.JR;
                            objDb.JRApproval = objUI.JRApproval;
                            objDb.StartDate = objUI.StartDate;
                            objDb.ExpectedEndDate = objUI.ExpectedEndDate;
                            objDb.DepartmentId = objUI.DepartmentId;
                            objDb.LaborUnion = objUI.LaborUnion;
                            objDb.LaborUnionDate = objUI.LaborUnionDate;
                            objDb.HomePhone = objUI.HomePhone;
                            objDb.CellPhone = objUI.CellPhone;
                            objDb.Floor = objUI.Floor;
                            objDb.ExtensionNumber = objUI.ExtensionNumber;
                            objDb.SeatCode = objUI.SeatCode;
                            objDb.SkypeId = objUI.SkypeId;
                            objDb.YahooId = objUI.YahooId;
                            objDb.PersonalEmail = objUI.PersonalEmail;
                            objDb.OfficeEmail = objUI.OfficeEmail;
                            objDb.EmergencyContactName = objUI.EmergencyContactName;
                            objDb.EmergencyContactPhone = objUI.EmergencyContactPhone;
                            objDb.EmergencyContactRelationship = objUI.EmergencyContactRelationship;
                            objDb.PermanentAddress = objUI.PermanentAddress;
                            objDb.PermanentArea = objUI.PermanentArea;
                            objDb.PermanentDistrict = objUI.PermanentDistrict;
                            objDb.PermanentCityProvince = objUI.PermanentCityProvince;
                            objDb.PermanentCountry = objUI.PermanentCountry;
                            objDb.TempAddress = objUI.TempAddress;
                            objDb.TempArea = objUI.TempArea;
                            objDb.TempDistrict = objUI.TempDistrict;
                            objDb.TempCityProvince = objUI.TempCityProvince;
                            objDb.TempCountry = objUI.TempCountry;
                            objDb.BankName = objUI.BankName;
                            objDb.BankAccount = objUI.BankAccount;
                            objDb.Remarks = objUI.Remarks;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;
                            objDb.VnFirstName = objUI.VnFirstName;
                            objDb.VnMiddleName = objUI.VnMiddleName;
                            objDb.VnLastName = objUI.VnLastName;
                            objDb.VnPOB = objUI.VnPOB;
                            objDb.VnPlaceOfOrigin = objUI.VnPlaceOfOrigin;
                            objDb.Degree = objUI.Degree;
                            objDb.OtherDegree = objUI.OtherDegree;
                            objDb.Race = objUI.Race;
                            objDb.IDIssueLocation = objUI.IDIssueLocation;
                            objDb.VnIDIssueLocation = objUI.VnIDIssueLocation;
                            objDb.VnPermanentAddress = objUI.VnPermanentAddress;
                            objDb.VnPermanentArea = objUI.VnPermanentArea;
                            objDb.VnPermanentDistrict = objUI.VnPermanentDistrict;
                            objDb.VnPermanentCityProvince = objUI.VnPermanentCityProvince;
                            objDb.VnPermanentCountry = objUI.VnPermanentCountry;
                            objDb.VnTempAddress = objUI.VnTempAddress;
                            objDb.VnTempArea = objUI.VnTempArea;
                            objDb.VnTempDistrict = objUI.VnTempDistrict;
                            objDb.VnTempCityProvince = objUI.VnTempCityProvince;
                            objDb.VnTempCountry = objUI.VnTempCountry;
                            objDb.LocationCode = objUI.LocationCode;
                            // Submit changes to dbContext
                            dbContext.SubmitChanges();
                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.ID + " " + objDb.FirstName + " " + objDb.MiddleName + " " + objDb.LastName + "", "updated");

                        }
                    }
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Ejemplo n.º 20
0
        public bool IsValidUpdateDateForResult(DateTime currentDate, STT objDb, out Message msg)
        {
            bool isValid = false;
            msg = null;

            try
            {
                    if (objDb != null)
                    {
                        if (objDb.UpdateDate.ToString().Equals(currentDate.ToString()))
                        {
                            isValid = true;
                        }
                        else
                        {
                            msg = new Message(MessageConstants.E0025, MessageType.Error, "STT " + objDb.ID);
                        }
                    }
            }
            catch
            {
                throw;
            }

            return isValid;
        }
Ejemplo n.º 21
0
        public Message UpdateImage(STT objUI)
        {
            Message msg = null;
            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    STT objDb = GetById(objUI.ID);

                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForUpdateImage(objUI, ELogAction.Update);
                            // Update info by objUI
                            objDb.Photograph = objUI.Photograph;
                            //objDb.UpdateDate = DateTime.Now;
                            //objDb.UpdatedBy = objUI.UpdatedBy;

                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, "STT photo", "uploaded");
                        }
                    }
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// All Necessary Components
 /// </summary>
 void Awake()
 {
     _assistantService = GetComponent <Assistant_Watson>();
     _sttService       = GetComponent <STT_Watson>();
     _ttsService       = GetComponent <TTS_Watson>();
 }
Ejemplo n.º 23
0
        public void WriteLogForUpdateRemarks(STT newInfo, ELogAction action)
        {
            try
            {
                bool isUpdated = false;
                if (newInfo == null)
                {
                    return;
                }
                MasterLog objMasterLog = new MasterLog();
                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.Remarks != oldInfo.Remarks)
                    {
                        commonDao.InsertLogDetail(logId, "Remarks", "Remarks", oldInfo.Remarks, newInfo.Remarks);
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                    else
                    {
                        commonDao.DeleteMasterLog(logId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 24
0
        public void WriteLogForUpdateAddress(STT newInfo, ELogAction action)
        {
            try
            {
                bool isUpdated = false;
                if (newInfo == null)
                {
                    return;
                }
                MasterLog objMasterLog = new MasterLog();
                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.PermanentAddress != oldInfo.PermanentAddress)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentAddress", "Permanent Address", oldInfo.PermanentAddress, newInfo.PermanentAddress);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentArea != oldInfo.PermanentArea)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentArea", "Permanent Ward", oldInfo.PermanentArea, newInfo.PermanentArea);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentDistrict != oldInfo.PermanentDistrict)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentDistrict", "Permanent District", oldInfo.PermanentDistrict, newInfo.PermanentDistrict);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentCityProvince != oldInfo.PermanentCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentCityProvince", "Permanent City Province", oldInfo.PermanentCityProvince, newInfo.PermanentCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentCountry != oldInfo.PermanentCountry)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentCountry", "Permanent Country", oldInfo.PermanentCountry, newInfo.PermanentCountry);
                        isUpdated = true;
                    }
                    if (newInfo.TempAddress != oldInfo.TempAddress)
                    {
                        commonDao.InsertLogDetail(logId, "TempAddress", "Temp Address", oldInfo.TempAddress, newInfo.TempAddress);
                        isUpdated = true;
                    }
                    if (newInfo.TempArea != oldInfo.TempArea)
                    {
                        commonDao.InsertLogDetail(logId, "TempArea", "Temp Area", oldInfo.TempArea, newInfo.TempArea);
                        isUpdated = true;
                    }
                    if (newInfo.TempDistrict != oldInfo.TempDistrict)
                    {
                        commonDao.InsertLogDetail(logId, "TempDistrict", "Temp District", oldInfo.TempDistrict, newInfo.TempDistrict);
                        isUpdated = true;
                    }
                    if (newInfo.TempCityProvince != oldInfo.TempCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "TempCityProvince", "Temp City Province", oldInfo.TempCityProvince, newInfo.TempCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.TempCountry != oldInfo.TempCountry)
                    {
                        commonDao.InsertLogDetail(logId, "TempCountry", "Temp Country", oldInfo.TempCountry, newInfo.TempCountry);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentAddress != oldInfo.VnPermanentAddress)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentAddress", "Vn Permanent Address", oldInfo.VnPermanentAddress, newInfo.VnPermanentAddress);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentArea != oldInfo.VnPermanentArea)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentArea", "Vn Permanent Area", oldInfo.VnPermanentArea, newInfo.VnPermanentArea);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentDistrict != oldInfo.VnPermanentDistrict)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentDistrict", "Vn Permanent District", oldInfo.VnPermanentDistrict, newInfo.VnPermanentDistrict);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentCityProvince != oldInfo.VnPermanentCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentCityProvince", "Vn Permanent City Province", oldInfo.VnPermanentCityProvince, newInfo.VnPermanentCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentCountry != oldInfo.VnPermanentCountry)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentCountry", "Vn Permanent Country", oldInfo.VnPermanentCountry, newInfo.VnPermanentCountry);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempAddress != oldInfo.VnTempAddress)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempAddress", "Vn Temp Address", oldInfo.VnTempAddress, newInfo.VnTempAddress);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempArea != oldInfo.VnTempArea)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempArea", "Vn Temp Area", oldInfo.VnTempArea, newInfo.VnTempArea);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempCityProvince != oldInfo.VnTempCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempCityProvince", "Vn Temp City Province", oldInfo.VnTempCityProvince, newInfo.VnTempCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempCountry != oldInfo.VnTempCountry)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempCountry", "Vn Temp Country", oldInfo.VnTempCountry, newInfo.VnTempCountry);
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                    else
                    {
                        commonDao.DeleteMasterLog(logId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 25
0
        public void WriteLogForUpdateCompany(STT newInfo, ELogAction action)
        {
            try
            {
                bool isUpdated = false;
                if (newInfo == null)
                {
                    return;
                }
                MasterLog objMasterLog = new MasterLog();
                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.JR != oldInfo.JR)
                    {
                        commonDao.InsertLogDetail(logId, "JR", "Job Request", oldInfo.JR, newInfo.JR);
                        isUpdated = true;
                    }
                    if (newInfo.Project != oldInfo.Project)
                    {
                        commonDao.InsertLogDetail(logId, "Project", "Project", oldInfo.Project, newInfo.Project);
                        isUpdated = true;
                    }
                    if (newInfo.ManagerId != oldInfo.ManagerId)
                    {
                        commonDao.InsertLogDetail(logId, "Manager", "Manager", oldInfo.ManagerId, newInfo.ManagerId);
                        isUpdated = true;
                    }
                    if (newInfo.JRApproval != oldInfo.JRApproval)
                    {
                        commonDao.InsertLogDetail(logId, "JRApproval", "Job Request Approval", oldInfo.JRApproval, newInfo.JRApproval);
                        isUpdated = true;
                    }
                    if (newInfo.StartDate != oldInfo.StartDate)
                    {
                        commonDao.InsertLogDetail(logId, "StartDate", "Start Date", oldInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW), newInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW));
                        isUpdated = true;
                    }
                    if (newInfo.ExpectedEndDate != oldInfo.ExpectedEndDate)
                    {
                        commonDao.InsertLogDetail(logId, "ContractedDate", "Contracted Date",oldInfo.ExpectedEndDate.HasValue? oldInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.ExpectedEndDate.HasValue? newInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.DepartmentId != oldInfo.DepartmentId)
                    {
                        Department sub = new DepartmentDao().GetById(newInfo.DepartmentId);
                        commonDao.InsertLogDetail(logId, "DepartmentId", "Sub Department", oldInfo.Department.DepartmentName, sub.DepartmentName);
                        isUpdated = true;
                    }
                    if (newInfo.LaborUnion != oldInfo.LaborUnion)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnion", "Labor Union",oldInfo.LaborUnion.HasValue? oldInfo.LaborUnion == true ? "Yes" : "No":"",oldInfo.LaborUnion.HasValue? newInfo.LaborUnion == true ? "Yes" : "No":"");
                        isUpdated = true;
                    }
                    if (newInfo.LaborUnionDate != oldInfo.LaborUnionDate)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnionDate", "Labor Union date", oldInfo.LaborUnionDate.HasValue ? oldInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "", newInfo.LaborUnionDate.HasValue ? newInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "");
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                    else
                    {
                        commonDao.DeleteMasterLog(logId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Write Insert Log For STT
        /// </summary>
        /// <param name="objInfo"></param>
        /// <param name="logId"></param>
        private void WriteInsertLogForSTT(STT objInfo, string logId)
        {
            try
            {
                if ((objInfo != null) && (logId != null))
                {
                    // Insert to Log Detail
                    commonDao.InsertLogDetail(logId, "ID", "ID", null, objInfo.ID.ToString());

                    commonDao.InsertLogDetail(logId, "FirstName", "First Name", null, objInfo.FirstName);
                    commonDao.InsertLogDetail(logId, "LastName", "Last Name", null, objInfo.LastName);
                    if (!string.IsNullOrEmpty(objInfo.MiddleName))
                    {
                        commonDao.InsertLogDetail(logId, "MiddleName", "Middle Name", null, objInfo.MiddleName);
                    }
                    if (!string.IsNullOrEmpty(objInfo.Project))
                    {
                        commonDao.InsertLogDetail(logId, "Project", "Project", null, objInfo.Project);
                    }
                    if (!string.IsNullOrEmpty(objInfo.ManagerId))
                    {
                        commonDao.InsertLogDetail(logId, "Manager", "Manager", null, objInfo.ManagerId);
                    }
                    if (!string.IsNullOrEmpty(objInfo.Major))
                    {
                        commonDao.InsertLogDetail(logId, "Major", "Major", null, objInfo.Major);
                    }
                    commonDao.InsertLogDetail(logId, "VnFirstName", "Vn First Name", null, objInfo.VnFirstName);
                    if (!string.IsNullOrEmpty(objInfo.VnMiddleName))
                    {
                        commonDao.InsertLogDetail(logId, "VnMiddleName", "Vn Middle Name", null, objInfo.VnMiddleName);
                    }
                    commonDao.InsertLogDetail(logId, "VnLastName", "Vn Last Name", null, objInfo.VnLastName);
                    if (!string.IsNullOrEmpty(objInfo.VnPlaceOfOrigin))
                    {
                        commonDao.InsertLogDetail(logId, "VnPlaceOfOrigin", "Vn Place Of Origin", null, objInfo.VnPlaceOfOrigin);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnPOB))
                    {
                        commonDao.InsertLogDetail(logId, "VnPOB", "Vn Place Of Birth", null, objInfo.VnPOB);
                    }
                    if (!string.IsNullOrEmpty(objInfo.Degree))
                    {
                        commonDao.InsertLogDetail(logId, "Degree", "Degree", null, objInfo.Degree);
                    }
                    if (!string.IsNullOrEmpty(objInfo.OtherDegree))
                    {
                        commonDao.InsertLogDetail(logId, "OtherDegree", "OtherDegree", null, objInfo.OtherDegree);
                    }
                    if (!string.IsNullOrEmpty(objInfo.Race))
                    {
                        commonDao.InsertLogDetail(logId, "Race", "Race", null, objInfo.Race);
                    }
                    if (!string.IsNullOrEmpty(objInfo.IDIssueLocation))
                    {
                        commonDao.InsertLogDetail(logId, "IDIssueLocation", "Issue Location", null, objInfo.IDIssueLocation);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnIDIssueLocation))
                    {
                        commonDao.InsertLogDetail(logId, "VnIDIssueLocation", "Vn Issue Location", null, objInfo.VnIDIssueLocation);
                    }
                    if (objInfo.Gender.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "Gender", "Gender", null, objInfo.Gender == Constants.MALE ? "Male" : "Female");
                    }
                    if (!string.IsNullOrEmpty(objInfo.IDNumber))
                    {
                        commonDao.InsertLogDetail(logId, "IDNumber", "ID Number", null, objInfo.IDNumber);
                    }
                    commonDao.InsertLogDetail(logId, "StartDate", "Start Date", null, objInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW));

                    if (objInfo.ExpectedEndDate.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "GenExpectedEndDateder", "Expected End Date", null, objInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW));
                    }
                    if (!string.IsNullOrEmpty(objInfo.Photograph))
                    {
                        commonDao.InsertLogDetail(logId, "Photograph", "Photograph", null, objInfo.Photograph);
                    }
                    if (!string.IsNullOrEmpty(objInfo.JR))
                    {
                        commonDao.InsertLogDetail(logId, "JobRequest", "Job Request", null, objInfo.JR);
                    }
                    if (!string.IsNullOrEmpty(objInfo.JRApproval))
                    {
                        commonDao.InsertLogDetail(logId, "Job Request Approval", "Job Request Approval", null, objInfo.JRApproval);
                    }
                    if (!string.IsNullOrEmpty(objInfo.TempAddress))
                    {
                        commonDao.InsertLogDetail(logId, "TempAddress", "Temp Address", null, objInfo.TempAddress);
                    }
                    if (!string.IsNullOrEmpty(objInfo.TempArea))
                    {
                        commonDao.InsertLogDetail(logId, "TempArea", "Temp Area", null, objInfo.TempArea);
                    }
                    if (!string.IsNullOrEmpty(objInfo.TempDistrict))
                    {
                        commonDao.InsertLogDetail(logId, "TempDistrict", "Temp District", null, objInfo.TempDistrict);
                    }
                    if (!string.IsNullOrEmpty(objInfo.TempCityProvince))
                    {
                        commonDao.InsertLogDetail(logId, "TempCityProvince", "Temp City Province", null, objInfo.TempCityProvince);
                    }
                    if (!string.IsNullOrEmpty(objInfo.TempCountry))
                    {
                        commonDao.InsertLogDetail(logId, "TempCountry", "Temp Country", null, objInfo.TempCountry);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PermanentAddress))
                    {
                        commonDao.InsertLogDetail(logId, "PermanentAddress", "Permanent Address", null, objInfo.PermanentAddress);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PermanentArea))
                    {
                        commonDao.InsertLogDetail(logId, "PermanentArea", "Permanent Area", null, objInfo.PermanentArea);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PermanentDistrict))
                    {
                        commonDao.InsertLogDetail(logId, "PermanentDistrict", "Permanent District", null, objInfo.PermanentDistrict);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PermanentCityProvince))
                    {
                        commonDao.InsertLogDetail(logId, "PermanentCityProvince", "Permanent City Province", null, objInfo.PermanentCityProvince);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PermanentCountry))
                    {
                        commonDao.InsertLogDetail(logId, "PermanentCountry", "Permanent Country", null, objInfo.PermanentCountry);
                    }
                    if (!string.IsNullOrEmpty(objInfo.HomePhone))
                    {
                        commonDao.InsertLogDetail(logId, "HomePhone", "Home Phone", null, objInfo.HomePhone);
                    }
                    if (!string.IsNullOrEmpty(objInfo.CellPhone))
                    {
                        commonDao.InsertLogDetail(logId, "CellPhone", "Cell Phone", null, objInfo.CellPhone);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PersonalEmail))
                    {
                        commonDao.InsertLogDetail(logId, "PersonalEmail", "Personal Email", null, objInfo.PersonalEmail);
                    }
                    if (!string.IsNullOrEmpty(objInfo.OfficeEmail))
                    {
                        commonDao.InsertLogDetail(logId, "OfficeEmail", "Office Email", null, objInfo.OfficeEmail);
                    }
                    if (!string.IsNullOrEmpty(objInfo.ExtensionNumber))
                    {
                        commonDao.InsertLogDetail(logId, "ExtensionNumber", "Extension Number", null, objInfo.ExtensionNumber);
                    }
                    if (objInfo.DOB.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "DOB", "Date Of Birth", null, objInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW));
                    }
                    if (!string.IsNullOrEmpty(objInfo.POB))
                    {
                        commonDao.InsertLogDetail(logId, "POB", "Place Of Birth", null, objInfo.POB);
                    }
                    if (!string.IsNullOrEmpty(objInfo.Nationality))
                    {
                        commonDao.InsertLogDetail(logId, "Nationality", "Nationality", null, objInfo.Nationality);
                    }
                    if (!string.IsNullOrEmpty(objInfo.PlaceOfOrigin))
                    {
                        commonDao.InsertLogDetail(logId, "PlaceOfOrigin", "Place Of Origin", null, objInfo.PlaceOfOrigin);
                    }
                    if (objInfo.IssueDate.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "IssueDate", "Issue Date", null, objInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW));
                    }
                    if (!string.IsNullOrEmpty(objInfo.BankAccount))
                    {
                        commonDao.InsertLogDetail(logId, "BankAccount", "Bank Account", null, objInfo.BankAccount);
                    }
                    if (!string.IsNullOrEmpty(objInfo.BankName))
                    {
                        commonDao.InsertLogDetail(logId, "BankName", "Bank Name", null, objInfo.BankName);
                    }
                    if (objInfo.LaborUnion.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnion", "Labor Union", null, objInfo.LaborUnion == Constants.LABOR_UNION_FALSE ? "No" : "Yes");
                    }
                    if (objInfo.LaborUnionDate.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnionDate", "Labor Union Date", null, objInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW));
                    }
                    if (!string.IsNullOrEmpty(objInfo.Remarks))
                    {
                        commonDao.InsertLogDetail(logId, "Remarks", "Remarks", null, objInfo.Remarks);
                    }
                    if (objInfo.MarriedStatus.HasValue)
                    {
                        commonDao.InsertLogDetail(logId, "MarriedStatus", "Married Status", null, objInfo.MarriedStatus == Constants.SINGLE ? "Single" : "Married");
                    }
                    if (!string.IsNullOrEmpty(objInfo.Religion))
                    {
                        commonDao.InsertLogDetail(logId, "Religion", "Religion", null, objInfo.Religion);
                    }
                    if (!string.IsNullOrEmpty(objInfo.EmergencyContactName))
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactName", "Emergency Contact Name", null, objInfo.EmergencyContactName);
                    }
                    if (!string.IsNullOrEmpty(objInfo.EmergencyContactPhone))
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactPhone", "Emergency Contact Phone", null, objInfo.EmergencyContactPhone);
                    }
                    if (!string.IsNullOrEmpty(objInfo.EmergencyContactRelationship))
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactRelationship", "Emergency Contact Relationship", null, objInfo.EmergencyContactRelationship);
                    }

                    commonDao.InsertLogDetail(logId, "Title", "Job Title", null, Constants.STT_DEFAULT_VALUE);
                    commonDao.InsertLogDetail(logId, "DepartmentId", "Sub Department", null, objInfo.Department.DepartmentName);
                    commonDao.InsertLogDetail(logId, "Department", "Department", null, new DepartmentDao().GetDepartmentNameBySub(objInfo.DepartmentId));
                    if (!string.IsNullOrEmpty(objInfo.SkypeId))
                    {
                        commonDao.InsertLogDetail(logId, "SkypeId", "SkypeId", null, objInfo.SkypeId);
                    }
                    if (!string.IsNullOrEmpty(objInfo.YahooId))
                    {
                        commonDao.InsertLogDetail(logId, "YahooId", "YahooId", null, objInfo.YahooId);
                    }
                    if (!string.IsNullOrEmpty(objInfo.LocationCode))
                    {
                        commonDao.InsertLogDetail(logId, "LocationCode", "Location Code", null, CommonFunc.GenerateStringOfLocation(objInfo.LocationCode));
                    }
                    if (!string.IsNullOrEmpty(objInfo.CVFile))
                    {
                        commonDao.InsertLogDetail(logId, "CVFile", "CVFile", null, objInfo.CVFile);
                    }
                    commonDao.InsertLogDetail(logId, "STTStatusId", "STT Status", null, objInfo.STT_Status.Name);
                    if (!string.IsNullOrEmpty(objInfo.VnPermanentAddress))
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentAddress", "Vn Permanent Address", null, objInfo.VnPermanentAddress);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnPermanentArea))
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentArea", "Vn Permanent Area", null, objInfo.VnPermanentArea);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnPermanentDistrict))
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentDistrict", "Vn Permanent District", null, objInfo.VnPermanentDistrict);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnPermanentCityProvince))
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentCityProvince", "Vn Permanent City Province", null, objInfo.VnPermanentCityProvince);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnPermanentCountry))
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentCountry", "Vn Permanent Country", null, objInfo.VnPermanentCountry);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnTempAddress))
                    {
                        commonDao.InsertLogDetail(logId, "VnTempAddress", "Vn Temp Address", null, objInfo.VnTempAddress);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnTempArea))
                    {
                        commonDao.InsertLogDetail(logId, "VnTempArea", "Vn Temp Area", null, objInfo.VnTempArea);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnTempDistrict))
                    {
                        commonDao.InsertLogDetail(logId, "VnTempDistrict", "Vn Temp District", null, objInfo.VnTempDistrict);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnTempCityProvince))
                    {
                        commonDao.InsertLogDetail(logId, "VnTempCityProvince", "Vn Temp City Province", null, objInfo.VnTempCityProvince);
                    }
                    if (!string.IsNullOrEmpty(objInfo.VnTempCountry))
                    {
                        commonDao.InsertLogDetail(logId, "VnTempCountry", "Vn Temp Country", null, objInfo.VnTempCountry);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 27
0
        public void WriteLogForUpdateContact(STT newInfo, ELogAction action)
        {
            try
            {
                bool isUpdated = false;
                if (newInfo == null)
                {
                    return;
                }
                MasterLog objMasterLog = new MasterLog();
                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.HomePhone != oldInfo.HomePhone)
                    {
                        commonDao.InsertLogDetail(logId, "HomePhone", "Home Phone", oldInfo.HomePhone, newInfo.HomePhone);
                        isUpdated = true;
                    }
                    if (newInfo.CellPhone != oldInfo.CellPhone)
                    {
                        commonDao.InsertLogDetail(logId, "CellPhone", "Cell Phone", oldInfo.CellPhone, newInfo.CellPhone);
                        isUpdated = true;
                    }
                    if (newInfo.ExtensionNumber != oldInfo.ExtensionNumber)
                    {
                        commonDao.InsertLogDetail(logId, "ExtensionNumber", "Extension Number", oldInfo.ExtensionNumber, newInfo.ExtensionNumber);
                        isUpdated = true;
                    }
                    if (newInfo.LocationCode != oldInfo.LocationCode)
                    {
                        commonDao.InsertLogDetail(logId, "LocationCode", "LocationCode", CommonFunc.GenerateStringOfLocation(oldInfo.LocationCode), CommonFunc.GenerateStringOfLocation(newInfo.LocationCode));
                        isUpdated = true;
                    }
                    if (newInfo.SkypeId != oldInfo.SkypeId)
                    {
                        commonDao.InsertLogDetail(logId, "SkypeId", "SkypeId", oldInfo.SkypeId, newInfo.SkypeId);
                        isUpdated = true;
                    }
                    if (newInfo.YahooId != oldInfo.YahooId)
                    {
                        commonDao.InsertLogDetail(logId, "YahooId", "YahooId", oldInfo.YahooId, newInfo.YahooId);
                        isUpdated = true;
                    }
                    if (newInfo.PersonalEmail != oldInfo.PersonalEmail)
                    {
                        commonDao.InsertLogDetail(logId, "PersonalEmail", "Personal Email", oldInfo.PersonalEmail, newInfo.PersonalEmail);
                        isUpdated = true;
                    }
                    if (newInfo.OfficeEmail != oldInfo.OfficeEmail)
                    {
                        commonDao.InsertLogDetail(logId, "OfficeEmail", "Office Email", oldInfo.OfficeEmail, newInfo.OfficeEmail);
                        isUpdated = true;
                    }
                    if (newInfo.EmergencyContactName != oldInfo.EmergencyContactName)
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactName", "Emergency Contact Name", oldInfo.EmergencyContactName, newInfo.EmergencyContactName);
                        isUpdated = true;
                    }
                    if (newInfo.EmergencyContactPhone != oldInfo.EmergencyContactPhone)
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactPhone", "Emergency Contact Phone", oldInfo.EmergencyContactPhone, newInfo.EmergencyContactPhone);
                        isUpdated = true;
                    }
                    if (newInfo.EmergencyContactRelationship != oldInfo.EmergencyContactRelationship)
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactRelationship", "Emergency Contact Relationship", oldInfo.EmergencyContactRelationship, newInfo.EmergencyContactRelationship);
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                    else
                    {
                        commonDao.DeleteMasterLog(logId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 28
0
        public void WriteLogForUpdatePersonal(STT newInfo, ELogAction action)
        {
            try
            {
                bool isUpdated = false;
                if (newInfo == null)
                {
                    return;
                }

                MasterLog objMasterLog = new MasterLog();

                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.VnIDIssueLocation != oldInfo.VnIDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "VnIDIssueLocation", "Vn Issue Location", oldInfo.VnIDIssueLocation, newInfo.VnIDIssueLocation);
                        isUpdated = true;
                    }
                    if (newInfo.Major != oldInfo.Major)
                    {
                        commonDao.InsertLogDetail(logId, "Major", "Major", oldInfo.Major, newInfo.Major);
                        isUpdated = true;
                    }
                    if (newInfo.Race != oldInfo.Race)
                    {
                        commonDao.InsertLogDetail(logId, "Race", "Race", oldInfo.Race, newInfo.Race);
                        isUpdated = true;
                    }
                    if (newInfo.IDIssueLocation != oldInfo.IDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "IDIssueLocation", "Issue Location", oldInfo.IDIssueLocation, newInfo.IDIssueLocation);
                        isUpdated = true;
                    }
                    if (newInfo.Degree != oldInfo.Degree)
                    {
                        commonDao.InsertLogDetail(logId, "Degree", "Degree", oldInfo.Degree, newInfo.Degree);
                        isUpdated = true;
                    }
                    if (newInfo.OtherDegree != oldInfo.OtherDegree)
                    {
                        commonDao.InsertLogDetail(logId, "OtherDegree", "OtherDegree", oldInfo.OtherDegree, newInfo.OtherDegree);
                        isUpdated = true;
                    }
                    if (newInfo.VnPlaceOfOrigin != oldInfo.VnPlaceOfOrigin)
                    {
                        commonDao.InsertLogDetail(logId, "VnPlaceOfOrigin", "Vn Place Of Origin", oldInfo.VnPlaceOfOrigin, newInfo.VnPlaceOfOrigin);
                        isUpdated = true;
                    }
                    if (newInfo.VnPOB != oldInfo.VnPOB)
                    {
                        commonDao.InsertLogDetail(logId, "VnPOB", "Vn Place Of Birth", oldInfo.VnPOB, newInfo.VnPOB);
                        isUpdated = true;
                    }
                    if (newInfo.VnLastName != oldInfo.VnLastName)
                    {
                        commonDao.InsertLogDetail(logId, "VnLastName", "Vn Last Name", oldInfo.VnLastName, newInfo.VnLastName);
                        isUpdated = true;
                    }
                    if (newInfo.VnMiddleName != oldInfo.VnMiddleName)
                    {
                        commonDao.InsertLogDetail(logId, "VnMiddleName", "Vn Middle Name", oldInfo.VnMiddleName, newInfo.VnMiddleName);
                        isUpdated = true;
                    }
                    if (newInfo.VnFirstName != oldInfo.VnFirstName)
                    {
                        commonDao.InsertLogDetail(logId, "VnFirstName", "Vn First Name", oldInfo.VnFirstName, newInfo.VnFirstName);
                        isUpdated = true;
                    }
                    if (newInfo.LastName != oldInfo.LastName)
                    {
                        commonDao.InsertLogDetail(logId, "LastName", "Last Name", oldInfo.LastName, newInfo.LastName);
                        isUpdated = true;
                    }
                    if (newInfo.MiddleName != oldInfo.MiddleName)
                    {
                        commonDao.InsertLogDetail(logId, "MiddleName", "Middle Name", oldInfo.MiddleName, newInfo.MiddleName);
                        isUpdated = true;
                    }
                    if (newInfo.FirstName != oldInfo.FirstName)
                    {
                        commonDao.InsertLogDetail(logId, "FirstName", "First Name", oldInfo.FirstName, newInfo.FirstName);
                        isUpdated = true;
                    }
                    if (newInfo.Gender != oldInfo.Gender)
                    {
                        commonDao.InsertLogDetail(logId, "Gender", "Gender",oldInfo.Gender.HasValue?oldInfo.Gender == Constants.MALE ? "Male" : "Famale":"",newInfo.Gender.HasValue? newInfo.Gender == Constants.MALE ? "Male" : "Famale":"");
                        isUpdated = true;
                    }
                    if (newInfo.DOB != oldInfo.DOB)
                    {
                        commonDao.InsertLogDetail(logId, "DOB", "Date Of Birth",oldInfo.DOB.HasValue?oldInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.DOB.HasValue?newInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.POB != oldInfo.POB)
                    {
                        commonDao.InsertLogDetail(logId, "POB", "Place Of Birth", oldInfo.POB, newInfo.POB);
                        isUpdated = true;
                    }
                    if (newInfo.Nationality != oldInfo.Nationality)
                    {
                        commonDao.InsertLogDetail(logId, "Nationality", "Nationality", oldInfo.Nationality, newInfo.Nationality);
                        isUpdated = true;
                    }
                    if (newInfo.PlaceOfOrigin != oldInfo.PlaceOfOrigin)
                    {
                        commonDao.InsertLogDetail(logId, "PlaceOfOrigin", "Place Of Origin", oldInfo.PlaceOfOrigin, newInfo.PlaceOfOrigin);
                        isUpdated = true;
                    }
                    if (newInfo.IDNumber != oldInfo.IDNumber)
                    {
                        commonDao.InsertLogDetail(logId, "IDNumber", "ID Number", oldInfo.IDNumber, newInfo.IDNumber);
                        isUpdated = true;
                    }
                    if (newInfo.IssueDate != oldInfo.IssueDate)
                    {
                        commonDao.InsertLogDetail(logId, "IssueDate", "Issue Date",oldInfo.IssueDate.HasValue? oldInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.IssueDate.HasValue? newInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.MarriedStatus != oldInfo.MarriedStatus)
                    {
                        commonDao.InsertLogDetail(logId, "Married Status", "Married Status",oldInfo.MarriedStatus.HasValue? oldInfo.MarriedStatus == Constants.SINGLE ? "Single" : "Married":"",oldInfo.MarriedStatus.HasValue? newInfo.MarriedStatus == Constants.SINGLE ? "Single" : "Married":"");
                        isUpdated = true;
                    }
                    if (newInfo.Religion != oldInfo.Religion)
                    {
                        commonDao.InsertLogDetail(logId, "Religion", "Religion", oldInfo.Religion, newInfo.Religion);
                        isUpdated = true;
                    }
                    if (newInfo.STTStatusId != oldInfo.STTStatusId)
                    {
                        commonDao.InsertLogDetail(logId, "STTStatusId", "STT Status", oldInfo.STTStatusId.ToString(), new STTStatusDao().GetById(newInfo.STTStatusId).Name);
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                    else
                    {
                        commonDao.DeleteMasterLog(logId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 29
0
        public Message UpdateCompanyInfo(STT objUI)
        {
            Message msg = null;
            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    STT objDb = GetById(objUI.ID);

                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForUpdateCompany(objUI, ELogAction.Update);

                            // Update info by objUI
                            objDb.JR = objUI.JR;
                            objDb.JRApproval = objUI.JRApproval;
                            objDb.StartDate = objUI.StartDate;
                            objDb.ExpectedEndDate = objUI.ExpectedEndDate;
                            objDb.LaborUnion = objUI.LaborUnion;
                            objDb.LaborUnionDate = objUI.LaborUnionDate;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;
                            objDb.DepartmentId = objUI.DepartmentId;
                            objDb.ManagerId = objUI.ManagerId;
                            objDb.LocationCode = objUI.LocationCode;
                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.ID + " "  +objDb.FirstName + " " + objDb.MiddleName + " " + objDb.LastName + "'", "updated");
                        }
                    }
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
Ejemplo n.º 30
0
        public Message UpdateContactInfo(STT objUI)
        {
            Message msg = null;

            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    STT objDb = GetById(objUI.ID);

                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForUpdateContact(objUI, ELogAction.Update);
                            // Update info by objUI
                            objDb.HomePhone = objUI.HomePhone;
                            objDb.CellPhone = objUI.CellPhone;
                            objDb.Floor = objUI.Floor;
                            objDb.ExtensionNumber = objUI.ExtensionNumber;
                            objDb.SeatCode = objUI.SeatCode;
                            objDb.SkypeId = objUI.SkypeId;
                            objDb.YahooId = objUI.YahooId;
                            objDb.PersonalEmail = objUI.PersonalEmail;
                            objDb.OfficeEmail = objUI.OfficeEmail;
                            objDb.EmergencyContactName = objUI.EmergencyContactName;
                            objDb.EmergencyContactPhone = objUI.EmergencyContactPhone;
                            objDb.EmergencyContactRelationship = objUI.EmergencyContactRelationship;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;

                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.ID + " "  +objDb.FirstName + " " + objDb.MiddleName + " " + objDb.LastName + "'", "updated");
                        }
                    }
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
Ejemplo n.º 31
0
        public void WriteLogForUpdatePromoted(STT newInfo, ELogAction action)
        {
            try
            {
                if (newInfo == null)
                {
                    return;
                }
                MasterLog objMasterLog = new MasterLog();
                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldSTTInfo = new STTDao().GetById(newInfo.ID);

                if ((oldSTTInfo != null) && (newInfo != null) && (logId != null))
                {

                    commonDao.InsertLogDetail(logId, "STTStatusId", "Status", oldSTTInfo.STT_Status.Name, new STTStatusDao().GetById(Constants.STT_STATUS_PROMOTED).Name);

                    // Insert Key Name
                    string key = oldSTTInfo.ID + " [" + oldSTTInfo.FirstName + " " + oldSTTInfo.MiddleName + " " + oldSTTInfo.LastName + "]";
                    commonDao.InsertLogDetail(logId, "STT_ID", "Key for Update", key, null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 32
0
        public Message UpdatePersonalInfo(STT objUI)
        {
            Message msg = null;
            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    STT objDb = GetById(objUI.ID);

                    if (objDb != null)
                    {
                        // Check valid update date
                        if (IsValidUpdateDate(objUI, objDb, out msg))
                        {
                            new STTLogDao().WriteLogForUpdatePersonal(objUI, ELogAction.Update);
                            // Update info by objUI
                            objDb.Major = objUI.Major;
                            objDb.FirstName = objUI.FirstName;
                            objDb.MiddleName = objUI.MiddleName;
                            objDb.LastName = objUI.LastName;
                            objDb.DOB = objUI.DOB;
                            objDb.POB = objUI.POB;
                            objDb.PlaceOfOrigin = objUI.PlaceOfOrigin;
                            objDb.Nationality = objUI.Nationality;
                            objDb.IDNumber = objUI.IDNumber;
                            objDb.IssueDate = objUI.IssueDate;
                            objDb.Gender = objUI.Gender;
                            objDb.Religion = objUI.Religion;
                            objDb.MarriedStatus = objUI.MarriedStatus;
                            objDb.STTStatusId = objUI.STTStatusId;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;
                            objDb.VnFirstName = objUI.VnFirstName;
                            objDb.Race = objUI.Race;
                            objDb.VnMiddleName = objUI.VnMiddleName;
                            objDb.VnPlaceOfOrigin = objUI.VnPlaceOfOrigin;
                            objDb.VnLastName = objUI.VnLastName;
                            objDb.VnPOB = objUI.VnPOB;
                            objDb.Degree = objUI.Degree;
                            objDb.OtherDegree = objUI.OtherDegree;
                            objDb.IDIssueLocation = objUI.IDIssueLocation;
                            objDb.VnIDIssueLocation = objUI.VnIDIssueLocation;
                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.ID + " " + objDb.FirstName + " " + objDb.MiddleName + " " + objDb.LastName + "'", "updated");
                        }
                    }
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
Ejemplo n.º 33
0
 private void UpdateForPromoted(STT objUI)
 {
     if (objUI != null)
     {
         STT objDb = GetById(objUI.ID);
         if (objDb != null)
         {
             new STTLogDao().WriteLogForUpdatePromoted(objUI, ELogAction.Update);
             objDb.STTStatusId =Constants.STT_STATUS_PROMOTED;
             dbContext.SubmitChanges();
         }
     }
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Write Log For STT
        /// </summary>
        /// <param name="oldInfo"></param>
        /// <param name="newInfo"></param>
        /// <param name="action"></param>
        public void WriteLogForSTT(STT oldInfo, STT newInfo, ELogAction action)
        {
            try
            {
                if (newInfo == null)
                {
                    return;
                }

                MasterLog objMasterLog = new MasterLog();

                string logId = commonDao.UniqueId;

                switch (action)
                {
                    case ELogAction.Insert:
                        // Insert to Master Log
                        commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.STT.ToString(), action.ToString());
                        // Write Insert Log
                        WriteInsertLogForSTT(newInfo, logId);
                        break;
                    case ELogAction.Update:
                        // Insert to Master Log
                        commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                        // Write Update Log
                        bool isUpdated = WriteUpdateLogForSTT(newInfo, logId);
                        if (!isUpdated)
                        {
                            commonDao.DeleteMasterLog(logId);
                        }
                        break;
                    case ELogAction.Delete:
                        // Insert to Master Log
                        commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                        // Write Delete Log
                        string key = newInfo.ID + " [" + newInfo.FirstName + " " + newInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "STT_ID", "Key for Delete", key, null);
                        break;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 35
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="objUI"></param>
 /// <returns></returns>
 public Message Insert(STT objUI)
 {
     Message msg = null;
     try
     {
         if (objUI != null)
         {
             objUI.DeleteFlag = false;
             dbContext.STTs.InsertOnSubmit(objUI);
             dbContext.SubmitChanges();
             //Write Log
             new STTLogDao().WriteLogForSTT(null, objUI, ELogAction.Insert);
             // Show success message
             msg = new Message(MessageConstants.I0001, MessageType.Info, objUI.ID + " " + objUI.FirstName + " " + objUI.MiddleName + " " + objUI.LastName + "'", "added");
         }
     }
     catch
     {
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
Ejemplo n.º 36
0
        private void Delete(STT objUI)
        {
            if (objUI != null)
            {
                // Get current group in dbContext
                STT objDb = GetById(objUI.ID);
                if (objDb != null)
                {
                    // Set delete info
                    objDb.DeleteFlag = true;
                    objDb.UpdateDate = DateTime.Now;
                    objDb.UpdatedBy = objUI.UpdatedBy;
                    // Submit changes to dbContext

                    new STTLogDao().WriteLogForSTT(null, objUI, ELogAction.Delete);
                    dbContext.SubmitChanges();
                }
            }
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Check update date whether is valid
        /// </summary>
        /// <param name="objUI"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private bool IsValidUpdateDate(STT objUI, STT objDb, out Message msg)
        {
            bool isValid = false;
            msg = null;

            try
            {
                if ((objUI != null) && (objUI.UpdateDate != null))
                {
                    if (objDb != null)
                    {
                        if (objDb.UpdateDate.ToString().Equals(objUI.UpdateDate.ToString()))
                        {
                            isValid = true;
                        }
                        else
                        {
                            msg = new Message(MessageConstants.E0025, MessageType.Error, "STT " + objDb.ID);
                        }
                    }
                }
            }
            catch
            {
                throw;
            }

            return isValid;
        }
Ejemplo n.º 38
0
        public static async System.Threading.Tasks.Task <string[]> WaitForWakeUpWordThenRecognizeRemainingSpeechAsync(string[] WakeUpWords)
        {
            Console.WriteLine("Say the wakeup word (" + string.Join(" ", WakeUpWords) + ") followed by the request ...");
            CallServices <ISpeechToTextService, ISpeechToTextServiceResponse> wSTT = new CallServices <ISpeechToTextService, ISpeechToTextServiceResponse>(null);

            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start(); // continues until return
            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(Options.options.locale.language);
            while (true)
            {
                using (System.Speech.Recognition.SpeechRecognitionEngine RecognitionEngine = new System.Speech.Recognition.SpeechRecognitionEngine(ci))
                {
                    RecognitionEngine.SetInputToDefaultAudioDevice();

                    // build wakeup word grammar
                    System.Speech.Recognition.GrammarBuilder wakeUpWordBuilder = new System.Speech.Recognition.GrammarBuilder();
                    wakeUpWordBuilder.Append(new System.Speech.Recognition.Choices(WakeUpWords));

                    // build words-after-wakeup word grammar
                    System.Speech.Recognition.GrammarBuilder wordsAfterWakeUpWordBuilder = new System.Speech.Recognition.GrammarBuilder();
                    wordsAfterWakeUpWordBuilder.AppendWildcard();
                    System.Speech.Recognition.SemanticResultKey wordsAfterWakeUpWordKey = new System.Speech.Recognition.SemanticResultKey("wordsAfterWakeUpWordKey", wordsAfterWakeUpWordBuilder);
                    wakeUpWordBuilder.Append(new System.Speech.Recognition.SemanticResultKey("wordsAfterWakeUpWordKey", wordsAfterWakeUpWordBuilder));

                    // initialize recognizer, wait for result, save result to file
                    System.Speech.Recognition.Grammar g = new System.Speech.Recognition.Grammar(wakeUpWordBuilder);
                    RecognitionEngine.LoadGrammar(g);
                    if (Options.options.wakeup.initialSilenceTimeout == -1)
                    {
                        RecognitionEngine.InitialSilenceTimeout = TimeSpan.FromTicks(Int32.MaxValue); // never timeout
                    }
                    else
                    {
                        RecognitionEngine.InitialSilenceTimeout = TimeSpan.FromSeconds(Options.options.wakeup.initialSilenceTimeout); // timesout after this much silence
                    }
                    RecognitionEngine.EndSilenceTimeout = TimeSpan.FromSeconds(Options.options.wakeup.endSilenceTimeout);             // maximum silence allowed after hearing wakeup word
#if true                                                                                                                              // experimenting with Babble and other timeouts
                    RecognitionEngine.BabbleTimeout = TimeSpan.FromSeconds(0);
#else
                    RecognitionEngine.BabbleTimeout = TimeSpan.FromTicks(UInt32.MaxValue);
#endif
                    System.Speech.Recognition.RecognitionResult WakeUpWordResult = RecognitionEngine.Recognize();
                    // RecognitionResult is null when some unidentified timeout expires around 30 seconds. Can't find a way to make timeouts infinite so just looping.
                    if (WakeUpWordResult == null)
                    {
                        continue;
                    }
                    using (System.IO.FileStream waveStream = new System.IO.FileStream(Options.options.tempFolderPath + Options.options.audio.speechSynthesisFileName, System.IO.FileMode.Create))
                    {
                        WakeUpWordResult.Audio.WriteToWaveStream(waveStream);
                        waveStream.Flush();
                        waveStream.Close();
                    }

                    Console.WriteLine("Wake up word detected (" + WakeUpWordResult.Words[0].Text + "): confidence:" + WakeUpWordResult.Confidence + " Elapsed Ms:" + stopWatch.ElapsedMilliseconds);
                    if (WakeUpWordResult.Confidence >= Options.options.wakeup.confidence)
                    {
                        byte[] bytes = await Helpers.ReadBytesFromFileAsync(Options.options.audio.speechSynthesisFileName);

                        string text       = WakeUpWordResult.Text;
                        int    sampleRate = await Audio.GetSampleRateAsync(Options.options.tempFolderPath + Options.options.audio.speechSynthesisFileName);

                        System.Collections.Generic.Dictionary <string, string> apiArgs = new System.Collections.Generic.Dictionary <string, string>()
                        {
                            { "sampleRate", sampleRate.ToString() }
                        };
#if false // for testing
                        await windows.SpeechToTextAsync(bytes, apiArgs);

                        Console.WriteLine("Windows STT (demo):\"" + windows.ResponseResult + "\" Total Elapsed ms:" + windows.TotalElapsedMilliseconds + " Request Elapsed ms:" + windows.RequestElapsedMilliseconds);
#endif
                        System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes);
                        foreach (ISpeechToTextService STT in new FindServices <ISpeechToTextService>(Options.commandservices["SpeechToText"].preferredServices).PreferredOrderingOfServices)
                        {
                            // ISpeechToTextService STT = (ISpeechToTextService)constructor.Invoke(Type.EmptyTypes);
                            SpeechToTextServiceResponse r = await STT.SpeechToTextServiceAsync(bytes, apiArgs);

                            if (r.StatusCode == 200)
                            {
                                text = r.ResponseResult;
                                Console.WriteLine(r.Service.name + ":\"" + text + "\" Total Elapsed ms:" + r.TotalElapsedMilliseconds + " Request Elapsed ms:" + r.RequestElapsedMilliseconds);
                                return(text.Split(" ".ToCharArray(), StringSplitOptions.None));
                            }
                            else
                            {
                                Console.WriteLine(r.Service.name + " not available.");
                            }
                        }
                        CallServiceResponse <ISpeechToTextServiceResponse> response = await wSTT.CallServiceAsync(bytes, apiArgs);

                        text = response.ResponseResult;
                        Console.WriteLine("Windows STT (default):\"" + text + "\" Total Elapsed ms:" + response.TotalElapsedMilliseconds + " Request Elapsed ms:" + response.RequestElapsedMilliseconds);
                        return(text.Split(" ".ToCharArray(), StringSplitOptions.None));
                    }
                }
            }
        }
Ejemplo n.º 39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newInfo"></param>
        /// <param name="action"></param>
        public void WriteLogForUpdatePosition(STT newInfo, ELogAction action)
        {
            try
            {
                bool isUpdated = false;
                if (newInfo == null)
                {
                    return;
                }
                MasterLog objMasterLog = new MasterLog();
                string logId = commonDao.UniqueId;
                commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString());
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.ManagerId != oldInfo.ManagerId)
                    {
                        commonDao.InsertLogDetail(logId, "Manager", "Manager", oldInfo.ManagerId, newInfo.ManagerId);
                        isUpdated = true;
                    }
                    if (newInfo.Project != oldInfo.Project)
                    {
                        commonDao.InsertLogDetail(logId, "Project", "Project", oldInfo.Project, newInfo.Project);
                        isUpdated = true;
                    }
                    if (newInfo.Floor != oldInfo.Floor)
                    {
                        commonDao.InsertLogDetail(logId, "Floor", "Floor", oldInfo.Floor, newInfo.Floor);
                        isUpdated = true;
                    }
                    if (newInfo.SeatCode != oldInfo.SeatCode)
                    {
                        commonDao.InsertLogDetail(logId, "SeatCode", "SeatCode", oldInfo.SeatCode, newInfo.SeatCode);
                        isUpdated = true;
                    }
                    if (newInfo.LocationCode != oldInfo.LocationCode)
                    {
                        commonDao.InsertLogDetail(logId, "LocationCode", "LocationCode", CommonFunc.GenerateStringOfLocation(oldInfo.LocationCode), CommonFunc.GenerateStringOfLocation(newInfo.LocationCode));
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                    else
                    {
                        commonDao.DeleteMasterLog(logId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 40
0
        public Message UpdatePosition(STT objUI, bool onlyLocation = false)
        {
            Message msg = null;
            try
            {
                STT stt = GetById(objUI.ID);
                if (stt != null)
                {
                    new STTLogDao().WriteLogForUpdatePosition(objUI, ELogAction.Update);
                    if (!onlyLocation)
                    {
                        stt.ManagerId = objUI.ManagerId;
                        stt.Project = objUI.Project;
                    }
                    stt.Floor = objUI.Floor;
                    stt.SeatCode = objUI.SeatCode;
                    stt.LocationCode = objUI.LocationCode;
                    dbContext.SubmitChanges();
                    msg = new Message(MessageConstants.I0001, MessageType.Info, "STT " + stt.ID, "updated");
                }
            }
            catch
            {
                msg = new Message(MessageConstants.E0033, MessageType.Error);
            }

            return msg;
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Write Update Log For STT
        /// </summary>
        /// <param name="newInfo"></param>
        /// <param name="logId"></param>
        /// <returns></returns>
        private bool WriteUpdateLogForSTT(STT newInfo, string logId)
        {
            bool isUpdated = false;
            try
            {
                // Get old info
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.IDNumber != oldInfo.IDNumber)
                    {
                        commonDao.InsertLogDetail(logId, "IDNumber", "ID Number", oldInfo.IDNumber, newInfo.IDNumber);
                        isUpdated = true;
                    }
                    if (newInfo.LastName != oldInfo.LastName)
                    {
                        commonDao.InsertLogDetail(logId, "LastName", "Last Name", oldInfo.LastName, newInfo.LastName);
                        isUpdated = true;
                    }
                    if (newInfo.Project != oldInfo.Project)
                    {
                        commonDao.InsertLogDetail(logId, "Project", "Project", oldInfo.Project, newInfo.Project);
                        isUpdated = true;
                    }
                    if (newInfo.ManagerId != oldInfo.ManagerId)
                    {
                        commonDao.InsertLogDetail(logId, "Manager", "Manager", oldInfo.ManagerId, newInfo.ManagerId);
                        isUpdated = true;
                    }
                    if (newInfo.Major != oldInfo.Major)
                    {
                        commonDao.InsertLogDetail(logId, "Major", "Major", oldInfo.Major, newInfo.Major);
                        isUpdated = true;
                    }
                    if (newInfo.MiddleName != oldInfo.MiddleName)
                    {
                        commonDao.InsertLogDetail(logId, "MiddleName", "Middle Name", oldInfo.MiddleName, newInfo.MiddleName);
                        isUpdated = true;
                    }
                    if (newInfo.FirstName != oldInfo.FirstName)
                    {
                        commonDao.InsertLogDetail(logId, "FirstName", "First Name", oldInfo.FirstName, newInfo.FirstName);
                        isUpdated = true;
                    }
                    if (newInfo.VnFirstName != oldInfo.VnFirstName)
                    {
                        commonDao.InsertLogDetail(logId, "VnFirstName", "Vn First Name", oldInfo.VnFirstName, newInfo.VnFirstName);
                        isUpdated = true;
                    }
                    if (newInfo.VnMiddleName != oldInfo.VnMiddleName)
                    {
                        commonDao.InsertLogDetail(logId, "VnMiddleName", "Vn Middle Name", oldInfo.VnMiddleName, newInfo.VnMiddleName);
                        isUpdated = true;
                    }
                    if (newInfo.VnLastName != oldInfo.VnLastName)
                    {
                        commonDao.InsertLogDetail(logId, "VnLastName", "Vn Last Name", oldInfo.VnLastName, newInfo.VnLastName);
                        isUpdated = true;
                    }
                    if (newInfo.VnPOB != oldInfo.VnPOB)
                    {
                        commonDao.InsertLogDetail(logId, "VnPOB", "Vn Place Of Birth", oldInfo.VnPOB, newInfo.VnPOB);
                        isUpdated = true;
                    }
                    if (newInfo.VnPlaceOfOrigin != oldInfo.VnPlaceOfOrigin)
                    {
                        commonDao.InsertLogDetail(logId, "VnPlaceOfOrigin", "Vn Place Of Origin", oldInfo.VnPlaceOfOrigin, newInfo.VnPlaceOfOrigin);
                        isUpdated = true;
                    }
                    if (newInfo.Degree != oldInfo.Degree)
                    {
                        commonDao.InsertLogDetail(logId, "Degree", "Degree", oldInfo.Degree, newInfo.Degree);
                        isUpdated = true;
                    }
                    if (newInfo.OtherDegree != oldInfo.OtherDegree)
                    {
                        commonDao.InsertLogDetail(logId, "OtherDegree", "OtherDegree", oldInfo.OtherDegree, newInfo.OtherDegree);
                        isUpdated = true;
                    }
                    if (newInfo.Race != oldInfo.Race)
                    {
                        commonDao.InsertLogDetail(logId, "Race", "Race", oldInfo.Race, newInfo.Race);
                        isUpdated = true;
                    }
                     if (newInfo.IDIssueLocation != oldInfo.IDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "IDIssueLocation", "Issue Location", oldInfo.IDIssueLocation, newInfo.IDIssueLocation);
                        isUpdated = true;
                    }
                    if (newInfo.VnIDIssueLocation != oldInfo.VnIDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "VnIDIssueLocation", "Vn Issue Location", oldInfo.VnIDIssueLocation, newInfo.VnIDIssueLocation);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentAddress != oldInfo.VnPermanentAddress)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentAddress", "Vn Permanent Address", oldInfo.VnPermanentAddress, newInfo.VnPermanentAddress);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentArea != oldInfo.VnPermanentArea)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentArea", "Vn Permanent Area", oldInfo.VnPermanentArea, newInfo.VnPermanentArea);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentDistrict != oldInfo.VnPermanentDistrict)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentDistrict", "Vn Permanent District", oldInfo.VnPermanentDistrict, newInfo.VnPermanentDistrict);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentCityProvince != oldInfo.VnPermanentCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentCityProvince", "Vn Permanent City Province", oldInfo.VnPermanentCityProvince, newInfo.VnPermanentCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.VnPermanentCountry != oldInfo.VnPermanentCountry)
                    {
                        commonDao.InsertLogDetail(logId, "VnPermanentCountry", "Vn Permanent Country", oldInfo.VnPermanentCountry, newInfo.VnPermanentCountry);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempAddress != oldInfo.VnTempAddress)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempAddress", "Vn Temp Address", oldInfo.VnTempAddress, newInfo.VnTempAddress);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempArea != oldInfo.VnTempArea)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempArea", "Vn Temp Area", oldInfo.VnTempArea, newInfo.VnTempArea);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempCityProvince != oldInfo.VnTempCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempCityProvince", "Vn Temp City Province", oldInfo.VnTempCityProvince, newInfo.VnTempCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.VnTempCountry != oldInfo.VnTempCountry)
                    {
                        commonDao.InsertLogDetail(logId, "VnTempCountry", "Vn Temp Country", oldInfo.VnTempCountry, newInfo.VnTempCountry);
                        isUpdated = true;
                    }
                    if (newInfo.Gender != oldInfo.Gender)
                    {
                        commonDao.InsertLogDetail(logId, "Gender", "Gender",oldInfo.Gender.HasValue?oldInfo.Gender.Value == Constants.MALE ? "Male" : "Female":"",newInfo.Gender.HasValue?newInfo.Gender.Value == Constants.MALE ? "Male" : "Female":"");
                        isUpdated = true;
                    }
                    if (newInfo.StartDate != oldInfo.StartDate)
                    {
                        commonDao.InsertLogDetail(logId, "StartDate", "Start Date", oldInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW), newInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW));
                        isUpdated = true;
                    }
                    if (newInfo.ExpectedEndDate != oldInfo.ExpectedEndDate)
                    {
                        commonDao.InsertLogDetail(logId, "ExpectedEndDate", "Expected End Date",oldInfo.ExpectedEndDate.HasValue?oldInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.ExpectedEndDate.HasValue? newInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.Photograph != oldInfo.Photograph)
                    {
                        commonDao.InsertLogDetail(logId, "Photograph", "Photograph", oldInfo.Photograph, newInfo.Photograph);
                        isUpdated = true;
                    }
                    if (newInfo.JR != oldInfo.JR)
                    {
                        commonDao.InsertLogDetail(logId, "JobRequest", "Job Request", oldInfo.JR, newInfo.JR);
                        isUpdated = true;
                    }
                    if (newInfo.JRApproval != oldInfo.JRApproval)
                    {
                        commonDao.InsertLogDetail(logId, "JobRequestApproval", "Job Request Approval", oldInfo.JRApproval, newInfo.JRApproval);
                        isUpdated = true;
                    }
                    if (newInfo.TempAddress != oldInfo.TempAddress)
                    {
                        commonDao.InsertLogDetail(logId, "TempAddress", "Temp Address", oldInfo.TempAddress, newInfo.TempAddress);
                        isUpdated = true;
                    }
                    if (newInfo.TempArea != oldInfo.TempArea)
                    {
                        commonDao.InsertLogDetail(logId, "TempArea", "Temp Area", oldInfo.TempArea, newInfo.TempArea);
                        isUpdated = true;
                    }
                    if (newInfo.TempDistrict != oldInfo.TempDistrict)
                    {
                        commonDao.InsertLogDetail(logId, "TempDistrict", "Temp District", oldInfo.TempDistrict, newInfo.TempDistrict);
                        isUpdated = true;
                    }
                    if (newInfo.TempCityProvince != oldInfo.TempCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "TempCityProvince", "Temp City Province", oldInfo.TempCityProvince, newInfo.TempCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.TempCountry != oldInfo.TempCountry)
                    {
                        commonDao.InsertLogDetail(logId, "TempCountry", "Temp Country", oldInfo.TempCountry, newInfo.TempCountry);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentAddress != oldInfo.PermanentAddress)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentAddress", "Permanent Address", oldInfo.PermanentAddress, newInfo.PermanentAddress);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentArea != oldInfo.PermanentArea)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentArea", "Permanent Area", oldInfo.PermanentArea, newInfo.PermanentArea);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentDistrict != oldInfo.PermanentDistrict)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentDistrict", "Permanent District", oldInfo.PermanentDistrict, newInfo.PermanentDistrict);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentCityProvince != oldInfo.PermanentCityProvince)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentCityProvince", "Permanent City Province", oldInfo.PermanentCityProvince, newInfo.PermanentCityProvince);
                        isUpdated = true;
                    }
                    if (newInfo.PermanentCountry != oldInfo.PermanentCountry)
                    {
                        commonDao.InsertLogDetail(logId, "PermanentCountry", "Permanent Country ", oldInfo.PermanentCountry, newInfo.PermanentCountry);
                        isUpdated = true;
                    }
                    if (newInfo.HomePhone != oldInfo.HomePhone)
                    {
                        commonDao.InsertLogDetail(logId, "HomePhone", "Home Phone", oldInfo.HomePhone, newInfo.HomePhone);
                        isUpdated = true;
                    }
                    if (newInfo.CellPhone != oldInfo.CellPhone)
                    {
                        commonDao.InsertLogDetail(logId, "CellPhone", "Cell Phone", oldInfo.CellPhone, newInfo.CellPhone);
                        isUpdated = true;
                    }
                    if (newInfo.PersonalEmail != oldInfo.PersonalEmail)
                    {
                        commonDao.InsertLogDetail(logId, "PersonalEmail", "Personal Email", oldInfo.PersonalEmail, newInfo.PersonalEmail);
                        isUpdated = true;
                    }
                    if (newInfo.OfficeEmail != oldInfo.OfficeEmail)
                    {
                        commonDao.InsertLogDetail(logId, "OfficeEmail", "Office Email", oldInfo.OfficeEmail, newInfo.OfficeEmail);
                        isUpdated = true;
                    }
                    if (newInfo.ExtensionNumber != oldInfo.ExtensionNumber)
                    {
                        commonDao.InsertLogDetail(logId, "ExtensionNumber", "Extension Number", oldInfo.ExtensionNumber, newInfo.ExtensionNumber);
                        isUpdated = true;
                    }
                    if (newInfo.DOB != oldInfo.DOB)
                    {
                        commonDao.InsertLogDetail(logId, "DOB", "Date Of Birth",oldInfo.DOB.HasValue?oldInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.DOB.HasValue?newInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.POB != oldInfo.POB)
                    {
                        commonDao.InsertLogDetail(logId, "POB", "Place Of Birth", oldInfo.POB, newInfo.POB);
                        isUpdated = true;
                    }
                    if (newInfo.Nationality != oldInfo.Nationality)
                    {
                        commonDao.InsertLogDetail(logId, "Nationality", "Nationality", oldInfo.Nationality, newInfo.Nationality);
                        isUpdated = true;
                    }
                    if (newInfo.PlaceOfOrigin != oldInfo.PlaceOfOrigin)
                    {
                        commonDao.InsertLogDetail(logId, "PlaceOfOrigin", "Place Of Origin", oldInfo.PlaceOfOrigin, newInfo.PlaceOfOrigin);
                        isUpdated = true;
                    }
                    if (newInfo.IssueDate != oldInfo.IssueDate)
                    {
                        commonDao.InsertLogDetail(logId, "IssueDate", "Issue Date",oldInfo.IssueDate.HasValue? oldInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.IssueDate.HasValue?newInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.BankAccount != oldInfo.BankAccount)
                    {
                        commonDao.InsertLogDetail(logId, "BankAccount", "Bank Account", oldInfo.BankAccount, newInfo.BankAccount);
                        isUpdated = true;
                    }
                    if (newInfo.BankName != oldInfo.BankName)
                    {
                        commonDao.InsertLogDetail(logId, "BankName", "Bank Name", oldInfo.BankName, newInfo.BankName);
                        isUpdated = true;
                    }
                    if (newInfo.ResignedDate != oldInfo.ResignedDate)
                    {
                        commonDao.InsertLogDetail(logId, "ResignedDate", "Resigned Date", oldInfo.ResignedDate.HasValue ? oldInfo.ResignedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "", newInfo.ResignedDate.HasValue?newInfo.ResignedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.ResignedReason != oldInfo.ResignedReason)
                    {
                        commonDao.InsertLogDetail(logId, "ResignedReason", "Resigned Reason", oldInfo.ResignedReason, newInfo.ResignedReason);
                        isUpdated = true;
                    }
                    if (newInfo.ResignedAllowance != oldInfo.ResignedAllowance)
                    {
                        commonDao.InsertLogDetail(logId, "ResignedAllowance", "Resigned Allowance",oldInfo.ResignedAllowance.HasValue?oldInfo.ResignedAllowance.ToString():"", newInfo.ResignedAllowance.HasValue?newInfo.ResignedAllowance.ToString():"");
                        isUpdated = true;
                    }
                    if (newInfo.LaborUnion != oldInfo.LaborUnion)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnion", "Labor Union",oldInfo.LaborUnion.HasValue? oldInfo.LaborUnion.Value == Constants.LABOR_UNION_FALSE ? "No" : "Yes":"",newInfo.LaborUnion.HasValue?newInfo.LaborUnion.Value == Constants.LABOR_UNION_FALSE ? "No" : "Yes":"");
                        isUpdated = true;
                    }
                    if (newInfo.LaborUnionDate != oldInfo.LaborUnionDate)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnionDate", "Labor Union Date", oldInfo.LaborUnionDate.HasValue ? oldInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "", newInfo.LaborUnionDate.HasValue ? newInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "");
                        isUpdated = true;
                    }
                    if (newInfo.Remarks != oldInfo.Remarks)
                    {
                        commonDao.InsertLogDetail(logId, "Remarks", "Remarks", oldInfo.Remarks, newInfo.Remarks);
                        isUpdated = true;
                    }
                    if (newInfo.MarriedStatus != oldInfo.MarriedStatus)
                    {
                        commonDao.InsertLogDetail(logId, "Married Status", "Married Status",oldInfo.MarriedStatus.HasValue?oldInfo.MarriedStatus.Value == Constants.SINGLE ? "Single" : "Married":"",newInfo.MarriedStatus.HasValue?newInfo.MarriedStatus.Value == Constants.SINGLE ? "Single" : "Married":"");
                        isUpdated = true;
                    }
                    if (newInfo.Religion != oldInfo.Religion)
                    {
                        commonDao.InsertLogDetail(logId, "Religion", "Religion", oldInfo.Religion, newInfo.Religion);
                        isUpdated = true;
                    }
                    if (newInfo.EmergencyContactName != oldInfo.EmergencyContactName)
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactName", "Emergency Contact Name", oldInfo.EmergencyContactName, newInfo.EmergencyContactName);
                        isUpdated = true;
                    }
                    if (newInfo.EmergencyContactPhone != oldInfo.EmergencyContactPhone)
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactPhone", "Emergency Contact Phone", oldInfo.EmergencyContactPhone, newInfo.EmergencyContactPhone);
                        isUpdated = true;
                    }
                    if (newInfo.EmergencyContactRelationship != oldInfo.EmergencyContactRelationship)
                    {
                        commonDao.InsertLogDetail(logId, "EmergencyContactRelationship", "Emergency Contact Relationship", oldInfo.EmergencyContactRelationship, newInfo.EmergencyContactRelationship);
                        isUpdated = true;
                    }
                    if (newInfo.DepartmentId != oldInfo.DepartmentId)
                    {
                        DepartmentDao departDao = new DepartmentDao();
                        Department objDepart = departDao.GetById(newInfo.DepartmentId);
                        if (objDepart != null)
                        {
                            commonDao.InsertLogDetail(logId, "DepartmentId", "Department", oldInfo.Department.DepartmentName, objDepart.DepartmentName);
                            commonDao.InsertLogDetail(logId, "Department", "Department", new DepartmentDao().GetDepartmentNameBySub(oldInfo.DepartmentId), new DepartmentDao().GetDepartmentNameBySub(newInfo.DepartmentId));
                            isUpdated = true;
                        }
                    }
                    if (newInfo.SkypeId != oldInfo.SkypeId)
                    {
                        commonDao.InsertLogDetail(logId, "SkypeId", "SkypeId", oldInfo.SkypeId, newInfo.SkypeId);
                        isUpdated = true;
                    }
                    if (newInfo.YahooId != oldInfo.YahooId)
                    {
                        commonDao.InsertLogDetail(logId, "YahooId", "YahooId", oldInfo.YahooId, newInfo.YahooId);
                        isUpdated = true;
                    }
                    if (newInfo.LocationCode != oldInfo.LocationCode)
                    {
                        commonDao.InsertLogDetail(logId, "LocationCode", "LocationCode", CommonFunc.GenerateStringOfLocation(oldInfo.LocationCode), CommonFunc.GenerateStringOfLocation(newInfo.LocationCode));
                        isUpdated = true;
                    }
                    if (newInfo.CVFile != oldInfo.CVFile)
                    {
                        commonDao.InsertLogDetail(logId, "CVFile", "CVFile", oldInfo.CVFile, newInfo.CVFile);
                        isUpdated = true;
                    }
                    if (newInfo.STTStatusId != oldInfo.STTStatusId)
                    {
                        commonDao.InsertLogDetail(logId, "STTStatusId", "STT Status", oldInfo.STT_Status.Name, new STTStatusDao().GetById(newInfo.STTStatusId).Name);
                        isUpdated = true;
                    }
                    if (isUpdated)
                    {
                        // Insert Key Name
                        string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]";
                        commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return isUpdated;
        }