示例#1
0
        private void execute <Object>(Object obj)
        {
            string st = obj as string;

            switch (st)
            {
            case "EditImage":
            {
                try
                {
                    var path        = F_File.browserFile("image | *.png;*.jpg;");
                    var bitmapImage = new BitmapImage(new Uri(path));
                    PICTURE_USER = F_Image.BitmapImage2Bytes(bitmapImage);
                }
                catch (Exception e)
                {
                    F_File.LogError(e);
                }
            }
            break;

            case "DeleteImage":
            {
                PICTURE_USER = new byte[] { };
            }
            break;

            case "Save":
            {
                if (PASSWORD == PASSWORD_CONFIRMATION)
                {
                    T_Helper.user.EditFromObject(getInput());
                    TableUsersViewModel.Send(null);
                    HeaderViewModel.Send(null);
                }
                else
                {
                    DialogError.Error();
                }
            }
            break;

            case "OverlayGridCancel":
            {
                TableUsersViewModel.Send(null);
            }
            break;

            default: break;
            }
        }
示例#2
0
        private void execute <Object>(Object obj)
        {
            string st = obj as string;

            switch (st)
            {
            case "EditImage":
            {
                try
                {
                    var path        = F_File.browserFile("image | *.png;*.jpg;");
                    var bitmapImage = new BitmapImage(new Uri(path));
                    PICTURE_WHOLESALER = F_Image.BitmapImage2Bytes(bitmapImage);
                }
                catch (Exception e)
                {
                    F_File.LogError(e);
                }
            }
            break;

            case "DeleteImage":
            {
                PICTURE_WHOLESALER = new byte[] { };
            }
            break;

            case "Save":
            {
                T_Helper.wholesaler.EditFromObject(getInput());
                TableWholesalerViewModel.Send(null);
            }
            break;

            case "OverlayGridCancel":
            {
                TableWholesalerViewModel.Send(null);
            }
            break;

            default: break;
            }
        }
示例#3
0
        private void execute <Object>(Object obj)
        {
            string st = obj as string;

            switch (st)
            {
            case "EditImage":
            {
                try
                {
                    var path = F_File.browserFile("image | *.png;*.jpg;");
                    if (path != "")
                    {
                        PICTURE = new byte[] { };
                    }
                }
                catch (Exception e)
                {
                    F_File.LogError(e);
                }
            }
            break;

            case "DeleteImage":
            {
                PICTURE = new byte[] { };
            }
            break;

            case "Save":
            {
                SaveInput();
                DialogInformation.OK();
            }
            break;

            default: break;
            }
        }
示例#4
0
        private void execute <Object>(Object obj)
        {
            string st = obj as string;

            switch (st)
            {
            case "DatabasePath":
            {
                TB_DatabasePath      = F_File.browserFile("Database | *.FDB;");
                C_Variables.DB_.file = TB_DatabasePath;
            }
            break;

            case "Save":
            {
                C_Setting_DB.SaveConfigDatabase();
            }
            break;

            case "Test":
            {
                if (T_Helper.IsNull())
                {
                    DialogError.Error();
                }
                else
                {
                    DialogInformation.OK();
                }
            }
            break;

            case "Shutdown":
            {
                if (DB_Access.GetInstatce().Shutdown())
                {
                    DialogInformation.OK();
                }
                else
                {
                    DialogError.Error();
                }
            }
            break;

            case "Backup":
            {
                if (DB_Access.GetInstatce().Backup() == "")
                {
                    DialogError.Error();
                }
                else
                {
                    DialogInformation.OK();
                }
            }
            break;

            case "Restore":
            {
                string p = F_File.browserFile("Database | *.FBK;");
                if (p == "")
                {
                    DialogError.Error(); break;
                }
                if (DB_Access.GetInstatce().Restore(p))
                {
                    DialogInformation.OK();
                }
                else
                {
                    DialogError.Error();
                }
            }
            break;

            case "CreateNew":
            {
                if (DB_Access.GetInstatce().CreateNew())
                {
                    DialogInformation.OK();
                }
                else
                {
                    DialogError.Error();
                }
            }
            break;

            case "Default":
            {
                C_Setting_DB.set_db_Default();
                TB_DatabaseDataSource = C_Variables.DB_.host;
                TB_DatabasePath       = C_Variables.DB_.file;
                TB_DatabasePort       = C_Variables.DB_.Port;
                TB_DatabaseUserID     = C_Variables.DB_.UserID;
                TB_DatabasePassword   = C_Variables.DB_.Password;
                ComboBoxSelected      = C_Variables.DB_.type == 0 ? "Default" : "Embedded";
            }
            break;

            case "Embedded":
            {
                C_Setting_DB.set_db_Embedded();
                TB_DatabaseDataSource = C_Variables.DB_.host;
                TB_DatabasePath       = C_Variables.DB_.file;
                TB_DatabasePort       = C_Variables.DB_.Port;
                TB_DatabaseUserID     = C_Variables.DB_.UserID;
                TB_DatabasePassword   = C_Variables.DB_.Password;
                ComboBoxSelected      = C_Variables.DB_.type == 0 ? "Default" : "Embedded";
            }
            break;

            default: break;
            }
        }