Пример #1
0
        public static void Log(Exception error, bool showError)
        {
            try
            {
                string logFile = Application.StartupPath + @"\Error.log";

                using (StreamWriter sw = new StreamWriter(logFile, true))
                {
                    sw.WriteLine("<--------------------------------------->");
                    sw.WriteLine(String.Format("Date/Time:{0}", DateTime.Now));
                    sw.WriteLine("Message:");
                    sw.WriteLine(error.Message);
                    sw.WriteLine("Help Link:");
                    sw.WriteLine(error.HelpLink);
                    sw.WriteLine("Source:");
                    sw.WriteLine(error.Source);
                    sw.WriteLine("Stack Trace:");
                    sw.WriteLine(error.StackTrace);
                    sw.WriteLine("Target Site:");
                    sw.WriteLine(error.TargetSite);
                    sw.WriteLine("<--------------------------------------->");
                    sw.WriteLine();
                    sw.WriteLine();
                }

                if (showError)
                {
                    MessageBox.Show(error.Message, TextRes.Get("Error", Program.ci), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch { }
        }
Пример #2
0
        bool ValidateForm()
        {
            bool error = false;

            if (tbUsername.Text.Trim().Length > 0)
            {
                epError.SetError(tbUsername, "");
            }
            else
            {
                epError.SetError(tbUsername, TextRes.Get("Required", Program.ci));
                error = true;
            }

            if (tbPassword.Text.Trim().Length > 0)
            {
                epError.SetError(tbPassword, "");
            }
            else
            {
                epError.SetError(tbPassword, TextRes.Get("Required", Program.ci));
                error = true;
            }
            return(error);
        }
 private void SetUIControlText()
 {
     try
     {
         this.Text = TextRes.Get("frmPopulateDrum_Title", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #4
0
 private void SetUIControlText()
 {
     try
     {
         this.Text   = TextRes.Get("frmDraw_Title", Program.ci);
         initialText = TextRes.Get("WinnerDrawn", Program.ci) + "\r\n" + player.PlayerName;
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
 private void SetUIControlText()
 {
     try
     {
         this.Text   = TextRes.Get("Promotions", Program.ci);
         label1.Text = TextRes.Get("PleaseWait", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #6
0
 private void SetUIControlText()
 {
     try
     {
         this.cbOK.Text      = TextRes.Get("ResetConfirm", Program.ci);
         this.btnOK.Text     = TextRes.Get("OK", Program.ci);
         this.btnCancel.Text = TextRes.Get("Cancel", Program.ci);
         this.Text           = TextRes.Get("frmResetDrawing_Title", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #7
0
 private void SetUIControlText()
 {
     try
     {
         label1.Text            = TextRes.Get("CompleteDrawingMessage", Program.ci);
         cbCompleteDrawing.Text = TextRes.Get("CompleteDrawingConfirm", Program.ci);
         btnOK.Text             = TextRes.Get("OK", Program.ci);
         btnCancel.Text         = TextRes.Get("Cancel", Program.ci);
         this.Text = TextRes.Get("frmCompleteDrawing_Title", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #8
0
 private void SetUIControlText()
 {
     try
     {
         this.Text           = TextRes.Get("frmLogin_Title", Program.ci);
         lblUsername.Text    = TextRes.Get("Username", Program.ci);
         lblPassword.Text    = TextRes.Get("Password", Program.ci);
         cbUseAnimation.Text = TextRes.Get("UseAnimation", Program.ci);
         btnLogin.Text       = TextRes.Get("Login", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #9
0
 private void SetUIControlText()
 {
     try
     {
         this.Text = TextRes.Get("About", Program.ci) + " " + TextRes.Get("frmAbout_Title", Program.ci);
         this.labelProductName.Text   = TextRes.Get("ProductName", Program.ci);
         this.labelVersion.Text       = AssemblyVersion;
         this.labelCopyright.Text     = TextRes.Get("Copyright", Program.ci);
         this.labelCompanyName.Text   = TextRes.Get("CompanyName", Program.ci);
         this.textBoxDescription.Text = TextRes.Get("Description", Program.ci);
         this.okButton.Text           = TextRes.Get("OK", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #10
0
 void labelTimer_Tick(object sender, EventArgs e)
 {
     if (autoPostDelay > 0)
     {
         this.label1.Text = initialText + "\r\n" + String.Format(TextRes.Get("AutoPosting", Program.ci), autoPostDelay);
         autoPostDelay--;
     }
     else
     {
         labelTimer.Enabled = false;
         this.PostWinnerAndStartCountdown(player);
         this.Dispose();
     }
 }
 void UpdateStatsCallback(string drumName, string drumType, string lastPopulated, Int32 players, Int32 entries)
 {
     Service.DCService service = new DrawingClient.Service.DCService();
     dgvDrumHistory.DataSource = service.GetDrumHistory(drawingGroup.PromoId, drawingGroup.BucketId).Tables[0].DefaultView;
     tbDrumName.Text           = drumName;
     tbDrumType.Text           = drumType;
     if (Convert.ToDateTime(lastPopulated) == SqlDateTime.MinValue)
     {
         tbLastPopulated.Text = TextRes.Get("Never", Program.ci);
     }
     else
     {
         tbLastPopulated.Text = DateTime.Parse(lastPopulated).ToString(Program.ci);
     }
     tbPlayers.Text = players.ToString("N0");
     tbEntries.Text = entries.ToString("N0");
 }
        private void frmPopulateDrum_Load(object sender, EventArgs e)
        {
            anim = Properties.Resources.PopulatingDrum;
            ImageAnimator.Animate(anim, new EventHandler(Animate));
            lblAction.Text = TextRes.Get("PopulatingDrum", Program.ci);
            try
            {
                Guid requestId            = Guid.NewGuid();
                Service.DCService service = new DrawingClient.Service.DCService();
                service.PopulateDrumCompleted += new DrawingClient.Service.PopulateDrumCompletedEventHandler(DCService_PopulateDrumCompleted);

                //Common.Instance.DCService.PopulateDrumAsync(_promotionId, _bucketId, _drawDate, DateTime.Now, _checkinStartTime, _checkinEndTime, Common.Instance.UserID, _promotionId);
                service.PopulateDrumAsync(_promotionId, _bucketId, _drawDate, DateTime.Now, _checkinStartTime, _checkinEndTime, Common.Instance.UserID, _promotionId);
                //service.PopulateDrum(_promotionId, _bucketId, _drawDate, DateTime.Now, _checkinStartTime, _checkinEndTime, Common.Instance.UserID);
            }
            catch (Exception ex) { Error.Log(ex, true); }
        }
 private void frmDrumHistory_Load(object sender, EventArgs e)
 {
     Service.DCService service = new DrawingClient.Service.DCService();
     dgvDrumHistory.DataSource = service.GetDrumHistory(drawingGroup.PromoId, drawingGroup.BucketId).Tables[0].DefaultView;
     Service.Drum drum = service.GetDrumLastHistoryItem(drawingGroup.PromoId, drawingGroup.BucketId);
     tbDrumName.Text = drawingGroup.Drum.Name;
     tbDrumType.Text = TextRes.Get(drawingGroup.Drum.Type, Program.ci);
     if (Convert.ToDateTime(drum.LastPopulated.ToString()) == SqlDateTime.MinValue)
     {
         tbLastPopulated.Text = TextRes.Get("Never", Program.ci);
     }
     else
     {
         tbLastPopulated.Text = drum.LastPopulated.ToString(Program.ci);
     }
     tbPlayers.Text = drum.NumberOfPlayers.ToString("N0");
     tbEntries.Text = drum.NumberOfEntries.ToString("N0");
 }
 private void SetUIControlText()
 {
     try
     {
         this.Column1.HeaderText = TextRes.Get("DateTime", Program.ci);
         this.Column1.DefaultCellStyle.FormatProvider = Program.ci;
         this.Column4.HeaderText = TextRes.Get("Id", Program.ci);
         this.Column5.HeaderText = TextRes.Get("PromotionId", Program.ci);
         this.Column6.HeaderText = TextRes.Get("BucketId", Program.ci);
         this.Column2.HeaderText = TextRes.Get("NumberofEntries", Program.ci);
         this.Column3.HeaderText = TextRes.Get("NumberofPlayers", Program.ci);
         this.Text           = TextRes.Get("frmDrumHistory_Title", Program.ci);
         this.groupBox2.Text = TextRes.Get("DrumPanel", Program.ci);
         this.label1.Text    = TextRes.Get("DrumName", Program.ci);
         this.label5.Text    = TextRes.Get("Entries", Program.ci);
         this.label6.Text    = TextRes.Get("Players", Program.ci);
         this.label3.Text    = TextRes.Get("LastPopulated", Program.ci);
         this.label4.Text    = TextRes.Get("DrumType", Program.ci);
         this.groupBox1.Text = TextRes.Get("HistoryPanel", Program.ci);
     }
     catch (Exception ex) { Error.Log(ex, true); }
 }
Пример #15
0
        void Login()
        {
            if (!ValidateForm())
            {
                tbUsername.Enabled     = false;
                tbPassword.Enabled     = false;
                cbUseAnimation.Enabled = false;
                btnLogin.Enabled       = false;
                try
                {
                    Service.DCService service = new DrawingClient.Service.DCService();

                    if (!((Service.DrawingClientStatus)service.GetDrawingClientInUse()).DrawingClientInUse)
                    {
                        Service.User user = service.ValidateUser(tbUsername.Text, tbPassword.Text);
                        if (user != null)
                        {
                            //MR 12/22/09 Adding this code to deal with locked accounts.
                            if (user.LoginStatus == "LCK")
                            {
                                MessageBox.Show(TextRes.Get("LockedAccount", Program.ci), TextRes.Get("Login", Program.ci), MessageBoxButtons.OK, MessageBoxIcon.Error);
                                tbUsername.Enabled     = true;
                                tbPassword.Enabled     = true;
                                cbUseAnimation.Enabled = true;
                                btnLogin.Enabled       = true;
                            }
                            else
                            {
                                Common.Instance.UserID       = user.UserID;
                                Common.Instance.UserIDText   = user.UserIDText;
                                Common.Instance.UserLevel    = user.UserLevel;
                                Common.Instance.UseAnimation = cbUseAnimation.Checked;
                                service.SetDrawingClientInUse("DrawingClientOpen", tbUsername.Text);
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show(TextRes.Get("InvalidLogin", Program.ci), TextRes.Get("Login", Program.ci), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            tbUsername.Enabled     = true;
                            tbPassword.Enabled     = true;
                            cbUseAnimation.Enabled = true;
                            btnLogin.Enabled       = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(TextRes.Get("DrawingClientInUse", Program.ci), TextRes.Get("Login", Program.ci), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        tbUsername.Enabled     = true;
                        tbPassword.Enabled     = true;
                        cbUseAnimation.Enabled = true;
                        btnLogin.Enabled       = true;
                    }
                }
                catch (Exception ex)
                {
                    Error.Log(ex, true);
                    tbUsername.Enabled     = true;
                    tbPassword.Enabled     = true;
                    cbUseAnimation.Enabled = true;
                    btnLogin.Enabled       = true;
                }
            }
            else
            {
                error = true;
            }
        }