Ejemplo n.º 1
0
        /// <summary>
        /// Function to Continue Find Period Popup & Fill selected to the buffer.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 24,2016</createdOn>
        private void Continue(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                if (SelectedDisRecipientGridItem != null)
                {
                    DelegateEventCodeAdmin.SetCodeAdminValueMethod(SelectedDisRecipientGridItem);
                    //DelegateEventVehicle.SetValueMethodCmd("Add");
                    OnCloseWindowRequested();
                    //DelegateEventCodeAdmin.SetValueMethodEnableNew("EnableNew");
                }
                else
                {
                    MessageBox.Show(Resources.MsgSelectUser);
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Function to FIll Customer Data on row selection.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 10,2016</createdOn>
        private void FillData(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                DelegateEventCodeAdmin.SetCodeAdminValueMethod(SelectedDisRecipientGridItem);
                DelegateEventCodeAdmin.SetValueMethodEnableNew("EnableNew");
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This function is used to insert code admin details in database
        /// </summary>
        /// <param name="obj"></param>
        public void InsertCode(object obj)
        {
            try
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));

                CodeProp objCodeProp = new CodeProp();
                objCodeProp.CodeID            = CodeID;
                objCodeProp.RecordStatus      = RecordStatus;
                objCodeProp.CodeType          = CodeType;
                objCodeProp.Code1             = Code1;
                objCodeProp.Value1            = Value1;
                objCodeProp.Value2            = Value2;
                objCodeProp.CodeDescription   = CodeDescription;
                objCodeProp.Value1Description = Value1Description;
                objCodeProp.Value2Description = Value2Description;
                objCodeProp.SortOrder         = SortOrder;
                objCodeProp.CreationDate      = CreationDate;
                objCodeProp.CreatedBy         = CreatedBy;

                if (CodeID > 0)
                {
                    objCodeProp.UpdatedBy   = Application.Current.Properties["LoggedInUserName"].ToString();
                    objCodeProp.UpdatedDate = DateTime.Now;
                    if (!string.IsNullOrEmpty(CodeType))
                    {
                        if (!string.IsNullOrEmpty(Code1))
                        {
                            bool result = _serviceInstance.ModifyCodeAdminRecord(objCodeProp);

                            if (result)
                            {
                                DelegateEventCodeAdmin.SetCodeAdminValueMethodCmdReferesh(objCodeProp);
                                MessageBox.Show(Resources.msgUpdatedSuccessfully);
                                //ResetCodeAdminWindow();
                                IsReadOnly           = false;
                                IsReadOnlyButton     = false;
                                isReadOnlyButtonSave = false;
                                EnabledCancel        = false;
                                EnabledFind          = true;
                                if (CodeID > 0)
                                {
                                    EnabledDelete = true;
                                    EnabledModify = true;
                                }
                                else
                                {
                                    EnabledDelete = false;
                                    EnabledModify = false;
                                }
                                EnabledNew        = true;
                                EnabledSaveUpdate = false;

                                Text = Resources.btnSave;

                                AcceptChanges();
                            }
                            else
                            {
                                MessageBox.Show(Resources.ErrorToUpdate);
                            }
                        }
                        else
                        {
                            MessageBox.Show(Resources.ErrorEnterCode);
                        }
                    }
                    else
                    {
                        MessageBox.Show(Resources.MsgSelectCodeType);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(CodeType))
                    {
                        if (!string.IsNullOrEmpty(Code1))
                        {
                            bool isValidRecord = false;

                            isValidRecord = _serviceInstance.CheckDuplicateCodeAndType(Code1, CodeType);

                            if (isValidRecord)
                            {
                                int data = _serviceInstance.AddCodeAdmin(objCodeProp);

                                if (data > 0)
                                {
                                    MessageBox.Show(Resources.msgInsertedSuccessfully);
                                    CodeID               = data;
                                    IsReadOnly           = false;
                                    IsReadOnlyButton     = false;
                                    isReadOnlyButtonSave = false;
                                    EnabledCancel        = false;
                                    EnabledFind          = true;
                                    if (CodeID > 0)
                                    {
                                        EnabledDelete = true;
                                        EnabledModify = true;
                                    }
                                    else
                                    {
                                        EnabledDelete = false;
                                        EnabledModify = false;
                                    }
                                    EnabledNew        = true;
                                    EnabledSaveUpdate = false;
                                    Text = Resources.btnSave;
                                    AcceptChanges();
                                }

                                else
                                {
                                    MessageBox.Show(Resources.ErrorInserted);
                                }
                            }
                            else
                            {
                                MessageBox.Show(Resources.ErrorDuplicateCode);
                            }
                        }
                        else
                        {
                            MessageBox.Show(Resources.ErrorEnterCode);
                        }
                    }
                    else
                    {
                        MessageBox.Show(Resources.MsgSelectCodeType);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }