Beispiel #1
0
        /// <summary>
        /// 删除数据
        /// </summary>
        private void Delete()
        {
            long Id = -1;

            try
            {
                //确认删除
                var confirm = KryptonMessageBox.Show(this, Resources.GetRes().GetString("SureDelete"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (confirm != DialogResult.Yes)
                {
                    return;
                }

                Id = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString());

                //如果是没添加过的记录,就直接删除
                if (Id == -1)
                {
                    KryptonMessageBox.Show(this, Resources.GetRes().GetString("DeleteSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    krpdgList.Rows.Remove(krpdgList.SelectedRows[0]);
                    return;
                }


                //如果已经有使用,则提示并拒绝删除
                if (Resources.GetRes().Pprs.Where(x => x.PrinterId == Id).Count() > 0)
                {
                    KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUsed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch (Exception ex)
            {
                ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                {
                    KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }), false, Resources.GetRes().GetString("DeleteFailt"));
                return;
            }

            StartLoad(this, null);

            Task.Factory.StartNew(() =>
            {
                try
                {
                    ResultModel result = OperatesService.GetOperates().ServiceDelPrinter(Resources.GetRes().Printers.Where(x => x.PrinterId == Id).FirstOrDefault());
                    this.BeginInvoke(new Action(() =>
                    {
                        if (result.Result)
                        {
                            KryptonMessageBox.Show(this, Resources.GetRes().GetString("DeleteSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Printer oldModel = Resources.GetRes().Printers.Where(x => x.PrinterId == Id).FirstOrDefault();
                            krpdgList.Rows.Remove(krpdgList.SelectedRows[0]);
                            resultList.Remove(oldModel);
                            Resources.GetRes().Printers.Remove(oldModel);
                            ReloadPrinterTextbox(true);
                        }
                        else
                        {
                            if (result.IsDataHasRefrence)
                            {
                                KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUsed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                KryptonMessageBox.Show(this, Resources.GetRes().GetString("DeleteFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    this.BeginInvoke(new Action(() =>
                    {
                        ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                        {
                            KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }), false, Resources.GetRes().GetString("DeleteFailt"));
                    }));
                }
                StopLoad(this, null);
            });
        }
        public static void ImportPaletteColourScheme()
        {
            GlobalStringSettingsManager globalStringSettingsManager = new GlobalStringSettingsManager();

            try
            {
                KryptonPalette palette = new KryptonPalette();

                palette.Import();

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.ALTERNATIVENORMALTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.OverrideDefault.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.BASECOLOUR, palette.ButtonStyles.ButtonCommon.OverrideDefault.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.BORDERCOLOUR, Color.Gray);          // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURONE, Color.Gray);       // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURTWO, Color.Gray);       // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURTHREE, Color.Gray);     // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURFOUR, Color.Gray);      // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURFIVE, Color.Gray);      // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURONE, Color.Gray);   // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURTWO, Color.Gray);   // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURTHREE, Color.Gray); // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURFOUR, Color.Gray);  // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURFIVE, Color.Gray);  // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.DARKESTCOLOUR, palette.ButtonStyles.ButtonCluster.StatePressed.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.DISABLEDCONTROLCOLOUR, palette.ButtonStyles.ButtonCommon.StateDisabled.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.DISABLEDTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.StateDisabled.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.FOCUSEDTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.OverrideFocus.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LIGHTCOLOUR, palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color2);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LIGHTESTCOLOUR, palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKDISABLEDCOLOUR, palette.LabelStyles.LabelNormalControl.StateDisabled.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKHOVERCOLOUR, palette.LabelStyles.LabelNormalControl.OverridePressed.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKNORMALCOLOUR, palette.LabelStyles.LabelNormalControl.OverrideNotVisited.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKVISITEDCOLOUR, palette.LabelStyles.LabelNormalControl.OverrideVisited.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.MEDIUMCOLOUR, palette.ButtonStyles.ButtonCluster.StateNormal.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.MENUTEXTCOLOUR, palette.ToolMenuStatus.Menu.MenuItemText);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.NORMALTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.StateCommon.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.PRESSEDTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.StatePressed.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.STATUSTEXTCOLOUR, palette.ToolMenuStatus.StatusStrip.StatusStripText);

                ColourSettingsManagementEngine.SaveSettings(SettingTypes.COLOUR);

                globalStringSettingsManager.SetBasePaletteMode(palette.BasePaletteMode.ToString());

                globalStringSettingsManager.SetFeedbackText("The import was successful.");

                ColourSettingsManagementEngine.SaveSettings(SettingTypes.STRING);
            }
            catch (Exception exc)
            {
                KryptonMessageBox.Show($"Error: { exc.Message }", "_palette Import Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                globalStringSettingsManager.SetFeedbackText("Failed to import colours!");

                globalStringSettingsManager.SaveStringSettings();
            }
        }
        /// <summary>
        /// 查找
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void krpbSearch_Click(object sender, EventArgs e)
        {
            //为未保存数据而忽略当前操作
            if (!IgnoreOperateForSave())
            {
                return;
            }

            DateTime startDateTime = DateTime.Now;
            DateTime endDateTime   = DateTime.Now;

            try
            {
                startDateTime = krptbStartTime.Value;
                endDateTime   = krptbEndTime.Value;
            }
            catch (Exception ex)
            {
                KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyError"), Resources.GetRes().GetString("Time")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ExceptionPro.ExpLog(ex);
                return;
            }

            if ((endDateTime - startDateTime).TotalMinutes <= 0 || !((endDateTime - startDateTime).TotalMinutes <= TimeLimit.TotalMinutes))
            {
                KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("TimeLimit"), TimeLimit.TotalDays), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            long addTimeStart = long.Parse(startDateTime.ToString("yyyyMMddHHmmss"));
            long addTimeEnd   = long.Parse(endDateTime.ToString("yyyyMMddHHmmss"));
            long balanceType  = krpcbPayType.SelectedIndex;

            StartLoad(this, null);

            Task.Factory.StartNew(() =>
            {
                try
                {
                    List <BalancePay> balancePays;
                    List <OrderPay> orderPays;
                    List <TakeoutPay> takeoutPays;
                    List <MemberPay> memberPays;
                    List <SupplierPay> supplierPays;
                    List <AdminPay> adminPays;
                    List <ImportPay> importPays;


                    bool result = OperatesService.GetOperates().ServiceGetBalancePay(balanceType, balance.BalanceId, -1, -1, addTimeStart, addTimeEnd, out balancePays, out orderPays, out takeoutPays, out memberPays, out supplierPays, out adminPays, out importPays);
                    this.BeginInvoke(new Action(() =>
                    {
                        if (result)
                        {
                            List <CommonPayModel> commonPays = new List <CommonPayModel>();

                            commonPays.AddRange(balancePays.Select(x => new CommonPayModel(x)));
                            commonPays.AddRange(orderPays.Select(x => new CommonPayModel(x)));
                            commonPays.AddRange(takeoutPays.Select(x => new CommonPayModel(x)));
                            commonPays.AddRange(memberPays.Select(x => new CommonPayModel(x)));
                            commonPays.AddRange(supplierPays.Select(x => new CommonPayModel(x)));
                            commonPays.AddRange(adminPays.Select(x => new CommonPayModel(x)));
                            commonPays.AddRange(importPays.Select(x => new CommonPayModel(x)));

                            this.resultList    = balancePays.OrderByDescending(x => x.BalancePayId).ToList();
                            this.commonPayList = commonPays.OrderByDescending(x => x.AddTime).ToList();
                            //设定页面数据
                            ResetPage();
                            if (commonPayList.Count() > 0)
                            {
                                AllPage            = (int)((commonPayList.Count() - 1 + ListCount) / ListCount);
                                krplPageCount.Text = AllPage.ToString();

                                CurrentPage          = 1;
                                krptCurrentPage.Text = CurrentPage.ToString();

                                //打开第一页
                                OpenPageTo(CurrentPage, false);
                            }
                            else
                            {
                                krpdgList.Rows.Clear();
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    this.BeginInvoke(new Action(() =>
                    {
                        ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                        {
                            KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }), false, string.Format(Resources.GetRes().GetString("OperateFaild"), Resources.GetRes().GetString("Search")));
                    }));
                }
                StopLoad(this, null);

                // 防止滚动条比例没准确显示导致不显示底部的数据
                this.BeginInvoke(new Action(() =>
                {
                    krpdgList.PerformLayout();
                }));
            });
        }
Beispiel #4
0
        /// <summary>
        /// Retrieves the selected colour.
        /// </summary>
        /// <param name="colourType">Type of the colour.</param>
        /// <returns>The chosen colour.</returns>
        public static Color RetrieveSelectedColour(AllAvailableColourTypes colourType)
        {
            Color tempColour = Color.FromArgb(0, 0, 0, 0);

            AllMergedColourSettingsManager colourSettingsManager = new AllMergedColourSettingsManager();

            try
            {
                switch (colourType)
                {
                case AllAvailableColourTypes.ALTERNATIVENORMALTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetAlternativeNormalTextColour();
                    break;

                case AllAvailableColourTypes.BASECOLOUR:
                    tempColour = colourSettingsManager.GetBaseColour();
                    break;

                case AllAvailableColourTypes.BORDERCOLOUR:
                    tempColour = colourSettingsManager.GetBorderColour();
                    break;

                case AllAvailableColourTypes.CUSTOMCOLOURONE:
                    tempColour = colourSettingsManager.GetCustomColourOne();
                    break;

                case AllAvailableColourTypes.CUSTOMCOLOURTWO:
                    tempColour = colourSettingsManager.GetCustomColourTwo();
                    break;

                case AllAvailableColourTypes.CUSTOMCOLOURTHREE:
                    tempColour = colourSettingsManager.GetCustomColourThree();
                    break;

                case AllAvailableColourTypes.CUSTOMCOLOURFOUR:
                    tempColour = colourSettingsManager.GetCustomColourFour();
                    break;

                case AllAvailableColourTypes.CUSTOMCOLOURFIVE:
                    tempColour = colourSettingsManager.GetCustomColourFive();
                    break;

                case AllAvailableColourTypes.CUSTOMCOLOURSIX:
                    tempColour = colourSettingsManager.GetCustomColourSix();
                    break;

                case AllAvailableColourTypes.CUSTOMTEXTCOLOURONE:
                    tempColour = colourSettingsManager.GetCustomTextColourOne();
                    break;

                case AllAvailableColourTypes.CUSTOMTEXTCOLOURTWO:
                    tempColour = colourSettingsManager.GetCustomTextColourTwo();
                    break;

                case AllAvailableColourTypes.CUSTOMTEXTCOLOURTHREE:
                    tempColour = colourSettingsManager.GetCustomTextColourThree();
                    break;

                case AllAvailableColourTypes.CUSTOMTEXTCOLOURFOUR:
                    tempColour = colourSettingsManager.GetCustomTextColourFour();
                    break;

                case AllAvailableColourTypes.CUSTOMTEXTCOLOURFIVE:
                    tempColour = colourSettingsManager.GetCustomTextColourFive();
                    break;

                case AllAvailableColourTypes.CUSTOMTEXTCOLOURSIX:
                    tempColour = colourSettingsManager.GetCustomTextColourSix();
                    break;

                case AllAvailableColourTypes.DARKESTCOLOUR:
                    tempColour = colourSettingsManager.GetDarkColour();
                    break;

                case AllAvailableColourTypes.DISABLEDCONTROLCOLOUR:
                    tempColour = colourSettingsManager.GetDisabledControlColour();
                    break;

                case AllAvailableColourTypes.DISABLEDTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetDisabledTextColour();
                    break;

                case AllAvailableColourTypes.FOCUSEDTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetFocusedTextColour();
                    break;

                case AllAvailableColourTypes.LIGHTCOLOUR:
                    tempColour = colourSettingsManager.GetLightColour();
                    break;

                case AllAvailableColourTypes.LIGHTESTCOLOUR:
                    tempColour = colourSettingsManager.GetLightestColour();
                    break;

                case AllAvailableColourTypes.LINKDISABLEDCOLOUR:
                    tempColour = colourSettingsManager.GetLinkDisabledColour();
                    break;

                case AllAvailableColourTypes.LINKHOVERCOLOUR:
                    tempColour = colourSettingsManager.GetLinkHoverColour();
                    break;

                case AllAvailableColourTypes.LINKNORMALCOLOUR:
                    tempColour = colourSettingsManager.GetLinkNormalColour();
                    break;

                case AllAvailableColourTypes.LINKVISITEDCOLOUR:
                    tempColour = colourSettingsManager.GetLinkVisitedColour();
                    break;

                case AllAvailableColourTypes.MEDIUMCOLOUR:
                    tempColour = colourSettingsManager.GetMediumColour();
                    break;

                case AllAvailableColourTypes.MENUTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetMenuTextColour();
                    break;

                case AllAvailableColourTypes.NORMALTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetNormalTextColour();
                    break;

                case AllAvailableColourTypes.PRESSEDTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetPressedTextColour();
                    break;

                case AllAvailableColourTypes.STATUSTEXTCOLOUR:
                    tempColour = colourSettingsManager.GetStatusStripTextColour();
                    break;

                default:
                    tempColour = Color.FromArgb(0, 0, 0, 0);
                    break;
                }
            }
            catch (Exception exc)
            {
                KryptonMessageBox.Show($"An unexpected error has occurred: { exc.Message }", "Retrieving Settings Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                tempColour = Color.FromArgb(0, 0, 0, 0);
            }

            return(tempColour);
        }
        /// <summary>
        /// Merges all colour settings together.
        /// </summary>
        /// <param name="usePrompt">if set to <c>true</c> [use prompt].</param>
        public static void MergeAllColourSettings(bool usePrompt = false)
        {
            #region Variables
            BasicColourSettingsManager basicPaletteColourManager = new BasicColourSettingsManager();

            CustomColourSettingsManager customPaletteColourManager = new CustomColourSettingsManager();

            CustomTextColourSettingsManager customPaletteTextColourManager = new CustomTextColourSettingsManager();

            LinkTextColourSettingsManager linkTextPaletteColourManager = new LinkTextColourSettingsManager();

            MiscellaneousColourSettingsManager miscellaneousPaletteColourManager = new MiscellaneousColourSettingsManager();

            StandardControlTextColourSettingsManager standardControlTextColourSettingsManager = new StandardControlTextColourSettingsManager();

            TextColourSettingsManager textPaletteColourManager = new TextColourSettingsManager();

            AllMergedColourSettingsManager colourSettingsManager = new AllMergedColourSettingsManager();
            #endregion

            try
            {
                if (BasicColourSettingsManager.AreBasicPaletteColoursEmpty() || CustomColourSettingsManager.AreCustomPaletteColoursEmpty() || CustomTextColourSettingsManager.AreCustomPaletteTextColoursEmpty() || LinkTextColourSettingsManager.AreLinkTextPaletteColoursEmpty() || MiscellaneousColourSettingsManager.AreMiscellaneousPaletteColoursEmpty() || StandardControlTextColourSettingsManager.AreStandardControlTextColoursEmpty() || TextColourSettingsManager.AreTextPaletteColoursEmpty())
                {
                    KryptonMessageBox.Show("There are no colours to merge.", "Undefined Colours", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    if (usePrompt)
                    {
                        DialogResult result = KryptonMessageBox.Show("Do you want to merge all the colour settings together?", "Confirm Merge", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (result == DialogResult.Yes)
                        {
                            colourSettingsManager.SetAlternativeNormalTextColour(textPaletteColourManager.GetAlternativeNormalTextColour());

                            colourSettingsManager.SetBaseColour(basicPaletteColourManager.GetBaseColour());

                            colourSettingsManager.SetBorderColour(miscellaneousPaletteColourManager.GetBorderColour());

                            colourSettingsManager.SetCustomColourOne(customPaletteColourManager.GetCustomColourOne());

                            colourSettingsManager.SetCustomColourTwo(customPaletteColourManager.GetCustomColourTwo());

                            colourSettingsManager.SetCustomColourThree(customPaletteColourManager.GetCustomColourThree());

                            colourSettingsManager.SetCustomColourFour(customPaletteColourManager.GetCustomColourFour());

                            colourSettingsManager.SetCustomColourFive(customPaletteColourManager.GetCustomColourFive());

                            colourSettingsManager.SetCustomColourSix(customPaletteColourManager.GetCustomColourSix());

                            colourSettingsManager.SetCustomTextColourOne(customPaletteTextColourManager.GetCustomTextColourOne());

                            colourSettingsManager.SetCustomTextColourTwo(customPaletteTextColourManager.GetCustomTextColourTwo());

                            colourSettingsManager.SetCustomTextColourThree(customPaletteTextColourManager.GetCustomTextColourThree());

                            colourSettingsManager.SetCustomTextColourFour(customPaletteTextColourManager.GetCustomTextColourFour());

                            colourSettingsManager.SetCustomTextColourFive(customPaletteTextColourManager.GetCustomTextColourFive());

                            colourSettingsManager.SetCustomTextColourSix(customPaletteTextColourManager.GetCustomTextColourSix());

                            colourSettingsManager.SetDarkColour(basicPaletteColourManager.GetDarkColour());

                            colourSettingsManager.SetDisabledControlColour(miscellaneousPaletteColourManager.GetDisabledControlColour());

                            colourSettingsManager.SetDisabledTextColour(textPaletteColourManager.GetDisabledTextColour());

                            colourSettingsManager.SetFocusedTextColour(textPaletteColourManager.GetFocusedTextColour());

                            colourSettingsManager.SetLightColour(basicPaletteColourManager.GetLightColour());

                            colourSettingsManager.SetLightestColour(basicPaletteColourManager.GetLightestColour());

                            colourSettingsManager.SetLinkDisabledColour(linkTextPaletteColourManager.GetLinkDisabledColour());

                            colourSettingsManager.SetLinkFocusedColour(linkTextPaletteColourManager.GetLinkFocusedColour());

                            colourSettingsManager.SetLinkHoverColour(linkTextPaletteColourManager.GetLinkHoverColour());

                            colourSettingsManager.SetLinkNormalColour(linkTextPaletteColourManager.GetLinkNormalColour());

                            colourSettingsManager.SetLinkVisitedColour(linkTextPaletteColourManager.GetLinkVisitedColour());

                            colourSettingsManager.SetMediumColour(basicPaletteColourManager.GetMediumColour());

                            colourSettingsManager.SetMenuTextColour(standardControlTextColourSettingsManager.GetMenuTextColour());

                            colourSettingsManager.SetNormalTextColour(textPaletteColourManager.GetNormalTextColour());

                            colourSettingsManager.SetPressedTextColour(textPaletteColourManager.GetPressedTextColour());

                            colourSettingsManager.SetRibbonTabTextColour(standardControlTextColourSettingsManager.GetRibbonTabTextColour());

                            colourSettingsManager.SetStatusStripTextColour(standardControlTextColourSettingsManager.GetStatusStripTextColour());

                            colourSettingsManager.SaveAllMergedColourSettings(usePrompt);
                        }
                    }
                    else
                    {
                        colourSettingsManager.SetAlternativeNormalTextColour(textPaletteColourManager.GetAlternativeNormalTextColour());

                        colourSettingsManager.SetBaseColour(basicPaletteColourManager.GetBaseColour());

                        colourSettingsManager.SetBorderColour(miscellaneousPaletteColourManager.GetBorderColour());

                        colourSettingsManager.SetCustomColourOne(customPaletteColourManager.GetCustomColourOne());

                        colourSettingsManager.SetCustomColourTwo(customPaletteColourManager.GetCustomColourTwo());

                        colourSettingsManager.SetCustomColourThree(customPaletteColourManager.GetCustomColourThree());

                        colourSettingsManager.SetCustomColourFour(customPaletteColourManager.GetCustomColourFour());

                        colourSettingsManager.SetCustomColourFive(customPaletteColourManager.GetCustomColourFive());

                        colourSettingsManager.SetCustomTextColourOne(customPaletteTextColourManager.GetCustomTextColourOne());

                        colourSettingsManager.SetCustomTextColourTwo(customPaletteTextColourManager.GetCustomTextColourTwo());

                        colourSettingsManager.SetCustomTextColourThree(customPaletteTextColourManager.GetCustomTextColourThree());

                        colourSettingsManager.SetCustomTextColourFour(customPaletteTextColourManager.GetCustomTextColourFour());

                        colourSettingsManager.SetCustomTextColourFive(customPaletteTextColourManager.GetCustomTextColourFive());

                        colourSettingsManager.SetDarkColour(basicPaletteColourManager.GetDarkColour());

                        colourSettingsManager.SetDisabledControlColour(miscellaneousPaletteColourManager.GetDisabledControlColour());

                        colourSettingsManager.SetDisabledTextColour(textPaletteColourManager.GetDisabledTextColour());

                        colourSettingsManager.SetFocusedTextColour(textPaletteColourManager.GetFocusedTextColour());

                        colourSettingsManager.SetLightColour(basicPaletteColourManager.GetLightColour());

                        colourSettingsManager.SetLightestColour(basicPaletteColourManager.GetLightestColour());

                        colourSettingsManager.SetLinkDisabledColour(linkTextPaletteColourManager.GetLinkDisabledColour());

                        colourSettingsManager.SetLinkFocusedColour(linkTextPaletteColourManager.GetLinkFocusedColour());

                        colourSettingsManager.SetLinkHoverColour(linkTextPaletteColourManager.GetLinkHoverColour());

                        colourSettingsManager.SetLinkNormalColour(linkTextPaletteColourManager.GetLinkNormalColour());

                        colourSettingsManager.SetLinkVisitedColour(linkTextPaletteColourManager.GetLinkVisitedColour());

                        colourSettingsManager.SetMediumColour(basicPaletteColourManager.GetMediumColour());

                        colourSettingsManager.SetMenuTextColour(standardControlTextColourSettingsManager.GetMenuTextColour());

                        colourSettingsManager.SetNormalTextColour(textPaletteColourManager.GetNormalTextColour());

                        colourSettingsManager.SetPressedTextColour(textPaletteColourManager.GetPressedTextColour());

                        colourSettingsManager.SetRibbonTabTextColour(standardControlTextColourSettingsManager.GetRibbonTabTextColour());

                        colourSettingsManager.SetStatusStripTextColour(standardControlTextColourSettingsManager.GetStatusStripTextColour());

                        colourSettingsManager.SaveAllMergedColourSettings();
                    }
                }
            }
            catch (Exception exc)
            {
                ExceptionHandler.CaptureException(exc, icon: MessageBoxIcon.Error, methodSignature: Helpers.GetCurrentMethod());
            }
        }
Beispiel #6
0
        private void AbreForm()
        {
            try
            {
                if (tvMenu.SelectedNode != null)
                {
                    Boolean  ok       = false;
                    TreeNode nodeItem = tvMenu.SelectedNode;

                    if (nodeItem.Tag != null)
                    {
                        switch (nodeItem.Tag.ToString())
                        {
                            #region CTe

                        case "Status Cte":

                            timer1.Start();
                            T = new Thread(belStatusServico.VerificaStatusServicoCTe);
                            T.Start();
                            frmStatusServico = new frmStatus();
                            frmStatusServico.ShowDialog();

                            KryptonMessageBox.Show(belStatusServico.Mensagem, Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);

                            break;

                        case "frmInutilizaFaixaCte":

                            if (Acesso.cert_CTe == null || !belStatusServico.ServicoOperando)
                            {
                                timer1.Start();
                                T = new Thread(belStatusServico.VerificaStatusServicoCteTela);
                                T.Start();
                                frmStatusServico = new frmStatus();
                                frmStatusServico.ShowDialog();

                                KryptonMessageBox.Show(belStatusServico.Mensagem, Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            if (belStatusServico.ServicoOperando && Acesso.TP_EMIS != 2)
                            {
                                frmInutilizaFaixaCte objfrm = new frmInutilizaFaixaCte();
                                objfrm.ShowDialog();
                            }
                            break;


                        case "frmGerarArquivosCte":
                            AbreFormCte();
                            break;

                        case "frmGerarArquivosMDFe":
                            AbreFormMDFe();
                            break;
                            #endregion

                            #region NFe
                        case "Status Nfe":

                            timer1.Start();
                            T = new Thread(belStatusServico.VerificaStatusServicoNFe);
                            T.Start();
                            frmStatusServico = new frmStatus();
                            frmStatusServico.ShowDialog();

                            KryptonMessageBox.Show(belStatusServico.Mensagem, Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            break;

                        case "frmInutilizaFaixaNFe":
                            if (Acesso.cert_NFe == null || !belStatusServico.ServicoOperando)
                            {
                                timer1.Start();
                                T = new Thread(belStatusServico.VerificaStatusServicoNFeTela);
                                T.Start();
                                frmStatusServico = new frmStatus();
                                frmStatusServico.ShowDialog();

                                KryptonMessageBox.Show(belStatusServico.Mensagem, Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            if (belStatusServico.ServicoOperando && Acesso.TP_EMIS != 2)
                            {
                                frmInutilizaFaixaNFe objfrm = new frmInutilizaFaixaNFe();
                                objfrm.ShowDialog();
                            }
                            break;

                        case "frmProtocolosNfe":
                            frmProtocolosNfe objfrmProt = new frmProtocolosNfe();
                            objfrmProt.ShowDialog();
                            break;

                        case "frmGeraArquivoNFe":
                            AbreFormNfe();
                            break;

                        case "frmManifestacaoEvento":
                            AbreFormManifestacaoNfe();
                            break;
                            #endregion

                            #region NFe Servico

                        case "frmGeraArquivoNFes":
                            AbreFormNfes();
                            break;
                            #endregion

                            #region CCe
                        case "frmGeraArquivoCCe":
                            foreach (Control crt in this.splitContainerTela.Panel2.Controls)
                            {
                                if (crt is frmGeraArquivoCCe)
                                {
                                    crt.BringToFront();
                                    ((Form)crt).WindowState = FormWindowState.Normal;
                                    ok = true;
                                    break;
                                }
                            }
                            if (!ok)
                            {
                                timer1.Start();
                                T = new Thread(belStatusServico.VerificaStatusServicoNFeTela);
                                T.Start();
                                frmStatusServico = new frmStatus();
                                frmStatusServico.ShowDialog();

                                KryptonMessageBox.Show(belStatusServico.Mensagem, Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);

                                if (Acesso.TP_EMIS == 1)
                                {
                                    if (belStatusServico.ServicoOperando)
                                    {
                                        frmGeraArquivoCCe objfrmCCe = new frmGeraArquivoCCe();
                                        this.AddOwnedForm(objfrmCCe);
                                        objfrmCCe.MdiParent = this;
                                        this.splitContainerTela.Panel2.Controls.Add(objfrmCCe);
                                        objfrmCCe.WindowState = FormWindowState.Normal;
                                        objfrmCCe.Dock        = DockStyle.Fill;
                                        objfrmCCe.Show();
                                        objfrmCCe.BringToFront();
                                        objfrmCCe.PesquisaCartas();
                                    }
                                }
                            }
                            break;
                            #endregion
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
            finally
            {
                timer1.Stop();
                frmStatusServico = null;
                if (T != null)
                {
                    if (T.IsAlive)
                    {
                        T.Abort();
                        T = null;
                    }
                }
            }
        }
        private void btnsave_Click(object sender, EventArgs e)
        {
            string msg = "";

            try
            {
                if (optadd.Checked)
                {
                    if (Validate('A', out msg))
                    {
                        if (cmbMainAccount.SelectedIndex == 1)
                        {
                            bl_obj.OptionType = "I";
                        }
                        if (cmbMainAccount.SelectedIndex == 2)
                        {
                            bl_obj.OptionType = "E";
                        }
                        if (cmbMainAccount.SelectedIndex == 3)
                        {
                            bl_obj.OptionType = "A";
                        }
                        if (cmbMainAccount.SelectedIndex == 4)
                        {
                            bl_obj.OptionType = "L";
                        }
                        bl_obj.ExpencesName = txtExpencesName.Text;
                        FillLVW(bl_obj.INSERT(bl_obj));
                        ClearControls();
                        KryptonMessageBox.Show("Record Save Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MyMessageBox.ShowBox(msg);
                    }
                }
                else if (optupdate.Checked)
                {
                    if (Validate('U', out msg))
                    {
                        bl_obj.ExpencesId = Convert.ToInt32(txtExpencesId.Text.ToString());
                        if (cmbMainAccount.SelectedIndex == 1)
                        {
                            bl_obj.OptionType = "I";
                        }
                        if (cmbMainAccount.SelectedIndex == 2)
                        {
                            bl_obj.OptionType = "E";
                        }
                        if (cmbMainAccount.SelectedIndex == 3)
                        {
                            bl_obj.OptionType = "A";
                        }
                        if (cmbMainAccount.SelectedIndex == 4)
                        {
                            bl_obj.OptionType = "L";
                        }
                        bl_obj.ExpencesName = txtExpencesName.Text;
                        FillLVW(bl_obj.UPDATE(bl_obj));
                        ClearControls();
                        KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MyMessageBox.ShowBox(msg);
                    }
                }
                else if (optdelete.Checked)
                {
                    if (Validate('D', out msg))
                    {
                        if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            foreach (ListViewItem l in lvw.CheckedItems)
                            {
                                bl_obj.ExpencesId = Convert.ToInt32(l.Tag.ToString());
                                bl_obj.DELETE(bl_obj);
                            }
                            FillLVW(bl_obj.select(bl_obj));
                            ClearControls();
                            KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowBox(msg);
                    }
                }
            }
            catch (Exception err) { err.GetBaseException(); }
        }
Beispiel #8
0
        private void Open()
        {
            tslStatus.Text = "Attempting to inport colours from selected palette. Please wait...";

            // If the current palette has been changed
            if (Dirty)
            {
                // Ask user if the current palette should be saved
                switch (KryptonMessageBox.Show(this,
                                               "Save changes to the current palette?",
                                               "Palette Changed",
                                               MessageBoxButtons.YesNoCancel,
                                               MessageBoxIcon.Warning))
                {
                case DialogResult.Yes:
                    // Use existing save method
                    Save();
                    break;

                case DialogResult.Cancel:
                    // Cancel out entirely
                    return;
                }
            }

            // Create a fresh palette instance for loading into
            KryptonPalette palette = new KryptonPalette();

            // Get the name of the file we imported from
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            string filename = palette.Import();

            Cursor = Cursors.Default;

            // If the load succeeded
            if (filename.Length > 0)
            {
                // Need to unhook from any existing palette
                if (Palette != null)
                {
                    Palette.PalettePaint -= new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);
                }

                // Use the new instance instead
                Palette = palette;

                // We need to know when a change occurs to the palette settings
                Palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);

                // Hook up the property grid to the palette
                labelGridNormal.SelectedObject = Palette;

                // Use the loaded filename
                FileName = filename;

                // Reset the state flags
                Loaded = true;
                Dirty  = false;

                // Define the initial title bar string
                UpdateTitlebar();
            }

            PaletteImportManager paletteImportManager = new PaletteImportManager();

            paletteImportManager.ImportColourScheme(palette);

            kchkUpdateColours.Enabled = true;

            kcmbBasePaletteMode.Text = _globalStringSettingsManager.GetBasePaletteMode();

            tslStatus.Text = _globalStringSettingsManager.GetFeedbackText();

            kchkUpdateColours.Checked = true;

            invertColoursToolStripMenuItem.Enabled = true;

            kchkInvertColours.Enabled = true;

            _mostRecentlyUsedFileManager.AddRecentFile(filename);
        }
        private void SelectedGroupBySelections(ImageListView imageListView, int baseItemIndex, int direction, int maxSelectCount,
                                               bool checkFileCreated, bool checkMediaTaken, bool checkAllDates, int maxDayRange,
                                               bool checkLocationName, bool checkLocationCity, bool checkLocationDistrict, bool checkLocationCountry, bool checkAllLocations)
        {
            try
            {
                ImageListViewHandler.SuspendLayout(imageListView1);
                ImageListViewHandler.Enable(imageListView, false);
                TreeViewFolderBrowserHandler.Enabled(treeViewFolderBrowser1, false);
                GlobalData.DoNotTrigger_ImageListView_SelectionChanged = true;

                #region Do the work
                using (new WaitCursor())
                {
                    ImageListViewItemCollection imageListViewItems = imageListView.Items;
                    if (baseItemIndex < imageListViewItems.Count && direction != 0)
                    {
                        #region Init Variables
                        GroupMacth groupMacthSource = new GroupMacth();

                        ImageListViewItem imageListViewItem = imageListViewItems[baseItemIndex];
                        Metadata          metadata          = databaseAndCacheMetadataExiftool.ReadMetadataFromCacheOnly(new FileEntryBroker(imageListViewItem.FileFullPath, imageListViewItem.DateModified, MetadataBrokerType.ExifTool));

                        groupMacthSource.IsMetadataNull   = (metadata == null);
                        groupMacthSource.FileDate         = imageListViewItem.Date;
                        groupMacthSource.MediaTaken       = metadata?.MediaDateTaken;
                        groupMacthSource.LocationName     = metadata?.LocationName;
                        groupMacthSource.LocationCity     = metadata?.LocationCity;
                        groupMacthSource.LocationDistrict = metadata?.LocationState;
                        groupMacthSource.LocationCountry  = metadata?.LocationCountry;
                        #endregion

                        imageListView.ClearSelection();

                        #region Find and Select
                        int selectedCount = 0;
                        int itemIndex     = baseItemIndex;
                        while (itemIndex > -1 && itemIndex < imageListViewItems.Count && selectedCount < maxSelectCount)
                        {
                            imageListViewItem = imageListViewItems[itemIndex];
                            metadata          = databaseAndCacheMetadataExiftool.ReadMetadataFromCacheOnly(new FileEntryBroker(imageListViewItem.FileFullPath, imageListViewItem.DateModified, MetadataBrokerType.ExifTool));

                            GroupMacth groupMacthCheckWith = new GroupMacth();
                            groupMacthCheckWith.IsMetadataNull   = (metadata == null);
                            groupMacthCheckWith.FileDate         = imageListViewItem.Date;
                            groupMacthCheckWith.MediaTaken       = metadata?.MediaDateTaken;
                            groupMacthCheckWith.LocationName     = metadata?.LocationName;
                            groupMacthCheckWith.LocationCity     = metadata?.LocationCity;
                            groupMacthCheckWith.LocationDistrict = metadata?.LocationState;
                            groupMacthCheckWith.LocationCountry  = metadata?.LocationCountry;


                            bool isItemsEqual = GroupMacth.IsMatch(groupMacthSource, groupMacthCheckWith, checkFileCreated, checkMediaTaken,
                                                                   checkAllDates, maxDayRange,
                                                                   checkLocationName, checkLocationCity, checkLocationDistrict, checkLocationCountry, checkAllLocations);

                            if (isItemsEqual)
                            {
                                selectedCount++;
                                imageListViewItem.Selected = true;
                            }
                            else
                            {
                                imageListViewItem.Selected = false;
                            }

                            itemIndex += direction;
                        }
                        #endregion

                        imageListView.EnsureVisible(itemIndex - direction);
                        imageListView.EnsureVisible(baseItemIndex);
                    }
                    lastGroupBaseIndex = baseItemIndex;
                }
                #endregion
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                KryptonMessageBox.Show("Unexpected error occur.\r\nException message:" + ex.Message + "\r\n",
                                       "Unexpected error occur", MessageBoxButtons.OK, MessageBoxIcon.Error, showCtrlCopy: true);
            }
            finally
            {
                GlobalData.DoNotTrigger_ImageListView_SelectionChanged = false;
                TreeViewFolderBrowserHandler.Enabled(treeViewFolderBrowser1, true);
                ImageListViewHandler.Enable(imageListView, true);
                ImageListViewHandler.ResumeLayout(imageListView1);

                imageListView.Focus();
                ImageListView_SelectionChanged_Action_ImageListView_DataGridView(false);
            }
        }
        private void btnsave_Click(object sender, EventArgs e)
        {
            string msg = "";

            try
            {
                if (optadd.Checked)
                {
                    if (Validate('A', out msg))
                    {
                        bl_obj.RowMaterialName = txtRowMaterialName.Text;
                        bl_obj.MeasurmentId    = Convert.ToInt32(cmbMeasurement.SelectedValue);
                        bl_obj.RowHedarId      = Convert.ToInt32(cmbRowHeaderName.SelectedValue);
                        FillLVW(bl_obj.INSERT(bl_obj));
                        ClearControls();
                        KryptonMessageBox.Show("Record Save Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MyMessageBox.ShowBox(msg);
                    }
                }
                else if (optupdate.Checked)
                {
                    if (Validate('U', out msg))
                    {
                        bl_obj.RowMaterialId   = Convert.ToInt32(txtRowMaterialId.Text.ToString());
                        bl_obj.RowMaterialName = txtRowMaterialName.Text;
                        bl_obj.MeasurmentId    = Convert.ToInt32(cmbMeasurement.SelectedValue);
                        bl_obj.RowHedarId      = Convert.ToInt32(cmbRowHeaderName.SelectedValue);
                        FillLVW(bl_obj.UPDATE(bl_obj));
                        ClearControls();
                        KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MyMessageBox.ShowBox(msg);
                    }
                }
                else if (optdelete.Checked)
                {
                    if (Validate('D', out msg))
                    {
                        if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            foreach (ListViewItem l in lvw.CheckedItems)
                            {
                                bl_obj.RowMaterialId = Convert.ToInt32(l.Tag.ToString());
                                bl_obj.DELETE(bl_obj);
                            }
                            FillLVW(bl_obj.select(bl_obj));
                            ClearControls();
                            KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowBox(msg);
                    }
                }
            }
            catch (Exception err) { err.GetBaseException(); }
        }
Beispiel #11
0
 private void kryptonButton1_Click(object sender, EventArgs e)
 {
     KryptonMessageBox.Show("Now select source vertex!");
     choosingSourceVertex = true;
 }
Beispiel #12
0
        //批次
        private void ktxt_lot_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13 && !ktxt_lot.ReadOnly)
            {
                if (string.IsNullOrWhiteSpace(ktxt_lot.Text))
                {
                    Component.Tool.DisplayResult(txt_resgx, false, "装料批次不能为空");
                    return;
                }
                string lot = ktxt_lot.Text.Trim().Replace("#", "");
                try
                {
                    string mat_code = string.Empty;
                    if (lotWIP == null)
                    {
                        string order_no = ktxtOrder.Text;
                        if (order_no == "")
                        {
                            MessageBox.Show("工单号不可为空,请选择工单", "提示");
                            return;
                        }
                        //根据批次号及工单获取物料编号
                        mat_code = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "GetMat_codeBylot", lot + "," + order_no);
                        if (mat_code == "")
                        {
                            MessageBox.Show("该工单和批次未能获取物料编号,请确认工单号及批次号", "提示");
                            return;
                        }
                    }
                    else
                    {
                        mat_code = lotWIP.mat_code;
                    }
                    DateTime MaterialInputTime = Convert.ToDateTime(Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.WIP", "GetWipInputTimeByLot", lot + "," + mat_code));
                    string   strwip_valid      = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Product", "GetWip_validByProductCode", mat_code);
                    if (strwip_valid != "")
                    {
                        decimal  wip_valid = Convert.ToDecimal(strwip_valid);
                        TimeSpan ts        = DateTime.Now - MaterialInputTime;
                        decimal  h         = ts.Hours;
                        if (h > wip_valid)
                        {
                            DialogResult result = KryptonMessageBox.Show("该物料已超出时效时间,确定继续使用吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                            if (result == System.Windows.Forms.DialogResult.No)
                            {
                                return;
                            }
                        }
                    }

                    ILE.IResult res = BLL.WIP.Check_WIP_Lot(ktxtOrder.Text, lot);
                    if (res.Result)
                    {
                        res = BLL.WIP.Get_WIP_LotInfo(ktxtOrder.Text, lot);
                        if (!res.Result)
                        {
                            Component.Tool.DisplayResult(txt_resgx, res.Result, res.ExtMessage);
                            return;
                        }
                        List <LEDAO.V_Material_WIP> wip = JsonConvert.DeserializeObject <List <LEDAO.V_Material_WIP> >(res.obj.ToString());
                        if (lotWIP == null)
                        {
                            if (wip.Count == 1)
                            {
                                lotWIP = wip[0];
                            }

                            //多个wip_id,弹窗选择
                            if (wip.Count > 1)
                            {
                                SelGridForm gridform = new SelGridForm(wip);
                                gridform.ShowDialog();
                                if (gridform.WIP != null)
                                {
                                    lotWIP        = gridform.WIP;
                                    ktxt_lot.Text = lotWIP.lot_no;
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                        //判断是否是最小批次
                        if (!BLL.WIP.Check_Mbm(ktxtOrder.Text))
                        {
                            //是否可分批投入
                            if (BLL.WIP.Check_Mat_Split(Convert.ToInt32(lotWIP.id), ktxtOrder.Text))
                            {
                                UserForm.NumForm num = new UserForm.NumForm();
                                num.ShowDialog();
                                switch (num.State)
                                {
                                case 1:
                                    if (lotWIP.lot_qty < num.Num)
                                    {
                                        Component.Tool.DisplayResult(txt_resgx, false, "当前批次记录不能大于" + lotWIP.lot_qty);
                                        return;
                                    }
                                    lotWIP.lot_qty = num.Num;
                                    break;

                                case 2:
                                    break;

                                default:
                                    return;
                                }
                            }
                        }

                        int id = Convert.ToInt32(lotWIP.id);
                        res = BLL.WIP.Get_WIP_Point(kcb_Station.SelectedValue.ToString(), ktxtOrder.Text, id);


                        //判断是否有安装点
                        if (res.Result)
                        {
                            pointList = JsonConvert.DeserializeObject <List <string> >(res.obj.ToString());
                            if (pointList.Count > 0)
                            {
                                ktxt_piont.Visible    = true;
                                kryptonLabel2.Visible = true;
                                ktxt_piont.Focus();
                            }
                        }
                        else
                        {
                            res = BLL.WIP.Sumit_FeedMatToStation(id, null, kcb_Station.SelectedValue.ToString(), ktxtOrder.Text, ktxt_emp.Text, lotWIP.lot_qty);
                            deWork();
                            DataBind();
                        }
                    }
                    else
                    {
                        ktxt_lot.Text = "";
                    }

                    Component.Tool.DisplayResult(txt_resgx, res.Result, res.ExtMessage);
                }
                catch (Exception exc)
                {
                    KryptonMessageBox.Show(exc.Message);
                }
                finally
                {
                    lotWIP = null;
                }
            }
        }
Beispiel #13
0
 public void OnScrapError(Exception ex)
 {
     Program.SetIdle();
     KryptonMessageBox.Show("An error occurred: " + ex.Message, Constants.AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
 }
 private void OnMouseClick(object sender, MouseEventArgs e)
 {
     KryptonMessageBox.Show(this, ((Control)sender).Name, @"Mouse click detected on ...");
 }
        /// <summary>
        /// 结账
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void krpbCheckout_Click(object sender, EventArgs e)
        {
            //余额不平确认
            if (takeout.BorrowPrice != 0 || takeout.KeepPrice != 0)
            {
                var confirm = KryptonMessageBox.Show(this, Resources.GetRes().GetString("ConfirmBalanceInjustice"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (confirm != DialogResult.Yes)
                {
                    return;
                }
            }

            if (takeout.PaidPrice == 0 && takeout.MemberPaidPrice == 0)
            {
                var confirm = KryptonMessageBox.Show(this, Resources.GetRes().GetString("ConfirmNotPay"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (confirm != DialogResult.Yes)
                {
                    return;
                }
            }



            takeout.State = 1;



            string newRoomSessionId;
            string ErrMsgName, SucMsgName;

            ErrMsgName = SucMsgName = Resources.GetRes().GetString("CheckoutOrder");

            StartLoad(this, null);

            Task.Factory.StartNew(() =>
            {
                ResultModel result = new ResultModel();

                bool IsClose = false;

                try
                {
                    long UpdateTime;
                    List <TakeoutDetail> resultDetailsList;
                    List <TakeoutPay> resultPaysList;

                    result = OperatesService.GetOperates().ServiceAddTakeout(takeout, details, tempPayList.Where(x => x.AddTime == 0).Select(x => { x.TakeoutId = takeout.TakeoutId; return(x); }).ToList(), null, out resultDetailsList, out resultPaysList, out newRoomSessionId, out UpdateTime);
                    if (result.Result)
                    {
                        if (!IsRechecked)
                        {
                            if (null != takeout.tb_member)
                            {
                                Notification.Instance.ActionMember(this, takeout.tb_member, null);
                                takeout.MemberId = takeout.tb_member.MemberId;
                            }



                            // 如果成功, 则新增产品
                            foreach (var item in details)
                            {
                                Product product = Resources.GetRes().Products.Where(x => x.ProductId == item.ProductId).FirstOrDefault();
                                if (product.IsBindCount == 1)
                                {
                                    if (product.BalanceCount < item.Count)
                                    {
                                        // 如果有父级
                                        if (null != product.ProductParentId)
                                        {
                                            Product productParent = Resources.GetRes().Products.Where(x => x.ProductId == product.ProductParentId).FirstOrDefault();

                                            if (null != productParent && productParent.IsBindCount == 1)
                                            {
                                                double ParentRemove = 0;
                                                double ProductAdd   = 0;


                                                double NeedChangeFromParent = Math.Round(item.Count - product.BalanceCount, 3);
                                                ParentRemove = Math.Round(NeedChangeFromParent / product.ProductParentCount, 3);
                                                ParentRemove = (int)Math.Ceiling(ParentRemove);

                                                ProductAdd = Math.Round(ParentRemove * product.ProductParentCount, 3);


                                                // 从父级中去掉
                                                productParent.BalanceCount = Math.Round(productParent.BalanceCount - ParentRemove, 3);
                                                productParent.UpdateTime   = UpdateTime;


                                                // 给产品增加零的
                                                product.BalanceCount = Math.Round(product.BalanceCount + ProductAdd, 3);
                                            }
                                        }
                                    }



                                    product.BalanceCount = Math.Round(product.BalanceCount - item.Count, 3);
                                    product.UpdateTime   = UpdateTime;

                                    Notification.Instance.ActionProduct(null, product, 2);
                                }
                            }



                            // 更新会员信息
                            foreach (var item in resultPaysList)
                            {
                                if (null != item.MemberId)
                                {
                                    Notification.Instance.ActionMember(this, new Member()
                                    {
                                        MemberId = item.MemberId.Value
                                    }, null);
                                    item.MemberId = item.tb_member.MemberId;
                                }
                            }
                        }
                    }

                    this.BeginInvoke(new Action(() =>
                    {
                        if (result.Result)
                        {
                            Print.Instance.PrintTakeoutAfterCheckout(takeout, details);
                            KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("OperateSuccess"), SucMsgName), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            DialogResult = System.Windows.Forms.DialogResult.OK;
                            IsClose      = true;

                            Resources.GetRes().DefaultOrderLang = Resources.GetRes().GetMainLangByLangIndex((int)takeout.Lang).MainLangIndex;
                        }
                        else
                        {
                            if (result.IsRefreshSessionModel)
                            {
                                KryptonMessageBox.Show(this, Resources.GetRes().GetString("FaildThenRefreshModel"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                DialogResult = System.Windows.Forms.DialogResult.Retry;
                                IsClose      = true;
                            }
                            else if (result.IsSessionModelSameTimeOperate)
                            {
                                KryptonMessageBox.Show(this, Resources.GetRes().GetString("FaildThenWaitRetry"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("OperateFaild"), ErrMsgName), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    this.BeginInvoke(new Action(() =>
                    {
                        ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                        {
                            KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }), false, string.Format(Resources.GetRes().GetString("OperateFaild"), ErrMsgName));
                    }));
                }


                if (IsClose)
                {
                    this.BeginInvoke(new Action(() =>
                    {
                        this.Close();
                    }));
                }

                StopLoad(this, null);
            });
        }
        private void SelectedGroupByMatch(ImageListView imageListView,
                                          bool checkFileCreated, bool checkMediaTaken, bool checkAllDates, int maxDayRange,
                                          bool checkLocationName, bool checkLocationCity, bool checkLocationDistrict, bool checkLocationCountry, bool checkAllLocations)
        {
            try
            {
                ImageListViewHandler.SuspendLayout(imageListView1);
                ImageListViewHandler.Enable(imageListView, false);
                TreeViewFolderBrowserHandler.Enabled(treeViewFolderBrowser1, false);
                GlobalData.DoNotTrigger_ImageListView_SelectionChanged = true;

                #region Do the work
                using (new WaitCursor())
                {
                    ImageListViewItemCollection imageListViewItems = imageListView.Items;

                    List <GroupMacth> groupMacthSourceList = new List <GroupMacth>();


                    #region Init
                    foreach (ImageListViewItem imageListViewItem in imageListView.SelectedItems)
                    {
                        Metadata metadata = databaseAndCacheMetadataExiftool.ReadMetadataFromCacheOnly(new FileEntryBroker(imageListViewItem.FileFullPath, imageListViewItem.DateModified, MetadataBrokerType.ExifTool));

                        GroupMacth groupMacthSource = new GroupMacth();
                        groupMacthSource.IsMetadataNull   = (metadata == null);
                        groupMacthSource.FileDate         = imageListViewItem.Date;
                        groupMacthSource.MediaTaken       = metadata?.MediaDateTaken;
                        groupMacthSource.LocationName     = metadata?.LocationName;
                        groupMacthSource.LocationCity     = metadata?.LocationCity;
                        groupMacthSource.LocationDistrict = metadata?.LocationState;
                        groupMacthSource.LocationCountry  = metadata?.LocationCountry;
                        groupMacthSourceList.Add(groupMacthSource);
                    }
                    #endregion


                    imageListView.ClearSelection();

                    #region Find and Select
                    foreach (ImageListViewItem imageListViewItem in imageListView.Items)
                    {
                        Metadata metadata = databaseAndCacheMetadataExiftool.ReadMetadataFromCacheOnly(new FileEntryBroker(imageListViewItem.FileFullPath, imageListViewItem.DateModified, MetadataBrokerType.ExifTool));

                        GroupMacth groupMacthCheckWith = new GroupMacth();
                        groupMacthCheckWith.IsMetadataNull   = (metadata == null);
                        groupMacthCheckWith.FileDate         = imageListViewItem.Date;
                        groupMacthCheckWith.MediaTaken       = metadata?.MediaDateTaken;
                        groupMacthCheckWith.LocationName     = metadata?.LocationName;
                        groupMacthCheckWith.LocationCity     = metadata?.LocationCity;
                        groupMacthCheckWith.LocationDistrict = metadata?.LocationState;
                        groupMacthCheckWith.LocationCountry  = metadata?.LocationCountry;

                        bool isItemsEqual = false;

                        foreach (GroupMacth groupMacthSource in groupMacthSourceList)
                        {
                            isItemsEqual = GroupMacth.IsMatch(groupMacthSource, groupMacthCheckWith, checkFileCreated, checkMediaTaken,
                                                              checkAllDates, maxDayRange,
                                                              checkLocationName, checkLocationCity, checkLocationDistrict, checkLocationCountry, checkAllLocations);
                            if (isItemsEqual)
                            {
                                break;
                            }
                        }

                        if (isItemsEqual)
                        {
                            imageListViewItem.Selected = true;
                        }
                        else
                        {
                            imageListViewItem.Selected = false;
                        }
                    }
                    #endregion
                }
                #endregion
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                KryptonMessageBox.Show("Unexpected error occur.\r\nException message:" + ex.Message + "\r\n",
                                       "Unexpected error occur", MessageBoxButtons.OK, MessageBoxIcon.Error, showCtrlCopy: true);
            }
            finally
            {
                GlobalData.DoNotTrigger_ImageListView_SelectionChanged = false;
                TreeViewFolderBrowserHandler.Enabled(treeViewFolderBrowser1, true);
                ImageListViewHandler.Enable(imageListView, true);
                ImageListViewHandler.ResumeLayout(imageListView1);

                imageListView.Focus();

                ImageListView_SelectionChanged_Action_ImageListView_DataGridView(false);
            }
        }
 private void helpToolStripButton_Click(object sender, EventArgs e)
 {
     //KryptonMessageBox.Show(this, "Set the KryptonManager Blur values", "Did the Parent Form Blur?");
     KryptonMessageBox.Show("Set the KryptonManager Blur values", "Did the Parent Form Blur?");
 }
Beispiel #18
0
 private static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
 {
     KryptonMessageBox.Show($"Wystąpił błąd w {nameof(Program)}, treść : {e.Exception.Message}");
     Application.Exit();
 }
Beispiel #19
0
 private void horaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     KryptonMessageBox.Show(daoUtil.GetDateServidor().ToString(), Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Beispiel #20
0
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     KryptonMessageBox.Show($"Wystąpił błąd w {nameof(Program)}, treść : {(e.ExceptionObject as Exception).Message}");
     Application.Exit();
 }
Beispiel #21
0
        /// <summary>
        ///  卸载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            string Accessory_code = this.textBox1.Text.ToString().Trim().ToUpper();

            //判断已装载的配件是否卸载,如果已卸载,不可重复卸载
            #region
            //string RecordsJson1 = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "GetMachineAccessory", Accessory_code + "," + machine_code);
            //List<B_Machine_Accessories> ListAccessory = JsonConvert.DeserializeObject<List<B_Machine_Accessories>>(RecordsJson1);
            //if (ListAccessory != null)
            //{
            //    foreach (var item in ListAccessory)
            //    {
            //        if (item.accessory_isload == 0)
            //        {
            //            MessageBox.Show("编码为[" + Accessory_code + "]的配件已卸载!", "提示");
            //            return;
            //        }
            //    }
            //}
            #endregion
            string RecordsJson1 = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "GetMachineAccessoryLoad_1", machine_code + "," + Accessory_code);
            List <P_Accessoris_Load> ListAccessory = JsonConvert.DeserializeObject <List <P_Accessoris_Load> >(RecordsJson1);
            if (ListAccessory == null)
            {
                MessageBox.Show("编码为[" + Accessory_code + "]的配件已卸载!", "提示");
                return;
            }
            DialogResult result = KryptonMessageBox.Show("确定卸载吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (result == System.Windows.Forms.DialogResult.No)
            {
                return;
            }
            string RecordsJson = Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "GetMachineAccessoryRecords_0", Accessory_code + "," + machine_code);
            List <P_Accessory_Records> ListAccessoryRecords = JsonConvert.DeserializeObject <List <P_Accessory_Records> >(RecordsJson);
            if (ListAccessoryRecords == null)
            {
                //说明第一次装载备件,啥也不干
            }
            else
            {
                Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "UpdateMachineAccessoryRecord_1", Accessory_code + "," + machine_code);
            }
            try
            {
                P_Accessory_Records Sparepart = new P_Accessory_Records()
                {
                    Accessory_code   = Accessory_code,
                    machine_code     = machine_code,
                    type             = 1,
                    state            = 0,
                    loadtime         = DateTime.Now,
                    input_time       = DateTime.Now,
                    Accessory_preson = Ecode,
                };
                string strJson = JsonToolsNet.ObjectToJson(Sparepart);
                Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "AddMachineAccessoryRecord_0", strJson);
                Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "DeleteAccessoryLoad", Accessory_code);
                Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "UpdateAccessorystate_0", Accessory_code);
                //Tools.ServiceReferenceManager.GetClient().RunServerAPI("BLL.Machine", "UpdateMachineAccessoryIsLoad_1", Accessory_code);
                //MessageBox.Show("卸载成功", "提示");
            }
            catch (Exception ex)
            {
                MessageBox.Show("卸载失败", "提示");
                return;
            }
            initAccessoryRecords(2, "");
            GetAccessoryType();
            this.textBox1.Text = "";
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string msg = "";

            //if (optadd.Checked)
            //{
            try
            {
                double EnteredAmount = Convert.ToDouble((txtAmount.Text.Trim().CompareTo("") != 0 ? txtAmount.Text.Trim() : "0"));
                double PaidAmount    = 0;
                if (Validate('A', out msg))
                {
                    int i = 0;
                    if (lvw.Items.Count > 0)
                    {
                        foreach (ListViewItem lm in lvw.Items)
                        {
                            if (EnteredAmount > 0)
                            {
                                //bl_obj.SalesRecoveryId = Convert.ToInt32(txtSalesRecoveryId.Text);
                                bl_obj.Purchase_Id = Convert.ToInt32(lm.SubItems[4].Text);
                                if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) < EnteredAmount)
                                {
                                    bl_obj.Amount = Convert.ToDouble(lm.SubItems[2].Text.Trim());
                                    PaidAmount    = Convert.ToDouble(lm.SubItems[2].Text.Trim());
                                }
                                else if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) == EnteredAmount)
                                {
                                    bl_obj.Amount = Convert.ToDouble(lm.SubItems[2].Text.Trim());
                                    PaidAmount    = Convert.ToDouble(lm.SubItems[2].Text.Trim());
                                }
                                else
                                {
                                    bl_obj.Amount = Convert.ToDouble(EnteredAmount);
                                    PaidAmount    = Convert.ToDouble(EnteredAmount);
                                }
                                //bl_obj.Amount = Convert.ToDouble(lm.SubItems[2].Text);
                                bl_obj.Tran_Date = dtpDate.Value.ToString("yyyy-MM-dd");
                                //FillLVW(bl_obj.INSERT(bl_obj));
                                DataSet ds1 = bl_obj.INSERT(bl_obj);

                                ParaName.Clear();
                                Para.Clear();
                                ParaName.Add("@Cust_ID");
                                ParaName.Add("@To_Acc");
                                ParaName.Add("@Day_Cash");
                                ParaName.Add("@Paid_Cash");
                                ParaName.Add("@Pay_Mode_Id");
                                ParaName.Add("@Description");
                                ParaName.Add("@Tran_Type");
                                ParaName.Add("@Cust_Type");
                                ParaName.Add("@User_ID");
                                ParaName.Add("@Flag");
                                ParaName.Add("@Tran_Number");
                                ParaName.Add("@Tran_Date");
                                ParaName.Add("@Voucher_No");

                                Para.Add(cmdName.SelectedValue.ToString());
                                Para.Add(cmbAccount.SelectedIndex == 0 ? "0" : cmbAccount.SelectedValue.ToString());

                                Para.Add(i == 0 ? txtAmount.Text.Trim() : "0");
                                if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) < EnteredAmount)
                                {
                                    Para.Add(lm.SubItems[2].Text.Trim());
                                }
                                else if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) == EnteredAmount)
                                {
                                    Para.Add(lm.SubItems[2].Text.Trim());
                                }
                                else
                                {
                                    Para.Add(EnteredAmount.ToString());
                                }


                                Para.Add(cmbPayMode.SelectedIndex == 0 ? "0" : cmbPayMode.SelectedValue.ToString());
                                Para.Add(txtDescription.Text.Trim());
                                Para.Add("VP");
                                Para.Add("S");
                                Para.Add(MODULE.glb["SHOP_ID"].ToString());
                                Para.Add("A");
                                Para.Add(lm.SubItems[4].Text);
                                Para.Add(dtpDate.Value.ToString("yyyy-MM-dd"));
                                Para.Add(Voucher_ID);//For Voucher Number
                                bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details");
                                EnteredAmount = EnteredAmount - PaidAmount;
                                i++;
                            }
                        }
                    }
                    //else
                    //{
                    if (EnteredAmount != 0)
                    {
                        ParaName.Clear();
                        Para.Clear();
                        ParaName.Add("@Cust_ID");
                        ParaName.Add("@To_Acc");
                        ParaName.Add("@Day_Cash");
                        ParaName.Add("@Paid_Cash");
                        ParaName.Add("@Pay_Mode_Id");
                        ParaName.Add("@Description");
                        ParaName.Add("@Tran_Type");
                        ParaName.Add("@Cust_Type");
                        ParaName.Add("@User_ID");
                        ParaName.Add("@Flag");
                        ParaName.Add("@Tran_Number");
                        ParaName.Add("@Tran_Date");
                        ParaName.Add("@Voucher_No");

                        Para.Add(cmdName.SelectedValue.ToString());
                        Para.Add(cmbAccount.SelectedIndex == 0 ? "0" : cmbAccount.SelectedValue.ToString());


                        Para.Add("0");
                        Para.Add(EnteredAmount.ToString());
                        Para.Add(cmbPayMode.SelectedIndex == 0 ? "0" : cmbPayMode.SelectedValue.ToString());
                        Para.Add(txtDescription.Text.Trim());
                        Para.Add("VP");
                        Para.Add("S");
                        Para.Add(MODULE.glb["SHOP_ID"].ToString());
                        Para.Add("A");
                        Para.Add("0");
                        Para.Add(dtpDate.Value.ToString("yyyy-MM-dd"));
                        Para.Add(Voucher_ID);    //For Voucher Number
                        bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details");
                    }
                    //}
                    KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearControls();
                    DataTable dt1 = new DataTable();
                    GetVoucherNo(dt1);
                    rbadd.Checked = true;
                    cmdName.Focus();
                }
                else
                {
                    MyMessageBox.ShowBox(msg);
                }
            }
            catch (Exception err) { err.GetBaseException(); }
        }
Beispiel #23
0
        private async void kryptonButton1_Click(object sender, EventArgs e)
        {
            //Resolutions
            if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1920x1080")
            {
                Task <int> restask = ResolutionFix(1920, 1080);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1920x1200")
            {
                Task <int> restask = ResolutionFix(1920, 1200);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1680x1080")
            {
                Task <int> restask = ResolutionFix(1680, 1080);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1680x1050")
            {
                Task <int> restask = ResolutionFix(1680, 1050);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1600x900")
            {
                Task <int> restask = ResolutionFix(1600, 900);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1400x1050")
            {
                Task <int> restask = ResolutionFix(1400, 1050);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1440x900")
            {
                Task <int> restask = ResolutionFix(1400, 900);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Set Game Resolution To 1280x1024")
            {
                Task <int> restask = ResolutionFix(1280, 1024);
                int        moderes = await restask;
            }
            else if (VDOC.SelectedItem.ToString() == @"Auto Set Game Resolution To Desktop's")
            {
                string     screenWidth  = Screen.PrimaryScreen.Bounds.Width.ToString();
                string     screenHeight = Screen.PrimaryScreen.Bounds.Height.ToString();
                Task <int> restask      = ResolutionFix(Convert.ToInt32(screenWidth), Convert.ToInt32(screenHeight));
                int        moderes      = await restask;
                KryptonMessageBox.Show("Game Resolution is set to " + screenWidth + "x" + screenHeight);
            }
            //Voobly Issues
            else if (VDOC.SelectedItem.ToString() == @"Fix Voobly Messenger Chat Window")
            {
                using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Microsoft Games\Age of Empires II: The Conquerors Expansion\1.0", true))
                {
                    key.SetValue("CChatDialogMaximized", "false", RegistryValueKind.String);
                    key.SetValue("CChatDialogPosX", 0, RegistryValueKind.DWord);
                    key.SetValue("CChatDialogPosY", 0, RegistryValueKind.DWord);
                }
                KryptonMessageBox.Show("Voobly Chat Window Fixed! Please Restart Voobly For The Changes To Take Effect.");
            }
            else if (VDOC.SelectedItem.ToString() == @"Voobly Game Room - Enable Wololokingdoms Mod")
            {
                //Set WK MOd
                Microsoft.Win32.RegistryKey rkey13;
                rkey13 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\482");
                rkey13.SetValue("gamemod", "WololoKingdoms");
                rkey13.Close();

                Microsoft.Win32.RegistryKey rkey14;
                rkey14 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\251");
                rkey14.SetValue("gamemod", "WololoKingdoms");
                rkey14.Close();

                Microsoft.Win32.RegistryKey rkey15;
                rkey15 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\64");
                rkey15.SetValue("gamemod", "WololoKingdoms");
                rkey15.Close();

                KryptonMessageBox.Show("Wololokingdoms Mod is successfully checked!");
            }
            else if (VDOC.SelectedItem.ToString() == @"Clear Voobly Game Room Title & Description")
            {
                //Set WK MOd
                Microsoft.Win32.RegistryKey rkey13;
                rkey13 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\482");
                rkey13.SetValue("description", "");
                rkey13.SetValue("title", "");
                rkey13.Close();

                Microsoft.Win32.RegistryKey rkey14;
                rkey14 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\251");
                rkey14.SetValue("description", "");
                rkey13.SetValue("title", "");
                rkey14.Close();

                Microsoft.Win32.RegistryKey rkey15;
                rkey15 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\64");
                rkey15.SetValue("description", "");
                rkey13.SetValue("title", "");
                rkey15.Close();

                KryptonMessageBox.Show("Voobly Game Room Title & Description are successfully cleared!");
            }
            else if (VDOC.SelectedItem.ToString() == @"Voobly Game Room Settings")
            {
                Microsoft.Win32.RegistryKey rkey8;
                rkey8 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\game\13");
                rkey8.SetValue("dxtool", "true");
                rkey8.SetValue("windowmode", "true");
                rkey8.SetValue("hidewindowtitle", "true");
                rkey8.SetValue("cursorlockenable", "true");
                rkey8.SetValue("cursoringame", "false");
                rkey8.SetValue("enabledxtoggle", "false");
                rkey8.SetValue("disabledxhwaccel", "false");
                rkey8.SetValue("Keydown Object Hotkeys", "true");
                rkey8.SetValue("launchtosingle", "true");
                rkey8.Close();

                Microsoft.Win32.RegistryKey rkey9;
                rkey9 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\game\13");
                rkey9.SetValue("Enable Water Animation", "false");
                rkey9.SetValue("Disable Water Movement", "true");
                rkey9.SetValue("Disable Custom Terrains", "false");
                rkey9.SetValue("Disable Weather System", "true");
                rkey9.SetValue("Custom Normal Mouse", "false");
                rkey9.SetValue("Spectator Only Effects", "false");
                rkey9.SetValue("Lower Quality Environment", "false");
                rkey9.SetValue("Precision Scrolling System", "false");
                rkey9.SetValue("Original Patrol Default", "false");
                rkey9.SetValue("Multiple Building Queue", "true");
                rkey9.SetValue("Keydown Object Hotkeys", "true");
                rkey9.SetValue("Disable Extended Hotkeys", "false");
                rkey9.SetValue("Shift Group Appending", "true");
                rkey9.SetValue("Touch Screen Control", "false");
                rkey9.SetValue("Numeric Age Display", "true");
                rkey9.SetValue("Delink System Volume", "false");
                rkey9.SetValue("Alternate Wine Chat", "false");
                rkey9.SetValue("Low Simulation Rate", "false");
                rkey9.Close();

                Microsoft.Win32.RegistryKey rkey10;
                rkey10 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\64");
                rkey10.SetValue("title", "New Game Title");
                rkey10.SetValue("password", "");
                rkey10.SetValue("description", "Converted With Love By AoE2Tools");
                rkey10.SetValue("adlink", "");
                rkey10.SetValue("adimage", "");
                rkey10.SetValue("players", 8, RegistryValueKind.DWord);
                rkey10.SetValue("teamonly", "false");
                rkey10.SetValue("anticheat", "true");
                rkey10.SetValue("rated", "true");
                rkey10.SetValue("ratedrange", "false");
                rkey10.SetValue("ratedmin", 0, RegistryValueKind.DWord);
                rkey10.SetValue("ratedmax", 9999, RegistryValueKind.DWord);
                rkey10.SetValue("nat", "true");
                rkey10.SetValue("gamemod", "");
                rkey10.SetValue("gamepatch", "v1.5 RC");
                rkey10.SetValue("ladderid", 83, RegistryValueKind.DWord);
                rkey10.SetValue("players", 90, RegistryValueKind.DWord);
                rkey10.SetValue("hiddencivs", "false");
                rkey10.SetValue("spectateJoinAs", "false");
                rkey10.SetValue("spectateUsersCanToggle", "true");
                rkey10.SetValue("spectateLateJoin", "true");
                rkey10.SetValue("spectatorNoGameRoomChat", "false");
                rkey10.SetValue("spectateServerAlwaysOn", "false");
                rkey10.Close();

                Microsoft.Win32.RegistryKey rkey11;
                rkey11 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\251");
                rkey11.SetValue("title", "New Game Title");
                rkey11.SetValue("password", "");
                rkey11.SetValue("description", "Converted With Love By AoE2Tools");
                rkey11.SetValue("adlink", "");
                rkey11.SetValue("adimage", "");
                rkey11.SetValue("players", 8, RegistryValueKind.DWord);
                rkey11.SetValue("teamonly", "false");
                rkey11.SetValue("anticheat", "true");
                rkey11.SetValue("rated", "true");
                rkey11.SetValue("ratedrange", "false");
                rkey11.SetValue("ratedmin", 0, RegistryValueKind.DWord);
                rkey11.SetValue("ratedmax", 9999, RegistryValueKind.DWord);
                rkey11.SetValue("nat", "true");
                rkey11.SetValue("gamemod", "");
                rkey11.SetValue("gamepatch", "v1.5 RC");
                rkey11.SetValue("ladderid", 83, RegistryValueKind.DWord);
                rkey11.SetValue("players", 90, RegistryValueKind.DWord);
                rkey11.SetValue("hiddencivs", "false");
                rkey11.SetValue("spectateJoinAs", "false");
                rkey11.SetValue("spectateUsersCanToggle", "true");
                rkey11.SetValue("spectateLateJoin", "true");
                rkey11.SetValue("spectatorNoGameRoomChat", "false");
                rkey11.SetValue("spectateServerAlwaysOn", "false");
                rkey11.Close();

                Microsoft.Win32.RegistryKey rkey12;
                rkey12 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\game\13\v1.5 RC");
                rkey12.SetValue("Enable Water Animation", "false");
                rkey12.SetValue("Disable Water Movement", "true");
                rkey12.SetValue("Disable Custom Terrains", "false");
                rkey12.SetValue("Disable Weather System", "true");
                rkey12.SetValue("Custom Normal Mouse", "false");
                rkey12.SetValue("Spectator Only Effects", "false");
                rkey12.SetValue("Lower Quality Environment", "false");
                rkey12.SetValue("Precision Scrolling System", "false");
                rkey12.SetValue("Original Patrol Default", "false");
                rkey12.SetValue("Multiple Building Queue", "true");
                rkey12.SetValue("Keydown Object Hotkeys", "true");
                rkey12.SetValue("Disable Extended Hotkeys", "false");
                rkey12.SetValue("Shift Group Appending", "true");
                rkey12.SetValue("Touch Screen Control", "false");
                rkey12.SetValue("Numeric Age Display", "true");
                rkey12.SetValue("Delink System Volume", "false");
                rkey12.SetValue("Alternate Wine Chat", "false");
                rkey12.SetValue("Low Simulation Rate", "false");
                rkey12.Close();

                Microsoft.Win32.RegistryKey rkey13;
                rkey13 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Voobly\Voobly\gameroom\482");
                rkey13.SetValue("title", "New Game Title");
                rkey13.SetValue("password", "");
                rkey13.SetValue("description", "Converted With Love By AoE2Tools");
                rkey13.SetValue("adlink", "");
                rkey13.SetValue("adimage", "");
                rkey13.SetValue("players", 8, RegistryValueKind.DWord);
                rkey13.SetValue("teamonly", "false");
                rkey13.SetValue("anticheat", "true");
                rkey13.SetValue("rated", "true");
                rkey13.SetValue("ratedrange", "false");
                rkey13.SetValue("ratedmin", 0, RegistryValueKind.DWord);
                rkey13.SetValue("ratedmax", 9999, RegistryValueKind.DWord);
                rkey13.SetValue("nat", "true");
                rkey13.SetValue("gamemod", "");
                rkey13.SetValue("gamepatch", "v1.5 RC");
                rkey13.SetValue("ladderid", 83, RegistryValueKind.DWord);
                rkey13.SetValue("players", 90, RegistryValueKind.DWord);
                rkey13.SetValue("hiddencivs", "false");
                rkey13.SetValue("spectateJoinAs", "false");
                rkey13.SetValue("spectateUsersCanToggle", "true");
                rkey13.SetValue("spectateLateJoin", "true");
                rkey13.SetValue("spectatorNoGameRoomChat", "false");
                rkey13.SetValue("spectateServerAlwaysOn", "false");
                rkey13.Close();

                KryptonMessageBox.Show("Voobly Game Room Settings successfully applied for all lobbies!");
            }
            else if (VDOC.SelectedItem.ToString() == @"Enable Advanced Command Buttons")
            {
                using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Microsoft Games\Age of Empires II: The Conquerors Expansion\1.0", true))
                {
                    key.SetValue("Advanced Buttons", 1, RegistryValueKind.DWord);
                }

                KryptonMessageBox.Show("Advanced Command Buttons are successfully enabled!");
            }
            else if (VDOC.SelectedItem.ToString() == @"Fix Couldn't Display Or DirectDraw Display Error")
            {
                FixDirectDraw fixdd = new FixDirectDraw();
                fixdd.ShowDialog();
            }
            else
            {
                KryptonMessageBox.Show("Please Choose a Valid Selection.");
            }
        }
Beispiel #24
0
        private void BindingData()
        {
            //拷贝数据到新的【客房出租历史记录】对象
            history         = new 客房出租历史记录();//构造一个新的【客房出租历史记录】对象
            history.备注      = kf.备注;
            history.操作日期    = DateTime.Now;
            history.电话1     = kf.电话1;
            history.电话2     = kf.电话2;
            history.电始码     = kf.电始码;
            history.客房ID    = kf.ID; //此时因为还未加入context中,所以不会同步客房引用。
            history.联系地址    = kf.联系地址;
            history.期始      = kf.期始.Value;
            history.期止      = kf.期止.Value;
            history.气始码     = kf.气始码;
            history.身份证号    = kf.身份证号;
            history.水始码     = kf.水始码;
            history.押金      = kf.押金;
            history.月厨房费    = kf.月厨房费;
            history.月宽带费    = kf.月宽带费;
            history.月物业费    = kf.月物业费;
            history.月租金     = kf.月租金;
            history.支付月数    = kf.支付月数;
            history.中介费用    = kf.中介费用;
            history.租户      = kf.租户;
            history.租赁协议照片1 = kf.租赁协议照片1;
            history.租赁协议照片2 = kf.租赁协议照片2;
            history.租赁协议照片3 = kf.租赁协议照片3;


            if (collectRent != null)
            {
                context.客房租金明细.DeleteObject(collectRent); //删除前次新增的对象
            }
            btnOK.Enabled = true;                         //这里先置true,后续判断该租户没有交租记录会置false的。

            kryptonHeader1.Values.Heading     = kf.源房.房名;
            kryptonHeader1.Values.Description = kf.命名;
            租户Label1.Text  = kf.租户;
            协议期label1.Text = kf.期始.Value.ToShortDateString();
            协议期label2.Text = kf.期止.Value.ToShortDateString();

            //进入此界面,理论上客房应该出租了,有租户信息
#if DEBUG
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(kf.租户));
#endif
            //针对当前租户的所有协议历史缴费(包括之前续租的)
            List <客房租金明细> orderedList = 客房租金明细.GetRentDetails_Current(kf);
            参考历史BindingSource.DataSource = orderedList;

            if (orderedList.Count == 0)//该租户第一次交租
            {
                var result = KryptonMessageBox.Show("该租户没有交租记录,是否直接清除租户信息?\r\n(客房将转为【未出租】状态)",
                                                    "清除租户信息", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    kf.移除租户信息();
                    string msg;
                    if (Helper.saveData(context, kf, out msg))
                    {
                        KryptonMessageBox.Show(msg, "成功清除租户信息");
                        if (this.Owner is Main)
                        {
                            (this.Owner as Main).RefreshAndLocateTree(kf);//刷新TreeView,并定位到kf节点。
                        }
                        Close();
                    }
                    else
                    {
                        KryptonMessageBox.Show(msg, "失败");
                    }
                }
                else
                {
                    btnOK.Enabled = false;//保存按钮不可用,用户可以在此界面更改欲操作客房。
                }
                return;
            }
            else//非第一次交租情况下的退租:(有可能结算日期小于上次交租的期止时间,这时需要计算的是‘退款’)
            {
                bool IsDrawback = false;//是否为‘退款’
                myRtf = new MyRtf();                     //初始化
                客房租金明细 lastCollectRent = orderedList[0]; //最近交租明细记录

                //新对象,根据情况赋予初始值
                collectRent      = new 客房租金明细();
                collectRent.付款人  = kf.租户;
                collectRent.客房ID = kf.ID;
                //新对象的‘起付时间’与之前的‘止付时间’连续
                collectRent.起付日期 = lastCollectRent.止付日期.AddDays(1).Date;
                collectRent.止付日期 = dtpDateEnd.Value.Date;
                collectRent.水止码  = lastCollectRent.水止码;//止码设置为始码值,相当于没有用(用户会自行修改)
                collectRent.电止码  = lastCollectRent.电止码;
                collectRent.气止码  = lastCollectRent.气止码;

#if DEBUG
                System.Diagnostics.Debug.Assert(lastCollectRent.止付日期.Date <= kf.期止.Value.Date);
#endif
                if (dtpDateEnd.Value.Date == kf.期止.Value.Date)
                {
                    myRtf.结算日期VS协议期止日期 = "等于";
                    myRtf.退租类型         = "正常退租";
                    history.状态         = "正常退租";                       //正常退租状态下,转入历史记录的

                    if (lastCollectRent.止付日期.Date == kf.期止.Value.Date) //协议租金已全部收讫
                    {
                        collectRent.起付日期 = dtpDateEnd.Value.Date;      //这种情况,接下来只计算水电气费用
                    }
                }
                else if (dtpDateEnd.Value.Date > kf.期止.Value.Date)
                {
                    myRtf.结算日期VS协议期止日期 = "大于";
                    myRtf.退租类型         = "逾期退租";
                    history.状态         = "逾期退租"; //逾期退租状态下,转入历史记录的
                }
                else
                {
                    myRtf.结算日期VS协议期止日期 = "小于";
                    myRtf.退租类型         = "提前退租";
                    history.状态         = "提前退租";                           //提前退租状态下,转入历史记录的

                    if (dtpDateEnd.Value.Date < lastCollectRent.止付日期.Date) //需退款
                    {
                        IsDrawback = true;
                        //临时对起止日期赋值,退款操作统一计算这段时间应退款。
                        collectRent.起付日期 = dtpDateEnd.Value.Date.AddDays(1);
                        collectRent.止付日期 = lastCollectRent.止付日期.Date;
                    }
                }

                //计算支付月数
                if (dtpDateEnd.Value.Date == lastCollectRent.止付日期.Date)
                {
                    realMonthNum = 0;
                }
                else
                {
                    CaculateMonth(IsDrawback);
                }

                myRtf.退租支付期Begin = collectRent.起付日期.ToShortDateString();
                myRtf.退租支付期End   = collectRent.止付日期.ToShortDateString();

                //更新RichTextBox内容,并调整高度
                int cutHeight;
                richTbox.Rtf    = myRtf.getRTF(out cutHeight);
                richTbox.Height = 89 - cutHeight;  //89为原始高度
                this.Height     = 610 - cutHeight; //610为原始高度

                //计算该租户历史余款
                foreach (var rent in orderedList)
                {
                    balancePayment += rent.实付金额 - rent.应付金额;
                }

                水始码Label1.Text       = collectRent.水止码.ToString();
                电始码Label1.Text       = collectRent.电止码.ToString();
                气始码Label1.Text       = collectRent.气止码.ToString();
                月租金Label1.Text       = (kf.月租金 * realMonthNum).ToString("F2");
                月宽带费Label1.Text      = (kf.月宽带费 * realMonthNum).ToString("F2");
                月物业费Label1.Text      = (kf.月物业费 * realMonthNum).ToString("F2");
                月厨房费Label1.Text      = (kf.月厨房费 * realMonthNum).ToString("F2");
                押金Label1.Text        = kf.押金.ToString("F2");
                lblBalance.Text      = balancePayment.ToString("F2");
                lblBalance.ForeColor = balancePayment >= 0 ? Color.Green : Color.Red;//历史欠款的话,红色

                CaculateSum();

                context.客房租金明细.AddObject(collectRent);//此操作后可实现外键同步
                客房租金明细BindingSource.DataSource = collectRent;
                //----------
                nud水费.Minimum = (decimal)collectRent.水止码;
                nud电费.Minimum = (decimal)collectRent.电止码;
                nud气费.Minimum = (decimal)collectRent.气止码;
            }
        }
Beispiel #25
0
        //protected void fill_lvw(DataSet ds)
        //{
        //    List<String> col = new List<string>();
        //    col.Add("0");
        //    col.Add("1");
        //    col.Add("2");
        //    col.Add("3");
        //    List<String> col_name = new List<string>();
        //    col_name.Add("ExpencesName");
        //    col_name.Add("Trans_Date");
        //    col_name.Add("Description");
        //    col_name.Add("Amount");
        //    //col_name.Add("IsActive");
        //    List<string> col_Size = new List<string>();
        //    col_Size.Add("10");
        //    col_Size.Add("10");
        //    col_Size.Add("10");
        //    col_Size.Add("10");
        //    function.filllvw(lvw, ds, col, col_name, 0, 0, 0);
        //}

        private void btnsave_Click(object sender, EventArgs e)
        {
            string msg = "";

            if (optadd.Checked)
            {
                if (Validate('A', out msg))
                {
                    bl_obj.ExpencesId = int.Parse(comboExpenceName.SelectedValue.ToString());
                    bl_obj.TransDate  = tDate.Value.ToShortDateString();
                    bl_obj.SysDate    = DateTime.Now.ToString();
                    bl_obj.Desc       = txtDescription.Text;
                    bl_obj.Amount     = double.Parse(txtAmount.Text);
                    FillLVW(bl_obj.INSERT(bl_obj));
                    ClearControls();
                    KryptonMessageBox.Show("Record Save Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MyMessageBox.ShowBox(msg);
                }
            }
            else if (optupdate.Checked)
            {
                if (Validate('U', out msg))
                {
                    bl_obj.TranExpencesId = Convert.ToInt32(txtTransactionId.Text);
                    bl_obj.ExpencesId     = int.Parse(comboExpenceName.SelectedValue.ToString());
                    bl_obj.TransDate      = tDate.Value.ToShortDateString();
                    bl_obj.SysDate        = DateTime.Now.ToString();
                    bl_obj.Desc           = txtDescription.Text;
                    bl_obj.Amount         = double.Parse(txtAmount.Text);
                    FillLVW(bl_obj.UPDATE(bl_obj));
                    ClearControls();
                    KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MyMessageBox.ShowBox(msg);
                }
            }
            else if (optdelete.Checked)
            {
                if (Validate('D', out msg))
                {
                    if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        foreach (ListViewItem l in lvw.CheckedItems)
                        {
                            //bl_obj.RowMaterialId = Convert.ToInt32(l.Tag.ToString());
                            bl_obj.TranExpencesId = Convert.ToInt32(l.Tag.ToString());
                            //bl_obj.TranExpencesId = Convert.ToInt32(txtTransactionId.Text);
                            bl_obj.DELETE(bl_obj);
                        }
                        FillLVW(bl_obj.select(bl_obj));
                        ClearControls();
                        KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MyMessageBox.ShowBox(msg);
                }
            }
        }
Beispiel #26
0
 private void buttonShow_Click(object sender, EventArgs e)
 {
     KryptonMessageBox.Show(textBoxMessage.Text, textBoxCaption.Text, _mbButtons, _mbIcon);
 }
        public void ImportColourScheme(KryptonPalette palette)
        {
            try
            {
                //palette = new KryptonPalette();

                //palette.Import();

                _colourSettingsManager.SetBaseColour(palette.ButtonStyles.ButtonCommon.OverrideDefault.Back.Color1);

                _colourSettingsManager.SetDarkColour(palette.ButtonStyles.ButtonCluster.StatePressed.Back.Color1);

                _colourSettingsManager.SetMediumColour(palette.ButtonStyles.ButtonCluster.StateNormal.Back.Color1);

                _colourSettingsManager.SetLightColour(palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color2);

                _colourSettingsManager.SetLightestColour(palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color1);

                _colourSettingsManager.SetBorderColour(Color.Gray); // Need work

                _colourSettingsManager.SetAlternativeNormalTextColour(palette.ButtonStyles.ButtonCommon.OverrideDefault.Content.LongText.Color1);

                _colourSettingsManager.SetNormalTextColour(palette.ButtonStyles.ButtonCommon.StateCheckedNormal.Content.LongText.Color1);

                _colourSettingsManager.SetFocusedTextColour(palette.ButtonStyles.ButtonCommon.OverrideFocus.Content.LongText.Color1);

                _colourSettingsManager.SetDisabledTextColour(palette.ButtonStyles.ButtonCommon.StateDisabled.Content.LongText.Color1);

                _colourSettingsManager.SetDisabledControlColour(palette.ButtonStyles.ButtonCommon.StateDisabled.Back.Color1);

                _colourSettingsManager.SetLinkNormalColour(palette.LabelStyles.LabelNormalControl.OverrideNotVisited.LongText.Color1);

                _colourSettingsManager.SetLinkHoverColour(palette.LabelStyles.LabelNormalControl.OverridePressed.LongText.Color1);

                _colourSettingsManager.SetLinkFocusedColour(palette.LabelStyles.LabelNormalControl.OverrideFocus.LongText.Color1);

                _colourSettingsManager.SetLinkVisitedColour(palette.LabelStyles.LabelNormalControl.OverrideVisited.LongText.Color1);



                _colourSettingsManager.SetMenuTextColour(palette.ToolMenuStatus.Menu.MenuItemText);

                _colourSettingsManager.SetStatusStripTextColour(palette.ToolMenuStatus.StatusStrip.StatusStripText);

                _colourSettingsManager.SaveAllMergedColourSettings();

                _globalStringSettingsManager.SetBasePaletteMode(palette.BasePaletteMode.ToString());

                _globalStringSettingsManager.SetFeedbackText("The import was successful.");

                _globalStringSettingsManager.SaveStringSettings();
            }
            catch (Exception exc)
            {
                KryptonMessageBox.Show($"Error: { exc.Message }", "Palette Import Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                _globalStringSettingsManager.SetFeedbackText("Failed to import colours!");

                _globalStringSettingsManager.SaveStringSettings();
            }
        }
        public void SaveSettings(bool useConfirmDialog = false)
        {
            _colourSettingsManager.ResetToDefaults();

            _colourSettingsManager.SaveAllMergedColourSettings(useConfirmDialog);

            try
            {
                if (BaseColour != null || DarkColour != null || MiddleColour != null || LightColour != null || LightestColour != null || BorderColourPreview != null || AlternativeNormalTextColourPreview != null || NormalTextColourPreview != null || DisabledTextColourPreview != null || FocusedTextColourPreview != null || PressedTextColourPreview != null || DisabledColourPreview != null || LinkNormalColourPreview != null || LinkHoverColourPreview != null || LinkVisitedColourPreview != null || CustomColourOne != null || CustomColourTwo != null || CustomColourThree != null || CustomColourFour != null || CustomColourFive != null || CustomTextColourOne != null || CustomTextColourTwo != null || CustomTextColourThree != null || CustomTextColourFour != null || CustomTextColourFive != null || MenuTextColour != null || StatusTextColour != null || RibbonTabTextColour != null)
                {
                    _colourSettingsManager.SetBaseColour(BaseColour);

                    _colourSettingsManager.SetDarkColour(DarkColour);

                    _colourSettingsManager.SetMediumColour(MiddleColour);

                    _colourSettingsManager.SetLightColour(LightColour);

                    _colourSettingsManager.SetLightestColour(LightestColour);

                    _colourSettingsManager.SetBorderColour(BorderColourPreview);

                    _colourSettingsManager.SetAlternativeNormalTextColour(AlternativeNormalTextColourPreview);

                    _colourSettingsManager.SetNormalTextColour(NormalTextColourPreview);

                    _colourSettingsManager.SetDisabledTextColour(DisabledTextColourPreview);

                    _colourSettingsManager.SetFocusedTextColour(FocusedTextColourPreview);

                    _colourSettingsManager.SetPressedTextColour(PressedTextColourPreview);

                    _colourSettingsManager.SetDisabledControlColour(DisabledColourPreview);

                    _colourSettingsManager.SetLinkNormalColour(LinkNormalColourPreview);

                    _colourSettingsManager.SetLinkHoverColour(LinkHoverColourPreview);

                    _colourSettingsManager.SetLinkVisitedColour(LinkVisitedColourPreview);

                    _colourSettingsManager.SetCustomColourOne(CustomColourOne);

                    _colourSettingsManager.SetCustomColourTwo(CustomColourTwo);

                    _colourSettingsManager.SetCustomColourThree(CustomColourThree);

                    _colourSettingsManager.SetCustomColourFour(CustomColourFour);

                    _colourSettingsManager.SetCustomColourFive(CustomColourFive);

                    _colourSettingsManager.SetCustomTextColourOne(CustomTextColourOne);

                    _colourSettingsManager.SetCustomTextColourTwo(CustomTextColourTwo);

                    _colourSettingsManager.SetCustomTextColourThree(CustomTextColourThree);

                    _colourSettingsManager.SetCustomTextColourFour(CustomTextColourFour);

                    _colourSettingsManager.SetCustomTextColourFive(CustomTextColourFive);

                    _colourSettingsManager.SetMenuTextColour(MenuTextColour);

                    _colourSettingsManager.SetStatusStripTextColour(StatusTextColour);

                    _colourSettingsManager.SetRibbonTabTextColour(RibbonTabTextColour);

                    _colourSettingsManager.SaveAllMergedColourSettings(useConfirmDialog);
                }
                else
                {
                    DialogResult result = KryptonMessageBox.Show("One or more colours are not defined, use white & black?", "Non-Defined Colours", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                }
            }
            catch (Exception exc)
            {
                ExceptionHandler.CaptureException(exc, icon: MessageBoxIcon.Error, methodSignature: Helpers.GetCurrentMethod());
            }
        }
Beispiel #29
0
        /// <summary>
        /// 保存新增或改动的数据
        /// </summary>
        private void Save()
        {
            if (null != krpdgList.SelectedRows[0])
            {
                //如果是插入
                if (krpdgList.SelectedRows[0].Cells["krpcmBalancePayId"].Value.ToString().Equals("-1"))
                {
                    BalancePay balancePay = new BalancePay();
                    try
                    {
                        balancePay.BalancePayId = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmBalancePayId"].Value.ToString());
                        balancePay.Price        = Math.Round(double.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrice"].Value.ToString()), 2);
                        balancePay.Remark       = GetValueOrNull(krpdgList.SelectedRows[0].Cells["krpcmRemark"].Value.ToString());
                        balancePay.BalanceId    = balance.BalanceId;
                    }
                    catch (Exception ex)
                    {
                        ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                        {
                            KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }), false, Resources.GetRes().GetString("SaveFailt"));
                        return;
                    }

                    StartLoad(this, null);

                    Task.Factory.StartNew(() =>
                    {
                        ResultModel result = new ResultModel();
                        try
                        {
                            BalancePay newBalancePay;
                            Balance balance;
                            result = OperatesService.GetOperates().ServiceAddBalancePay(balancePay, out newBalancePay, out balance);
                            this.BeginInvoke(new Action(() =>
                            {
                                if (result.Result)
                                {
                                    KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    krpdgList.SelectedRows[0].Cells["krpcmBalancePayId"].Value = newBalancePay.BalancePayId;
                                    krpdgList.SelectedRows[0].Cells["krpcmEdit"].Value         = "";

                                    krpdgList.SelectedRows[0].Cells["krpcmAddTime"].Value = DateTime.ParseExact(newBalancePay.AddTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm");
                                    this.balance     = balance;
                                    this.ReturnValue = balance;
                                    this.resultList.Insert(0, newBalancePay);
                                    this.commonPayList.Insert(0, new CommonPayModel(newBalancePay));

                                    krpdgList.SelectedRows[0].Cells["krpcmPrice"].ReadOnly       = true;
                                    krpdgList.SelectedRows[0].Cells["krpcmBalanceType"].ReadOnly = true;
                                    krpdgList.SelectedRows[0].Cells["krpcmRemark"].ReadOnly      = true;
                                    krptbEndTime.Text = DateTime.Now.AddMinutes(5).ToString("yyyyMMddHHmm");
                                }
                                else
                                {
                                    if (result.IsDataHasRefrence)
                                    {
                                        KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUsed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                    else if (result.UpdateModel)
                                    {
                                        KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUnSame"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                    else
                                    {
                                        KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                }
                            }));
                        }
                        catch (Exception ex)
                        {
                            this.BeginInvoke(new Action(() =>
                            {
                                ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                                {
                                    KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }), false, Resources.GetRes().GetString("SaveFailt"));
                            }));
                        }
                        StopLoad(this, null);
                    });
                }
                //如果是编辑
                else
                {
                    // 没有编辑, 也不能编辑
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// 保存新增或改动的数据
        /// </summary>
        private void Save()
        {
            if (null != krpdgList.SelectedRows[0])
            {
                //如果是插入
                if (krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString().Equals("-1"))
                {
                    Printer model = new Printer();
                    try
                    {
                        // 隐藏功能时先把必要的复制掉(比如语言)
                        Common.GetCommon().CopyForHide(krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"], true, false, krpcbMultipleLanguage.Checked);


                        model.PrinterId         = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString());
                        model.PrinterName0      = krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"].Value.ToString().Trim();
                        model.PrinterName1      = krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"].Value.ToString().Trim();
                        model.PrinterName2      = krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"].Value.ToString().Trim();
                        model.PrinterDeviceName = krpdgList.SelectedRows[0].Cells["krpcmPrinterDeviceName"].Value.ToString().Trim();
                        model.PrintType         = GetPrintTypeNo(krpdgList.SelectedRows[0].Cells["krpcmPrintType"].Value.ToString());
                        model.IsMain            = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsMain"].Value.ToString());
                        model.IsCashDrawer      = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value.ToString());
                        model.Lang     = GetLanguageNo(krpdgList.SelectedRows[0].Cells["krpcmLang"].Value.ToString());
                        model.Order    = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmOrder"].Value.ToString());
                        model.IsEnable = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsEnable"].Value.ToString());

                        //判断空
                        if (string.IsNullOrWhiteSpace(model.PrinterName0) || string.IsNullOrWhiteSpace(model.PrinterName1) || string.IsNullOrWhiteSpace(model.PrinterName2) || string.IsNullOrWhiteSpace(model.PrinterDeviceName))
                        {
                            KryptonMessageBox.Show(this, Resources.GetRes().GetString("CompleteInput"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        //判断是否已存在
                        if (Resources.GetRes().Printers.Where(x => (x.PrinterName0.Equals(model.PrinterName0, StringComparison.OrdinalIgnoreCase) || x.PrinterName1.Equals(model.PrinterName1, StringComparison.OrdinalIgnoreCase) || x.PrinterName2.Equals(model.PrinterName2, StringComparison.OrdinalIgnoreCase))).Count() > 0)
                        {
                            KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("PrinterName")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }


                        if (model.IsCashDrawer == 1 && model.PrintType != 0)
                        {
                            krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value = "0";
                            model.IsCashDrawer = 0;
                        }

                        if (model.IsCashDrawer == 1 && Resources.GetRes().Printers.Where(x => x.IsCashDrawer == 1).Count() > 0)
                        {
                            KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("CashDrawer")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                        {
                            KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }), false, Resources.GetRes().GetString("SaveFailt"));
                        return;
                    }

                    StartLoad(this, null);

                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            bool result = OperatesService.GetOperates().ServiceAddPrinter(model);

                            this.BeginInvoke(new Action(() =>
                            {
                                if (result)
                                {
                                    krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value = model.PrinterId;
                                    KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    krpdgList.SelectedRows[0].Cells["krpcmEdit"].Value = "";
                                    resultList.Insert(0, model);
                                    Resources.GetRes().Printers.Add(model);
                                    ReloadPrinterTextbox(true);
                                }
                                else
                                {
                                    KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }
                            }));
                        }
                        catch (Exception ex)
                        {
                            this.BeginInvoke(new Action(() =>
                            {
                                ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                                {
                                    KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }), false, Resources.GetRes().GetString("SaveFailt"));
                            }));
                        }
                        StopLoad(this, null);
                    });
                }
                //如果是编辑
                else
                {
                    Printer model = new Printer();
                    try
                    {
                        model.PrinterId = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString());

                        model = Resources.GetRes().Printers.Where(x => x.PrinterId == model.PrinterId).FirstOrDefault().FastCopy();

                        // 隐藏功能时先把必要的复制掉(比如语言)
                        Common.GetCommon().CopyForHide(krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"], false, Ext.AllSame(model.PrinterName0, model.PrinterName1, model.PrinterName2), krpcbMultipleLanguage.Checked);


                        model.PrinterName0      = krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"].Value.ToString().Trim();
                        model.PrinterName1      = krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"].Value.ToString().Trim();
                        model.PrinterName2      = krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"].Value.ToString().Trim();
                        model.PrinterDeviceName = krpdgList.SelectedRows[0].Cells["krpcmPrinterDeviceName"].Value.ToString().Trim();
                        model.PrintType         = GetPrintTypeNo(krpdgList.SelectedRows[0].Cells["krpcmPrintType"].Value.ToString());
                        model.IsMain            = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsMain"].Value.ToString());
                        model.IsCashDrawer      = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value.ToString());
                        model.Lang     = GetLanguageNo(krpdgList.SelectedRows[0].Cells["krpcmLang"].Value.ToString());
                        model.Order    = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmOrder"].Value.ToString());
                        model.IsEnable = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsEnable"].Value.ToString());

                        //判断空
                        if (string.IsNullOrWhiteSpace(model.PrinterName0) || string.IsNullOrWhiteSpace(model.PrinterName1) || string.IsNullOrWhiteSpace(model.PrinterName2) || string.IsNullOrWhiteSpace(model.PrinterDeviceName))
                        {
                            KryptonMessageBox.Show(this, Resources.GetRes().GetString("CompleteInput"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        //判断是否已存在
                        if (Resources.GetRes().Printers.Where(x => x.PrinterId != model.PrinterId && (x.PrinterName0.Equals(model.PrinterName0, StringComparison.OrdinalIgnoreCase) || x.PrinterName1.Equals(model.PrinterName1, StringComparison.OrdinalIgnoreCase) || x.PrinterName2.Equals(model.PrinterName2, StringComparison.OrdinalIgnoreCase))).Count() > 0)
                        {
                            KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("PrinterName")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        if (model.IsCashDrawer == 1 && model.PrintType != 0)
                        {
                            krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value = "0";
                            model.IsCashDrawer = 0;
                        }


                        if (model.IsCashDrawer == 1 && Resources.GetRes().Printers.Where(x => x.IsCashDrawer == 1 && x.PrinterId != model.PrinterId).Count() > 0)
                        {
                            KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("CashDrawer")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                        {
                            KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }), false, Resources.GetRes().GetString("SaveFailt"));
                        return;
                    }

                    StartLoad(this, null);

                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            ResultModel result = OperatesService.GetOperates().ServiceEditPrinter(model);

                            this.BeginInvoke(new Action(() =>
                            {
                                if (result.Result)
                                {
                                    KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    krpdgList.SelectedRows[0].Cells["krpcmEdit"].Value = "";
                                    Printer oldModel = resultList.Where(x => x.PrinterId == model.PrinterId).FirstOrDefault();

                                    int no = resultList.IndexOf(oldModel);
                                    resultList.RemoveAt(no);
                                    resultList.Insert(no, model);

                                    no = Resources.GetRes().Printers.IndexOf(oldModel);
                                    Resources.GetRes().Printers.RemoveAt(no);
                                    Resources.GetRes().Printers.Insert(no, model);

                                    ReloadPrinterTextbox(true);
                                }
                                else
                                {
                                    if (result.UpdateModel)
                                    {
                                        KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUnSame"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                    else
                                    {
                                        KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                }
                            }));
                        }
                        catch (Exception ex)
                        {
                            this.BeginInvoke(new Action(() =>
                            {
                                ExceptionPro.ExpLog(ex, new Action <string>((message) =>
                                {
                                    KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }), false, Resources.GetRes().GetString("SaveFailt"));
                            }));
                        }
                        StopLoad(this, null);
                    });
                }
            }
        }