Exemplo n.º 1
0
        public MessageBoxOptions(string title, string message, MetroMessageBox.MessageBoxButtons buttons)
        {
            InitializeComponent();
            DwmDropShadow.DropShadowToWindow(this);

            lblTitle.Text = title;
            lblSubInfo.Text = message;

            switch(buttons)
            {
                case MetroMessageBox.MessageBoxButtons.OK:
                    btnOkay.Visibility = Visibility.Visible;

                    btnOkay.IsDefault = true;
                    btnOkay.IsCancel = true;
                    break;
                case MetroMessageBox.MessageBoxButtons.OKCancel:
                    btnOkay.Visibility = Visibility.Visible;
                    btnCancel.Visibility = Visibility.Visible;

                    btnOkay.IsDefault = true;
                    btnCancel.IsCancel = true;
                    break;
                case MetroMessageBox.MessageBoxButtons.YesNo:
                    btnYes.Visibility = Visibility.Visible;
                    btnNo.Visibility = Visibility.Visible;

                    btnYes.IsDefault = true;
                    break;
                case MetroMessageBox.MessageBoxButtons.YesNoCancel:
                    btnYes.Visibility = Visibility.Visible;
                    btnNo.Visibility = Visibility.Visible;
                    btnCancel.Visibility = Visibility.Visible;

                    btnYes.IsDefault = true;
                    btnCancel.IsCancel = true;
                    break;
            }
        }
Exemplo n.º 2
0
        private async void HandleLogIn(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(Password))
            {
                MetroMessageBox.Show(this, "Campos vacios, escriba las credenciales", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning, 200);
                return;
            }
            var result = await loginPresenter.LoginUser();

            if (result is null)
            {
                MetroMessageBox.Show(this, "Login Incorrecto, Inténtelo de nuevo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning, 200);
            }
            else
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }

            if (!string.IsNullOrEmpty(UserEmailLoginTextbox.Text) && !string.IsNullOrEmpty(PasswordUserTextbox.Text))
            {
                MetroMessageBox.Show(this, "Campos vacios, escriba las credenciales", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning, 200);
            }
        }
Exemplo n.º 3
0
        private bool verificarCampos()
        {
            string error = ValidadoresComponent.VerificarLetras(txtNombre.Text);

            error = error + " " + ValidadoresComponent.VerificarLetras(txtApellido.Text);
            error = error + " " + ValidadoresComponent.VerificarNumerosIntervalo(txtDNI.Text, 52610644, 99999999);
            error = error + " " + ValidadoresComponent.VerificarAlfaNumerico(txtDireccion.Text);
            error = error + " " + ValidadoresComponent.VerificarContraseña(txtContraseña.Text);
            error = error + " " + ValidadoresComponent.VerificarNumerosIntervalo(txtTelefonoArea.Text, 10, 9999);
            error = error + " " + ValidadoresComponent.VerificarNumerosIntervalo(txtTelefono.Text, 100000, 99999999);

            error = error + " " + ValidadoresComponent.VerificarTamaño(txtTelefono.Text + txtTelefonoArea.Text, 10, 10);
            error = error + " " + ValidadoresComponent.VerificarEmail(txtEmail.Text);

            if (error.Length < 15)
            {
                return(true);
            }
            else
            {
                MetroMessageBox.Show(this, error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
Exemplo n.º 4
0
        private void RepositoryBrowser_FormClosing(object sender, FormClosingEventArgs e)
        {
            Path = repoDirectoryExplorer.mDirPath.Text;

            //Check is the path a valid git repository.
            if (!System.IO.Directory.Exists(Path + @"\.git") && !System.IO.File.Exists(Path + @"\.git"))
            {
                var result = MetroMessageBox.Show(this, "Path is not a valid git repository !", "Git Tray Warining Message", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
                if (result == DialogResult.Abort || result == DialogResult.Ignore)
                {
                    Path = string.Empty;
                }
                else
                {
                    e.Cancel = true; //Cancel closing of the form
                }
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;
                //Check and get the list of submodules
                SubModules = GitExtensions.PreProcessGitRepo(Path);
            }
        }
Exemplo n.º 5
0
        private void tmrTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                //se o valor da progressBar for menor 100
                if (pgbProgresso.Value < 100)
                {
                    //irá incrementar seu valor por valor + 2
                    pgbProgresso.Value += 2;
                }
                else
                {
                    //se não o timer será desabilitado
                    tmrTimer.Enabled = false;

                    //e habilitará o timer de fadeOut
                    tmrFadeOut.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "Ocorreu um erro", MessageBoxButtons.OK, MessageBoxIcon.Error, 200);
            }
        }
Exemplo n.º 6
0
        private void btnAgregarPermisoUsuario_Click(object sender, EventArgs e)
        {
            if (mgUsuario.CurrentRow.Cells[0].Value == null || mgPermisosDisponubleUsuario.CurrentRow.Cells[0].Value == null)
            {
                MetroMessageBox.Show(this, "No selecciono un usuario o Rol", "error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            }

            else
            {
                UsuarioRoles roles = new UsuarioRoles();
                roles.roles.id    = mgPermisosDisponubleUsuario.CurrentRow.Cells[0].Value.ToString();
                roles.usuarios.Id = int.Parse(mgUsuario.CurrentRow.Cells[0].Value.ToString());
                UsuarioRolesComponent usuarioRolesComponent = new UsuarioRolesComponent();
                if (usuarioRolesComponent.Create(roles) == null)
                {
                    ValidadoresComponent.ErrorAltaModificacado("Agregar permiso", this);
                }
                else
                {
                    llenarGrillaPermisosUsuario();
                    ValidadoresComponent.Alta("Agregar permiso", this);
                }
            }
        }
Exemplo n.º 7
0
        private void CheckDGV_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (CheckDGV.CurrentRow.Index != -1)
            {
                room.Id = Convert.ToInt32(CheckDGV.CurrentRow.Cells["Id"].Value);

                try
                {
                    using (GrandLuxEntities context = new GrandLuxEntities())
                    {
                        room = context.Rooms.Where(r => r.Id == room.Id).FirstOrDefault();
                    }

                    RoomNoDisplayOnlyTB.Text = room.Room_Number.ToString();
                    room.Check_In            = CheckInDTP.Value.Date;
                    room.Check_Out           = CheckOutDTP.Value.Date;
                    BookBtn.Enabled          = true;
                }
                catch (Exception)
                {
                    MetroMessageBox.Show(this, "Something went Wrong, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 8
0
        public void compileVTEX()
        {
            // show dialog to open .tga or .mks file
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect = true;
            //ofd.Filter = "TGA|*.tga|MKS|*.mks";
            ofd.Filter = "|*.tga;*.mks";
            ofd.Title  = strings.SelectTGAFilesToCompile;

            string materialsPath = Path.Combine(mainForm.currAddon.contentPath, "materials");

            if (!Directory.Exists(materialsPath))
            {
                Directory.CreateDirectory(materialsPath);
            }
            ofd.InitialDirectory = materialsPath;


            if (!(ofd.ShowDialog() == DialogResult.OK))
            {
                return;
            }

            string[] filePaths = ofd.FileNames;

            string saveFolder = materialsPath;

            // Start the conversion process
            foreach (string file in filePaths)
            {
                string f = file;
                // ensure it's inside content path
                if (!(f.Contains(Path.Combine("content", "dota_addons"))))
                {
                    MetroMessageBox.Show(mainForm,
                                         f + " " + strings.MustBeInsideTheContentDirOf + " " + mainForm.currAddon.name,
                                         strings.Error,
                                         MessageBoxButtons.OK,
                                         MessageBoxIcon.Error);

                    return;
                }
                f = f.Substring(f.IndexOf(Path.Combine("content", "dota_addons")) + 20);
                f = f.Substring(f.IndexOf("\\") + 1);
                f = f.Replace('\\', '/');
                // todo: maybe we should put this into some resource text files
                string[] vtexFileStrings =
                {
                    "<!-- dmx encoding keyvalues2_noids 1 format vtex 1 -->",
                    "\"CDmeVtex\"",
                    "{",
                    "	\"m_inputTextureArray\" \"element_array\" ",
                    "	[",
                    "		\"CDmeInputTexture\"",
                    "		{",
                    "			\"m_name\" \"string\" \"0\"",
                    "			\"m_fileName\" \"string\" \""+ f + "\"",
                    "			\"m_colorSpace\" \"string\" \"srgb\"",
                    "			\"m_typeString\" \"string\" \"2D\"",
                    "		}",
                    "	]",
                    "	\"m_outputTypeString\" \"string\" \"2D\"",
                    "	\"m_outputFormat\" \"string\" \"DXT5\"",
                    "	\"m_textureOutputChannelArray\" \"element_array\"",
                    "	[",
                    "		\"CDmeTextureOutputChannel\"",
                    "		{",
                    "			\"m_inputTextureArray\" \"string_array\"",
                    "				[",
                    "					\"0\"",
                    "				]",
                    "			\"m_srcChannels\" \"string\" \"rgba\"",
                    "			\"m_dstChannels\" \"string\" \"rgba\"",
                    "			\"m_mipAlgorithm\" \"CDmeImageProcessor\"",
                    "			{",
                    "				\"m_algorithm\" \"string\" \"\"",
                    "				\"m_stringArg\" \"string\" \"\"",
                    "				\"m_vFloat4Arg\" \"vector4\" \"0 0 0 0\"",
                    "			}",
                    "			\"m_outputColorSpace\" \"string\" \"srgb\"",
                    "		}",
                    "	]",
                    "}"
                };

                string name = file.Substring(file.LastIndexOf('\\') + 1);
                name = name.Substring(0, name.IndexOf('.'));
                string path = Path.Combine(saveFolder, name + ".vtex");
                File.Create(path).Close();
                File.WriteAllLines(path, vtexFileStrings);
                // resource compiler path
                string resourceCompilerPath = Path.Combine(dotaDir, "game", "bin", "win64", "resourcecompiler.exe");

                Process proc = new Process {
                    StartInfo = new ProcessStartInfo {
                        FileName               = resourceCompilerPath,
                        Arguments              = "-i \"" + path + "\"",
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        CreateNoWindow         = true
                    }
                };
                proc.Start();
            }

            mainForm.text_notification(filePaths.Length + " " + strings.TGAFilesSuccessfullyCompiled, MetroFramework.MetroColorStyle.Green, 2500);
        }
Exemplo n.º 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     chart1.Series["Score"].Points.Clear();
     MetroMessageBox.Show(this, "데이터를 지웠습니다", "처리", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 10
0
        private bool CheckInput()
        {
            fromDate = new DateTime();
            toDate   = new DateTime();

            //check if both date are empty
            if (txtFromDate.Text.Trim() == "" && txtToDate.Text.Trim() == "")
            {
                MetroMessageBox.Show(this, "\n" + Messages.ComparisonResultDetail.RequireDate, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            //if not empty validate
            try
            {
                if (txtFromDate.Text.Trim() != "")
                {
                    fromDate = DateTime.ParseExact(txtFromDate.Text, "yyyy/MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None);
                }
            }
            catch (Exception)
            {
                try
                {
                    fromDate = DateTime.ParseExact(txtFromDate.Text, "yyyy/M/d", CultureInfo.InvariantCulture, DateTimeStyles.None);
                }
                catch (Exception)
                {
                    MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.InvalidDateFormat, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }

            //if not empty validate
            try
            {
                if (txtToDate.Text.Trim() != "")
                {
                    toDate = DateTime.ParseExact(txtToDate.Text, "yyyy/MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None);
                }
            }
            catch (Exception)
            {
                try
                {
                    toDate = DateTime.ParseExact(txtToDate.Text, "yyyy/M/d", CultureInfo.InvariantCulture, DateTimeStyles.None);
                }
                catch (Exception)
                {
                    MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.InvalidDateFormat, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }

            //check if todate is greater than fromdate
            if (fromDate.Date > toDate.Date)
            {
                if (toDate.Date != new DateTime())
                {
                    MetroMessageBox.Show(this, "\n" + Messages.ComparisonResultDetail.InvalidDateFromAndTo, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            if (txtFromDate.Text == "" && toDate != new DateTime()) //check if only to date is inserted
            {
                MetroMessageBox.Show(this, "\n" + Messages.ComparisonResultDetail.RequireDateFrom, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 11
0
        // Patch Creation
        private void btnCreatePatch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Check the user isn't completly retarded
                if (!CheckAllCreateMandatoryFields())
                {
                    return;
                }

                // Check the user isn't a skid
                if (!CheckAllCreateMetaFilesExists())
                {
                    return;
                }

                // Paths
                string cleanMapPath  = txtCreatePatchUnModifiedMap.Text;
                string moddedMapPath = txtCreatePatchModifiedMap.Text;
                string outputPath    = txtCreatePatchOutputPatch.Text;
                string previewImage  = txtCreatePatchPreviewImage.Text;

                // Details
                string author     = txtCreatePatchContentAuthor.Text;
                string desc       = txtCreatePatchContentDescription.Text;
                string name       = txtCreatePatchContentName.Text;
                string outputName = txtCreatePatchOutputName.Text;

                // Make dat patch
                var patch = new Patch
                {
                    Author      = author,
                    Description = desc,
                    Name        = name,
                    OutputName  = outputName,
                    Screenshot  = String.IsNullOrEmpty(previewImage)
                                                ? null
                                                : File.ReadAllBytes(previewImage),
                    BuildString = _buildInfo.Version,
                    PC          = String.IsNullOrEmpty(_buildInfo.GameExecutable)
                                                ? false
                                                : true
                };

                EndianReader originalReader = null;
                EndianReader newReader      = null;
                try
                {
                    originalReader = new EndianReader(File.OpenRead(cleanMapPath), Endian.BigEndian);
                    newReader      = new EndianReader(File.OpenRead(moddedMapPath), Endian.BigEndian);

                    ICacheFile originalFile = CacheFileLoader.LoadCacheFile(originalReader, cleanMapPath,
                                                                            App.AssemblyStorage.AssemblySettings.DefaultDatabase);
                    ICacheFile newFile = CacheFileLoader.LoadCacheFile(newReader, moddedMapPath, App.AssemblyStorage.AssemblySettings.DefaultDatabase);

                    if (cbCreatePatchHasCustomMeta.IsChecked != null && (bool)cbCreatePatchHasCustomMeta.IsChecked &&
                        cboxCreatePatchTargetGame.SelectedIndex < 4)
                    {
                        var      targetGame      = (TargetGame)cboxCreatePatchTargetGame.SelectedIndex;
                        byte[]   mapInfo         = File.ReadAllBytes(txtCreatePatchMapInfo.Text);
                        var      mapInfoFileInfo = new FileInfo(txtCreatePatchMapInfo.Text);
                        FileInfo blfFileInfo;

                        patch.CustomBlfContent = new BlfContent(mapInfoFileInfo.FullName, mapInfo, targetGame);

                        #region Blf Data

                        if (PatchCreationBlfOption0.Visibility == Visibility.Visible)
                        {
                            blfFileInfo = new FileInfo(txtCreatePatchblf0.Text);
                            patch.CustomBlfContent.BlfContainerEntries.Add(new BlfContainerEntry(blfFileInfo.Name,
                                                                                                 File.ReadAllBytes(blfFileInfo.FullName)));
                        }
                        if (PatchCreationBlfOption1.Visibility == Visibility.Visible)
                        {
                            blfFileInfo = new FileInfo(txtCreatePatchblf1.Text);
                            patch.CustomBlfContent.BlfContainerEntries.Add(new BlfContainerEntry(blfFileInfo.Name,
                                                                                                 File.ReadAllBytes(blfFileInfo.FullName)));
                        }
                        if (PatchCreationBlfOption2.Visibility == Visibility.Visible)
                        {
                            blfFileInfo = new FileInfo(txtCreatePatchblf2.Text);
                            patch.CustomBlfContent.BlfContainerEntries.Add(new BlfContainerEntry(blfFileInfo.Name,
                                                                                                 File.ReadAllBytes(blfFileInfo.FullName)));
                        }
                        if (PatchCreationBlfOption3.Visibility == Visibility.Visible)
                        {
                            blfFileInfo = new FileInfo(txtCreatePatchblf3.Text);
                            patch.CustomBlfContent.BlfContainerEntries.Add(new BlfContainerEntry(blfFileInfo.Name,
                                                                                                 File.ReadAllBytes(blfFileInfo.FullName)));
                        }

                        #endregion
                    }

                    PatchBuilder.BuildPatch(originalFile, originalReader, newFile, newReader, patch);
                }
                finally
                {
                    if (originalReader != null)
                    {
                        originalReader.Dispose();
                    }
                    if (newReader != null)
                    {
                        newReader.Dispose();
                    }
                }

                IWriter output = new EndianWriter(File.Open(outputPath, FileMode.Create, FileAccess.Write), Endian.BigEndian);
                AssemblyPatchWriter.WritePatch(patch, output);
                output.Dispose();

                MetroMessageBox.Show("Patch Created!",
                                     "Your patch has been created in the designated location. Happy sailing, modder!");
            }
            catch (Exception ex)
            {
                MetroException.Show(ex);
            }
        }
Exemplo n.º 12
0
        private void btnReturn_Click(object sender, EventArgs e)
        {
            List <DataGridViewRow> rows = GetCheckedRows();

            if (rows != null && rows.Count > 0)
            {
                if (MetroMessageBox.Show(this, "确认要清除箱记录提示?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK)
                {
                    foreach (DataGridViewRow row in rows)
                    {
                        UploadPKBoxInfo box          = row.Tag as UploadPKBoxInfo;
                        List <string>   picktaskList = box.DeliverErrorBoxList.Select(i => i.PICK_TASK).Distinct().ToList();
                        //检查该下架单在服务器上是否已经下架
                        bool existNoOut = false;
                        if (picktaskList != null && picktaskList.Count > 0)
                        {
                            foreach (string picktask in picktaskList)
                            {
                                List <InventoryOutLogDetailInfo> list = SAPDataService.GetHLAShelvesSingleTask(SysConfig.LGNUM, picktask);

                                if (list != null && list.Count > 0)
                                {
                                    if (list[0].IsOut != 1)
                                    {
                                        existNoOut = true;
                                        break;
                                    }
                                }
                            }
                        }

                        if (existNoOut)
                        {
                            /*
                             * MetroMessageBox.Show(this, string.Format("箱号:{0},存在未下架的下架单,不允许清除该箱记录!", box.HU), "提示"
                             *          , MessageBoxButtons.OK, MessageBoxIcon.Information);
                             */

                            DialogResult result = MetroMessageBox.Show(this, string.Format("箱号:{0},存在未下架的下架单,是否还要清除?", box.HU), "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                            if (result == System.Windows.Forms.DialogResult.Yes)
                            {
                            }
                            else
                            {
                                return;
                            }
                        }
                        if (SqliteDataService.DeleteUploaded(box.Guid))
                        {
                        }
                        else
                        {
                            MetroMessageBox.Show(this, "清除失败", "提示",
                                                 MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }

                    initData();
                }
            }
        }
Exemplo n.º 13
0
        private void btnupdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtPName.Text == "" || txtPName.Text == string.Empty || txtDesc.Text == string.Empty ||
                    txtQuantity.Text == string.Empty)
                {
                    MessageBox.Show("Incomplete Data!");
                    return;
                }
                if (!tglTempStockRecord.Checked)
                {
                    if (cmbSupplier.SelectedIndex == -1 || txtStockDate.Text == string.Empty)
                    {
                        MessageBox.Show("Incomplete Data!");
                        return;
                    }
                }


                int typed = Convert.ToInt32(txtQuantity.Text);
                if (typed == 0 || typed > quantity)
                {
                    txtQuantity.Text = quantity.ToString();

                    MessageBox.Show("Please enter valid data!");
                    return;
                }

                using (TransactionScope txScope = new TransactionScope())
                {
                    //firstly update the sales product table
                    int           returnQuantity = Convert.ToInt32(txtQuantity.Text);
                    string        desc           = txtDesc.Text;
                    sales_product SalePro        = new sales_product();
                    Sales_BM      saleObject     = new Sales_BM();
                    int           stepOneCount   = 0;
                    BusinessObjects.SalesReturn salesReturnObject = new BusinessObjects.SalesReturn();
                    if (quantity == returnQuantity)
                    {
                        //delete record from sales_product
                        SalePro.DeleteSalesReturn(con, sales_id, ProdID);//this will delete the relevant product from sales product data


                        //calculating new amount
                        decimal deletedAMount = quantity * soldPrice;
                        saleObject = saleObject.getSalesByIDSalesReturn(con, sales_id);//getting the relevant sales data
                        decimal newTotal  = saleObject.total - deletedAMount;
                        decimal newCredit = newTotal - saleObject.paid;

                        //update the sales table
                        saleObject.UpdateSalesReturn(con, newTotal, newCredit);//updating amount and the credit of that sales

                        //insert to sales return table
                        int salesReturnTableCount = 0;
                        salesReturnTableCount = salesReturnObject.GetCountSalesReturn(con, sales_id);

                        if (salesReturnTableCount > 0)
                        {
                            int salesReturnProductTableCount = 0;
                            salesReturnProductTableCount = salesReturnObject.GetCountSalesProduct(con, sales_id, ProdID);

                            decimal ReturnAMount = returnQuantity * soldPrice;
                            if (salesReturnProductTableCount > 0)
                            {
                                string salesReturnProductsQuery = @"update sales_return_products set quantity= quantity + " + returnQuantity
                                                                  + "  where product_id=" + ProdID + " AND sales_id=" + sales_id + "";

                                salesReturnObject.ExecuteNonQuery(salesReturnProductsQuery, con);
                            }
                            else
                            {
                                string salesReturnProductsQuery = @"insert sales_return_products (product_id, sales_id, quantity, product_sold_price)
                        values (" + ProdID + "," + sales_id + "," + returnQuantity + "," + soldPrice + ")";
                                salesReturnObject.ExecuteNonQuery(salesReturnProductsQuery, con);
                            }
                        }
                        else
                        {
                            string salesReturnQuery = @"insert sales_return (sales_id, Total, _date, customer,paid)
                    values (" + saleObject.sales_id + "," + saleObject.total
                                                      + ",'" + saleObject.date_time.ToString("G", DateTimeFormatInfo.InvariantInfo)
                                                      + "','" + saleObject.customer_name + "'," + saleObject.paid + ")";
                            salesReturnObject.ExecuteNonQuery(salesReturnQuery, con);


                            string salesReturnProductsQuery = @"insert sales_return_products (product_id, sales_id, quantity, product_sold_price)
                        values (" + ProdID + "," + sales_id + "," + returnQuantity + "," + soldPrice + ")";
                            salesReturnObject.ExecuteNonQuery(salesReturnProductsQuery, con);
                        }
                    }

                    else
                    {
                        //updating sale_product table
                        int     newQuantity = quantity - returnQuantity;
                        decimal newTotalSalesProductPrice = newQuantity * soldPrice;
                        SalePro.UpdateSalesReturn(con, sales_id, ProdID, newQuantity, newTotalSalesProductPrice);


                        // //update the sales table
                        decimal deletedAMount = returnQuantity * soldPrice;
                        saleObject = saleObject.getSalesByIDSalesReturn(con, sales_id);

                        decimal newTotal  = saleObject.total - deletedAMount;
                        decimal newCredit = newTotal - saleObject.paid;
                        saleObject.UpdateSalesReturn(con, newTotal, newCredit);

                        //insert to sales return table
                        int salesReturnTableCount = 0;
                        salesReturnTableCount = salesReturnObject.GetCountSalesReturn(con, sales_id);

                        if (salesReturnTableCount > 0)
                        {
                            int salesReturnProductTableCount = 0;
                            salesReturnProductTableCount = salesReturnObject.GetCountSalesProduct(con, sales_id, ProdID);

                            decimal ReturnAMount = returnQuantity * soldPrice;
                            if (salesReturnProductTableCount > 0)
                            {
                                //int countAvalQun= salesReturnProductTableCount = salesReturnObject.GetQuantitySalesProduct(con, sales_id, ProdID);
                                //int newQuanttt = returnQuantity + countAvalQun;
                                string salesReturnProductsQuery = @"update sales_return_products set quantity=quantity+" + returnQuantity
                                                                  + "  where product_id=" + ProdID + " AND sales_id=" + sales_id + "";

                                salesReturnObject.ExecuteNonQuery(salesReturnProductsQuery, con);
                            }
                            else
                            {
                                string salesReturnProductsQuery = @"insert sales_return_products (product_id, sales_id, quantity, product_sold_price)
                        values (" + ProdID + "," + sales_id + "," + returnQuantity + "," + soldPrice + ")";
                                salesReturnObject.ExecuteNonQuery(salesReturnProductsQuery, con);
                            }
                        }
                        else
                        {
                            string salesReturnQuery = @"insert sales_return (sales_id, Total, _date, customer,paid)
                    values (" + saleObject.sales_id + "," + saleObject.total
                                                      + ",'" + saleObject.date_time.ToString("G", DateTimeFormatInfo.InvariantInfo)
                                                      + "','" + saleObject.customer_name + "'," + saleObject.paid + ")";
                            salesReturnObject.ExecuteNonQuery(salesReturnQuery, con);


                            string salesReturnProductsQuery = @"insert sales_return_products (product_id, sales_id, quantity, product_sold_price)
                        values (" + ProdID + "," + sales_id + "," + returnQuantity + "," + soldPrice + ")";
                            salesReturnObject.ExecuteNonQuery(salesReturnProductsQuery, con);
                        }
                    }

                    int SalesTableProductCount = salesReturnObject.GetCountSalesProductTable(con, sales_id);
                    if (SalesTableProductCount == 0)
                    {
                        string salesDeleteQueru = @"Delete from _Sales where sales_id=" + sales_id + "";
                        salesReturnObject.ExecuteNonQuery(salesDeleteQueru, con);
                    }



                    //update the stock data here*********************************************************************
                    // returnQuantity  ProdID  cmbSupplier.SelectedIndex txtStockInvoice.text;

                    #region removed_by_new_code

                    /*
                     *
                     #region if
                     * if (tglTempStockRecord.Checked)
                     * {
                     *  //string invoiceNum = txtStockInvoice.Text;
                     *  string custStockName = "SalesReturnStock";
                     *  string getTemStockRecordExistece = @"select stock_id from  _Stokc where sup_name='" + custStockName + "'";
                     *  int existence= 0;
                     *  if (BusinessObjects.SalesReturn.getScalar(con, getTemStockRecordExistece) != DBNull.Value)
                     *  {
                     *      object temPonj=BusinessObjects.SalesReturn.getScalar(con, getTemStockRecordExistece);
                     *      if (temPonj != null)
                     *          existence = (int)temPonj;
                     *  }
                     *  if (existence > 0)//this means the temp sales return data is in stock table
                     *  {
                     *      string getCountOfstokcreturn = @"select quantity from  _stock_product where pid=" + ProdID + " AND stock_id='" + existence + "'";
                     *      int AllreadyAvaliableQuant = 0;
                     *      if (BusinessObjects.SalesReturn.getScalar(con, getCountOfstokcreturn) != DBNull.Value)
                     *      {
                     *          object temPobj = BusinessObjects.SalesReturn.getScalar(con, getCountOfstokcreturn);
                     *          if (temPobj != null)
                     *              AllreadyAvaliableQuant = (int)temPobj;
                     *      }
                     *      if (AllreadyAvaliableQuant > 0)
                     *      {
                     *          int newQuan = AllreadyAvaliableQuant + returnQuantity;
                     *
                     *          string stockProductUpdateQuery = @"update _stock_product set quantity=" + newQuan + " where pid=" + ProdID + " and stock_id =" + existence + "";
                     *
                     *          salesReturnObject.ExecuteNonQuery(stockProductUpdateQuery, con);
                     *      }
                     *      else
                     *      {
                     *
                     *          string stockProductInsertQuery = @"insert _stock_product  (pid,quantity,stock_id) values(" + ProdID + "," + returnQuantity + "," + existence + ") ";
                     *          salesReturnObject.ExecuteNonQuery(stockProductInsertQuery, con);
                     *
                     *      }
                     *  }
                     *  else //this means the temp stock return data is not availeble in stock table.
                     *  {
                     *      //addign data to stock table first (SalesReturn Temp Record)
                     *      string addTempStockData = @"insert _Stokc  (sup_name,s_date,invoice_no) values('SalesReturnStock','" + DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo) + "','00000') ";
                     *      salesReturnObject.ExecuteNonQuery(addTempStockData, con);
                     *
                     *      //getting last inserted ID
                     *      string querySI = @"select IDENT_CURRENT('_Stokc')";
                     *      int lastInsertedID = Convert.ToInt32(Sales_BM.getScalar(con, querySI));
                     *
                     *      //now we add data the the stock product table
                     *      string AfterInsertSPQuery = @"insert _stock_product  (pid,quantity,stock_id) values(" + ProdID + "," + returnQuantity + "," + lastInsertedID + ") ";
                     *      salesReturnObject.ExecuteNonQuery(AfterInsertSPQuery, con);
                     *  }
                     * }
                     #endregion
                     #region else
                     * else
                     * {
                     *  //string invoiceNum = txtStockInvoice.Text;
                     *  int stockIDRt=Convert.ToInt32(txtStokIDRetrieved.Text);
                     *  string getCountOfstokcreturn = @"select quantity from  _stock_product where pid=" + ProdID + " AND stock_id='" + stockIDRt + "'";
                     *  int AllreadyAvaliableQuant=0;
                     *  if (BusinessObjects.SalesReturn.getScalar(con, getCountOfstokcreturn) != DBNull.Value)
                     *  {
                     *      object objTemp=BusinessObjects.SalesReturn.getScalar(con, getCountOfstokcreturn);
                     *      if (objTemp != null)
                     *          AllreadyAvaliableQuant = (int)objTemp;
                     *  }
                     *  if (AllreadyAvaliableQuant > 0)
                     *  {
                     *      int newQuan=AllreadyAvaliableQuant+returnQuantity;
                     *
                     *      string stockProductUpdateQuery = @"update _stock_product set quantity=" + newQuan + " where pid=" + ProdID + " and stock_id =" + stockIDRt + "";
                     *
                     *      salesReturnObject.ExecuteNonQuery(stockProductUpdateQuery, con);
                     *  }
                     *  else
                     *  {
                     *      string stockProductInsertQuery = @"insert _stock_product  (pid,quantity,stock_id) values(" + ProdID + "," + returnQuantity + "," + stockIDRt + ") ";
                     *      salesReturnObject.ExecuteNonQuery(stockProductInsertQuery, con);
                     *  }
                     *  //returnQuantity;ProdID
                     *   // cmbSupplier.SelectedIndex
                     * }
                     #endregion
                     *
                     */
                    #endregion

                    int stockIDD = Convert.ToInt32(cmbSupplier.SelectedValue.ToString());
                    updateStock(ProdID, stockIDD, returnQuantity);

                    txScope.Complete();//transaction commit
                    MetroMessageBox.Show(this, "Transaction Complete ", "Process completed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "System Error " + ex.Message, "System Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 14
0
        private void metroButton9_Click_1(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Excel csv files (*.csv)|*.csv|All files (*.*)|*.*";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string constring = "SERVER=localhost;DATABASE=Silvercity;UID=root;PASSWORD=smhs;";
                string file = openFileDialog1.FileName;

                Excel.Application xlApp;
                Excel.Workbook xlWorkBook;
                Excel.Worksheet xlWorkSheet;
                Excel.Range range;
                string str = "";
                int rCnt = 0;
                int cCnt = 0;

                xlApp = new Excel.Application();
                xlWorkBook = xlApp.Workbooks.Open(file, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

                range = xlWorkSheet.UsedRange;
                int end = 0;
                String lot = "";
                try
                {
                    for (rCnt = 2; rCnt <= range.Rows.Count; rCnt++)
                    {
                        for (cCnt = 1; cCnt <= range.Columns.Count; cCnt++)
                        {
                            str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
                            if (str.StartsWith("END"))
                            {
                                end = 1;
                                break;
                            }
                        }
                        if (end == 1)
                            break;
                        String[] s11 = new String[4];
                        str = str.Trim();
                        s11 = str.Split(',');
                        if (s11[3].Length == 0)
                            s11[3] = "RAW";

                        MySqlConnection con = new MySqlConnection("SERVER=localhost;DATABASE=SilverCity;UID=root;PASSWORD=smhs;");
                        con.Open();
                        String Query = "insert into metal_consume(dat, type, name, qty, unit, purity, prodtype) VALUES (@a,@b,@c,@d,@e,@f,@g);";
                        MySqlCommand cmd = new MySqlCommand(Query, con);
                        cmd.Parameters.AddWithValue("@a", s11[0]);
                        cmd.Parameters.AddWithValue("@b", "Silver");
                        cmd.Parameters.AddWithValue("@c", s11[1]);
                        cmd.Parameters.AddWithValue("@d", s11[2]);
                        cmd.Parameters.AddWithValue("@e", "Kg");
                        cmd.Parameters.AddWithValue("@f", "925");
                        cmd.Parameters.AddWithValue("@g", s11[3]);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
                catch (Exception e1)
                {
                    MetroMessageBox.Show(this, "\nError in " + lot + "\n" + e1.GetBaseException(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                xlWorkBook.Close(true, null, null);
                xlApp.Quit();

                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlApp);
                MetroMessageBox.Show(this, "\nIMPORT SUCCESSFULLY COMPLETED!", "CONGRATULATIONS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }


        }
Exemplo n.º 15
0
        private void BindGrid()
        {
            try
            {
                if (!CheckUtility.SearchConditionCheck(this, lblDate.LabelText, txtBilling_Date.Text.Trim(), true, Utility.DataType.YEARMONTH, 7, 6))
                {
                    return;
                }
                //assign search keywords
                DateTime YEAR_MONTH   = Convert.ToDateTime(txtBilling_Date.Text);
                String   strYearMonth = YEAR_MONTH.ToString("yyyyMM");

                //assign search keywords
                frmInvoiceListController oController = new frmInvoiceListController();
                DataSet   ds      = oController.GetInvoiceList(strYearMonth, uIUtility.MetaData.Offset, uIUtility.MetaData.Limit, out uIUtility.MetaData); //need to add more parameter
                DataTable dtList  = ds.Tables[0];
                DataTable dtTotal = ds.Tables[1];

                InvoiceAmountTotal                  = 0;
                keySourceTotal                      = 0;
                SupplierMonthlyUsageFeeTotal        = 0;
                SupplierExpenseTotal                = 0;
                SupplierBrowsingInitialExpenseTotal = 0;
                YearlyUsageFeeTotal                 = 0;
                PostalMailTotal                     = 0;
                WebTotal        = 0;
                EmailTotal      = 0;
                CreditCardTotal = 0;
                OtherTotal      = 0;

                foreach (DataRow row in dtTotal.Rows)
                {
                    keySourceTotal                      += Convert.ToDecimal(row["KEY_SOURCE_MONTHLY_USAGE_FEE"].ToString());
                    SupplierExpenseTotal                += Convert.ToDecimal(row["SUPPLIER_INITIAL_EXPENSE"].ToString());
                    SupplierMonthlyUsageFeeTotal        += Convert.ToDecimal(row["SUPPLIER_MONTHLY_USAGE_FEE"].ToString());
                    SupplierBrowsingInitialExpenseTotal += Convert.ToDecimal(row["BROWSING_INITIAL_EXPENSE"].ToString());
                    YearlyUsageFeeTotal                 += Convert.ToDecimal(row["YEARLY_USAGE_FEE"].ToString());
                    InvoiceAmountTotal                   = keySourceTotal + SupplierExpenseTotal + SupplierMonthlyUsageFeeTotal + SupplierBrowsingInitialExpenseTotal + YearlyUsageFeeTotal;

                    if (row["POSTAL_MAIL"].ToString() == "●")
                    {
                        PostalMailTotal++;
                    }
                    if (row["WEB"].ToString() == "●")
                    {
                        WebTotal++;
                    }
                    if (row["Email"].ToString() == "●")
                    {
                        EmailTotal++;
                    }
                    if (row["CREDIT_CARD"].ToString() == "●")
                    {
                        CreditCardTotal++;
                    }
                    if (row["OTHER"].ToString() == "●")
                    {
                        OtherTotal++;
                    }
                }

                //dgvList.Columns["colCOMPANY_NAME"].HeaderText = "請求金額計";
                //dgvList.Columns["colKEY_SOURCE_MONTHLY_USAGE_FEE"].HeaderText = keySourceTotal.ToString();
                //dgvList.Columns["coLSUPPLIER_INITIAL_EXPENSE"].HeaderText = SupplierExpenseTotal.ToString();
                //dgvList.Columns["colSUPPLIER_MONTHLY_USAGE_FEE"].HeaderText = SupplierMonthlyUsageFeeTotal.ToString();
                //dgvList.Columns["colBROWSING_INITIAL_EXPENSE"].HeaderText = SupplierBrowsingInitialExpenseTotal.ToString();
                //dgvList.Columns["colYEARLY_USAGE_FEE"].HeaderText = YearlyUsageFeeTotal.ToString();

                //dgvList.Columns["coLEmail"].HeaderText = EmailTotal.ToString(); //coLEmail
                //dgvList.Columns["coLPOSTAL_MAIL"].HeaderText = PostalMailTotal.ToString(); //coLEmail
                //dgvList.Columns["colWEB"].HeaderText = WebTotal.ToString(); //coLEmail
                //dgvList.Columns["colCREDIT_CARD"].HeaderText = CreditCardTotal.ToString(); //coLEmail
                //dgvList.Columns["colOTHER"].HeaderText = OtherTotal.ToString(); //coLEmail

                if (dtList.Rows.Count > 0)
                {
                    uIUtility.dtList   = dtList;
                    dgvList.DataSource = uIUtility.dtList;
                    uIUtility.dtOrigin = uIUtility.dtList.Copy();

                    //pagination
                    uIUtility.CalculatePagination(lblcurrentPage, lblTotalPages, lblTotalRecords);
                }
                else
                {
                    //clear data except headers
                    uIUtility.ClearDataGrid();
                    uIUtility.CalculatePagination(lblcurrentPage, lblTotalPages, lblTotalRecords);
                }

                uIUtility.CheckPagination(btnFirst, btnPrev, btnNext, btnLast, lblcurrentPage.Text, lblTotalPages.Text);
            }
            catch (System.TimeoutException)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Net.WebException)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, ex, false);
                MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// DB 저장 프로세스
        /// </summary>
        private void SaveProcess()
        {
            if (string.IsNullOrEmpty(mode))
            {
                MetroMessageBox.Show(this, "신규버튼을 누르고 데이터를 저장하십시오.", "경고", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            using (SqlConnection conn = new SqlConnection(Commons.CONNSTRING))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = conn;
                string strQuery = "";

                if (mode == "UPDATE")
                {
                    strQuery = "UPDATE bookstbl SET Author = @Author, Division = @Division, Names = @Names, ReleaseDate = @ReleaseDate, "
                               + " ISBN = @ISBN, Price = @Price "
                               + " WHERE Idx = @Idx";
                }
                else if (mode == "INSERT")
                {
                    strQuery = "INSERT INTO bookstbl(Author, Division, Names, ReleaseDate, ISBN, Price) "
                               + " VALUES(@Author, @Division, @Names, @ReleaseDate, @ISBN, @Price)";
                }
                cmd.CommandText = strQuery;

                SqlParameter parmAuthor = new SqlParameter("@Author", SqlDbType.NVarChar, 45);
                parmAuthor.Value = TxtAuthor.Text;
                cmd.Parameters.Add(parmAuthor);

                SqlParameter parmDivision = new SqlParameter("@Division", SqlDbType.Char, 4);
                parmDivision.Value = CboDivision.SelectedValue;
                cmd.Parameters.Add(parmDivision);

                SqlParameter parmNames = new SqlParameter("@Names", SqlDbType.VarChar, 100);
                parmNames.Value = TxtNames.Text;
                cmd.Parameters.Add(parmNames);

                SqlParameter parmReleaseDate = new SqlParameter("@ReleaseDate", SqlDbType.Date);
                parmReleaseDate.Value = DtpReleaseDate.Value;
                cmd.Parameters.Add(parmReleaseDate);

                SqlParameter parmISBN = new SqlParameter("@ISBN", SqlDbType.VarChar, 200);
                parmISBN.Value = TxtISBN.Text;
                cmd.Parameters.Add(parmISBN);

                SqlParameter parmPrice = new SqlParameter("@Price", SqlDbType.Decimal, 10);
                parmPrice.Value = TxtPrice.Text;
                cmd.Parameters.Add(parmPrice);

                if (mode == "UPDATE")
                {
                    SqlParameter parmIdx = new SqlParameter("@Idx", SqlDbType.Int);
                    parmIdx.Value = TxtIdx.Text;
                    cmd.Parameters.Add(parmIdx);
                }

                cmd.ExecuteNonQuery();
            }
        }
Exemplo n.º 17
0
        public void decompileVTEX()
        {
            //decompileAllVTEX();
            //return;

            string extract = Path.Combine(dotaDir, "game", "dota_imported", "materials");

            if (!Directory.Exists(extract))
            {
                Directory.CreateDirectory(extract);
            }

            if (Directory.GetFiles(extract, "*.vtex_c").Length == 0)
            {
                Process.Start(extract);
                MetroMessageBox.Show(mainForm, strings.VTEXCFilesMustBePresentIn + " " + extract + " " + strings.ForThisToWork_UseGCF,
                                     strings.Note,
                                     MessageBoxButtons.OK,
                                     MessageBoxIcon.Information);
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title            = strings.SelectVTEXCToDecompile;
            ofd.Multiselect      = true;
            ofd.InitialDirectory = Path.Combine(dotaDir, "game", "dota_imported", "materials");
            ofd.Filter           = "|*.vtex_c";

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // 9/16/15: resourceinfo.exe uses an old path to retrieve the required file gameinfo.gi. So we need to
            // make sure it's in the right spot.
            string oldPath = Path.Combine(dotaDir, "game", "dota_imported", "gameinfo.gi");

            if (!File.Exists(oldPath))
            {
                string newPath = Path.Combine(dotaDir, "game", "dota", "gameinfo.gi");
                if (File.Exists(newPath))
                {
                    File.Copy(newPath, oldPath);
                }
                else
                {
                    return;
                }
            }

            string[] vtexCPaths = ofd.FileNames;
            foreach (string path in vtexCPaths)
            {
                //resourceinfo.exe -i <your vtex_c file> -debug tga -mip
                Process          process   = new Process();
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                //startInfo.UseShellExecute = true;
                startInfo.FileName         = "cmd.exe";
                startInfo.WorkingDirectory = Path.Combine(dotaDir, "game", "bin", "win64");
                startInfo.Arguments        = "/c resourceinfo.exe -i \"" + path + "\" -debug tga -mip";
                Debug.WriteLine(startInfo.Arguments);
                process.StartInfo = startInfo;
                process.Start();
                process.WaitForExit();

                // Prepare to move the tga files
                string vtexcName = path.Substring(path.LastIndexOf('\\') + 1);

                string fold = Path.Combine(mainForm.currAddon.contentPath, "materials", vtexcName);
                if (!Directory.Exists(fold))
                {
                    Directory.CreateDirectory(fold);
                }

                //move the tga files
                string[] tgaFiles = Directory.GetFiles(Path.Combine(dotaDir, "game", "bin", "win64"), "*.tga");
                foreach (string file in tgaFiles)
                {
                    string fileName = file.Remove(0, file.LastIndexOf('\\') + 1);
                    // prepare for moving file
                    string dest = Path.Combine(fold, fileName);
                    if (!File.Exists(dest))
                    {
                        File.Move(file, dest);
                    }
                }
            }

            Process.Start(Path.Combine(mainForm.currAddon.contentPath, "materials"));
        }
Exemplo n.º 18
0
 private DialogResult MsgBox(object text, string title = "ResourceHub Launcher", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1)
 {
     return(MetroMessageBox.Show(this, text.ToString(), title, buttons, icon, defaultButton));
 }
Exemplo n.º 19
0
        private bool CheckSanity()
        {
            if (string.IsNullOrEmpty(mTxBRepoAddress.Text))
            {
                MetroMessageBox.Show(this, Resources.Options_CheckSanity_No_checkout_address_has_been_entered_,
                                     Resources.GinClientApp_Gin_Client_Warning, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!mTxBRepoAddress.Text.Contains('/') && !RepositoryData.CreateNew)
            {
                var result = MetroMessageBox.Show(this,
                                                  string.Format(Resources.Options_CheckSanity_The_checkout_address_is_not_properly_formatted,
                                                                mTxBRepoAddress.Text),
                                                  Resources.GinClientApp_Gin_Client_Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                RepositoryData.CreateNew = result == DialogResult.Yes;
                RepositoryData.Name      = RepositoryData.Address;

                return(result == DialogResult.Yes);
            }

            if (Directory.Exists(RepositoryData.PhysicalDirectory.FullName))
            {
                var result = MetroMessageBox.Show(this,
                                                  Resources.Options_CheckSanity_The_checkout_directory_already_exists,
                                                  Resources.GinClientApp_Gin_Client_Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (result == DialogResult.Yes)
                {
                    RepositoryData.PhysicalDirectory.Empty();
                    Directory.Delete(RepositoryData.PhysicalDirectory.FullName);
                }
                else
                {
                    return(false);
                }
            }

            if (Directory.Exists(RepositoryData.Mountpoint.FullName))
            {
                var result = MetroMessageBox.Show(this,
                                                  Resources.Options_CheckSanity_The_mountpoint_directory_already_exists,
                                                  Resources.GinClientApp_Gin_Client_Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (result == DialogResult.Yes)
                {
                    RepositoryData.Mountpoint.Empty();
                    Directory.Delete(RepositoryData.Mountpoint.FullName);
                }
                else
                {
                    return(false);
                }
            }

            if (RepositoryData.Mountpoint.FullName.Contains(RepositoryData.PhysicalDirectory.FullName) ||
                RepositoryData.PhysicalDirectory.FullName.Contains(RepositoryData.Mountpoint.FullName))
            {
                MetroMessageBox.Show(this,
                                     Resources.Options_CheckSanity_The_mountpoint_and_checkout_directory_can_not_be_subdirectories,
                                     Resources.GinClientApp_Gin_Client_Warning, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(false);
            }

            return(true);
        }
Exemplo n.º 20
0
 public void Show(string title, string message)
 {
   var metroMessageBox = new MetroMessageBox();
   metroMessageBox.ShowMessage(title, message);
 }
Exemplo n.º 21
0
        private void metroButton7_Click_1(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Excel csv files (*.csv)|*.csv|All files (*.*)|*.*";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string constring = "SERVER=localhost;DATABASE=Silvercity;UID=root;PASSWORD=smhs;";
                string file = openFileDialog1.FileName;

                Excel.Application xlApp;
                Excel.Workbook xlWorkBook;
                Excel.Worksheet xlWorkSheet;
                Excel.Range range;
                string str="";
                int rCnt = 0;
                int cCnt = 0;

                xlApp = new Excel.Application();
                xlWorkBook = xlApp.Workbooks.Open(file, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

                range = xlWorkSheet.UsedRange;
                int end=0;
                String lot="";
                try
                {
                    for (rCnt = 3; rCnt <= range.Rows.Count; rCnt++)
                    {
                        for (cCnt = 1; cCnt <= range.Columns.Count; cCnt++)
                        {
                            str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
                           
                            if (str.StartsWith("END"))
                            {
                                end = 1;
                                break;
                            }

                        }
                        if (end == 1)
                            break;
                        String[] s11 = new String[19];
                        str = str.Trim();
                        str = str.ToLower();
                        s11 = str.Split(',');
                        int i = 0;
                        for (i = 0; i < 19; i++)
                            s11[i] = s11[i].Trim();
            //            MessageBox.Show(s11[0]);
                        //lot = s11[0];
                        //double l = Convert.ToDouble(s11[0]);

                        if (s11[1].Length < 10)
                            s11[1] = "2011-01-27";

                        string[] dateTempArray = new string[3];
                        if(s11[1].Contains('-'))
                            dateTempArray = s11[1].Split('-');
                        else if (s11[1].Contains('/'))
                            dateTempArray = s11[1].Split('/');
                        if (dateTempArray[0].Length<=2)
                            s11[1] = dateTempArray[2] + "-" + dateTempArray[1] + "-" + dateTempArray[0];
                        else if(dateTempArray[0].Length==4)
                            s11[1] = dateTempArray[0] + "-" + dateTempArray[1] + "-" + dateTempArray[2];

                        if (s11[2].Length == 0)
                            s11[2] = "stone name";
                        if (s11[3].Length == 0)
                            s11[3] = "free size";
                        if (s11[4].Length == 0)
                            s11[4] = "free";
                        if (s11[5].Length == 0)
                            s11[5] = "silver city";
                        if (s11[6].Length == 0)
                            s11[6] = "0";
                        if (s11[7].Length == 0)
                            s11[7] = "0";
                        if (s11[8].Length == 0)
                            s11[8] = "cts";
                        if (s11[9].Length == 0)
                            s11[9] = "0";
                        if (s11[10].Length == 0)
                            s11[10] = "0";
                        if (s11[11].Length == 0)
                            s11[11] = "cts";
                        if (s11[12].Length == 0)
                            s11[12] = "0";
                        if (s11[13].Length == 0)
                            s11[13] = "0";
                        if (s11[14].Length == 0)
                            s11[14] = "0";
                        if (s11[15].Length == 0)
                            s11[15] = "0";
                        if (s11[16].Length == 0)
                            s11[16] = "0";

                        MySqlConnection con = new MySqlConnection("SERVER=localhost;DATABASE=SilverCity;UID=root;PASSWORD=smhs;");
                        con.Open();
                        String Query = "insert into stone(lot, dop, stone, size, shape, seller, p_pcs, p_qty, p_unit, c_pcs, c_qty, c_unit, cost, less, nr, amt, cr_amt, specs, ec) VALUES (@a,@b,@c,@d,@e,@f,@g,@h,@i,@j,@k,@l,@m,@n,@o,@p,@q,@r,@s);";
                        MySqlCommand cmd = new MySqlCommand(Query, con);
                        //MessageBox.Show(Query);
                        lot=s11[0];
                        cmd.Parameters.AddWithValue("@a", s11[0]);
                        cmd.Parameters.AddWithValue("@b", s11[1]);
                        cmd.Parameters.AddWithValue("@c", s11[2]);
                        cmd.Parameters.AddWithValue("@d", s11[3]);
                        cmd.Parameters.AddWithValue("@e", s11[4]);
                        cmd.Parameters.AddWithValue("@f", s11[5]);
                        cmd.Parameters.AddWithValue("@g", s11[6]);
                        if (s11[8].Equals("gms"))
                        {
                            cmd.Parameters.AddWithValue("@h", Convert.ToDouble(s11[7]) * 5);
                            cmd.Parameters.AddWithValue("@i", "cts");
                            cmd.Parameters.AddWithValue("@k", Convert.ToDouble(s11[10]) * 5);
                            cmd.Parameters.AddWithValue("@l", "cts");
                        
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@h", Convert.ToDouble(s11[7]) );
                            cmd.Parameters.AddWithValue("@i", "cts");
                            cmd.Parameters.AddWithValue("@k", Convert.ToDouble(s11[10]));
                            cmd.Parameters.AddWithValue("@l", "cts");
                        }
                        //cmd.Parameters.AddWithValue("@i", s11[8]);
                        cmd.Parameters.AddWithValue("@j", s11[9]);
//                        cmd.Parameters.AddWithValue("@k", s11[10]);
                        //cmd.Parameters.AddWithValue("@l", s11[11]);
                        cmd.Parameters.AddWithValue("@m", s11[12]);
                        cmd.Parameters.AddWithValue("@n", Convert.ToDouble(s11[13])*100);
                        cmd.Parameters.AddWithValue("@o", s11[14]);
                        cmd.Parameters.AddWithValue("@p", s11[15]);
                        cmd.Parameters.AddWithValue("@q", s11[16]);
                        cmd.Parameters.AddWithValue("@r", s11[17]);
                        cmd.Parameters.AddWithValue("@s", s11[18].Substring(3));
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
                catch (Exception e1)
                {
                    MetroMessageBox.Show(this, "\nError in " + lot+"\n"+e1.GetBaseException(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                xlWorkBook.Close(true, null, null);
                xlApp.Quit();

                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlApp);
                MetroMessageBox.Show(this, "\nIMPORT SUCCESSFULLY COMPLETED!", "CONGRATULATIONS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 22
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                //vou usar essas variáveis para facilitar a leitura do código abaixo.
                bool permissao = false;

                #region Cadastrar/Atualizar perfil

                if (Codigo == null)
                {
                    Perfil per = new Perfil(txtNomePerfil.Text, IdLogin, DateTime.Now);

                    MetroMessageBox.Show(this, per.Insere(txtNomePerfil.Text, IdLogin, DateTime.Now),
                                         "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Question, 150);

                    _IdPerfil = bd.GetID(txtNomePerfil.Text, "ID_PERFIL", "PERFIL");

                    //sempre que for necessário inserir dados de um Table para o banco,
                    //será necessário usar um for para inserir linha por linha
                    //aqui uso um Count - 1 para ignorar a última linha em branco do Table
                    for (int i = 0; i < dgvDados.Rows.Count - 1; i++)
                    {
                        permissao = Convert.ToBoolean(dgvDados.Rows[i].Cells[0].Value);

                        _IdModulo = bd.GetID(dgvDados.Rows[i].Cells[1].Value.ToString(), "ID_MODULO", "MODULO");

                        ModuloPerfil mdp = new ModuloPerfil(_IdModulo, _IdPerfil, permissao);

                        mdp.Insere(_IdModulo, _IdPerfil, permissao);
                    }
                }
                else
                {
                    _IdPerfil = bd.GetID(txtNomePerfil.Text, "ID_PERFIL", "PERFIL");

                    for (int i = 0; i < dgvDados.Rows.Count - 1; i++)
                    {
                        permissao = Convert.ToBoolean(dgvDados.Rows[i].Cells[0].Value);

                        _IdModulo = bd.GetID(dgvDados.Rows[i].Cells[1].Value.ToString(), "ID_MODULO", "MODULO");

                        ModuloPerfil mdp = new ModuloPerfil();

                        mdp.Altera(_IdModulo, permissao, _IdPerfil);
                    }

                    MetroMessageBox.Show(this, "Atualizado com sucesso", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Question, 150);
                }

                #endregion

                #region Saindo ou limpando campos do formulário

                //pergunta se quer fechar o form ou não
                var sair = MetroMessageBox.Show(this, "Fechar o formulário?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, 150);

                if (sair == System.Windows.Forms.DialogResult.Yes)
                {
                    this.Close();
                }
                else
                {
                    LimparCampos();
                }

                #endregion
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "Ocorreu um erro", MessageBoxButtons.OK, MessageBoxIcon.Error, 150);
            }
        }
Exemplo n.º 23
0
        private void metroButton10_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Excel csv files (*.csv)|*.csv|All files (*.*)|*.*";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string constring = "SERVER=localhost;DATABASE=Silvercity;UID=root;PASSWORD=smhs;";
                string file = openFileDialog1.FileName;

                Excel.Application xlApp;
                Excel.Workbook xlWorkBook;
                Excel.Worksheet xlWorkSheet;
                Excel.Range range;
                string str = "";
                int rCnt = 0;
                int cCnt = 0;
                int count = 1;
                xlApp = new Excel.Application();
                xlWorkBook = xlApp.Workbooks.Open(file, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
                
                range = xlWorkSheet.UsedRange;
                int end = 0;
                String lot = "";
                try
                {
                    for (rCnt = 2; rCnt <= 46; rCnt++)
                    {
                        str = "";
                                            
                        for (cCnt = 2; cCnt <= 4; cCnt++)
                        {
                                str =str+ (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2+",";
                            if (str.StartsWith("END"))
                            {
                                end = 1;
                                break;
                            }
                        }

                        //MessageBox.Show(str);
                        byte[] ImageData = new byte[] { 0x20 };

                        Microsoft.Office.Interop.Excel.Range r1 = (Microsoft.Office.Interop.Excel.Range)xlWorkSheet.Cells[rCnt, cCnt];      //Select cell A1
                        object cellValue = r1.Value2;
                        
                        Microsoft.Office.Interop.Excel.Picture pic = (Microsoft.Office.Interop.Excel.Picture)xlWorkSheet.Pictures(count);
                        count++;

                        if (pic != null)
                        {
                            //This code will detect what the region span of the image was
                            int startCol = (int)pic.TopLeftCell.Column;
                            int startRow = (int)pic.TopLeftCell.Row;
                            int endCol = (int)pic.BottomRightCell.Column;
                            int endRow = (int)pic.BottomRightCell.Row;


                            pic.CopyPicture(Microsoft.Office.Interop.Excel.XlPictureAppearance.xlScreen, Microsoft.Office.Interop.Excel.XlCopyPictureFormat.xlBitmap);
                            if (Clipboard.ContainsImage())
                            {
                                Image img = Clipboard.GetImage();
                                PictureBox p1 = new PictureBox();
                                p1.Image = img;
                                p1.Image.Save(@"C:\Silver City\Files\temp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                                FileStream fs;
                                BinaryReader br;

                                string FileName = @"C:\Silver City\Files\temp.jpg";
                                fs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
                                br = new BinaryReader(fs);
                                ImageData = br.ReadBytes((int)fs.Length);
                                //MessageBox.Show("Hello");
                                br.Close();
                                fs.Close();
                                File.Delete(@"C:\Silver City\Files\temp.jpg");
                    
                            }
                        }


                        if (end == 1)
                            break;
                        String[] s11 = new String[4];
                        str = str.Trim();
                        s11 = str.Split(',');
                        //MessageBox.Show("Hello");
                        MySqlConnection con = new MySqlConnection("SERVER=localhost;DATABASE=SilverCity;UID=root;PASSWORD=smhs;");
                        con.Open();
                        string CmdString = "INSERT INTO Item(code, size, pic, descrip,cate) VALUES(@FirstName, @LastName, @Image, @Address,@cat)";
                        MySqlCommand cmd = new MySqlCommand(CmdString, con);

                        cmd.Parameters.AddWithValue("@FirstName", s11[2]);
                        cmd.Parameters.AddWithValue("@LastName", s11[0]);
                        //MessageBox.Show("Hey");
                        cmd.Parameters.AddWithValue("@Image", ImageData);
                        //MessageBox.Show("Hey");
                        cmd.Parameters.AddWithValue("@Address", s11[1]);
                        cmd.Parameters.AddWithValue("@cat", "Pendant");
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
                catch (Exception e1)
                {
                    MetroMessageBox.Show(this, "\nError in " + lot + "\n" + e1.GetBaseException(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                xlWorkBook.Close(true, null, null);
                xlApp.Quit();
                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlApp);
                MetroMessageBox.Show(this, "\nIMPORT SUCCESSFULLY COMPLETED!", "CONGRATULATIONS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// DB 업데이트(UPDATE) 및 입력(INSERT) 처리
        /// </summary>
        private void ControlDataProcess()
        {
            if (myMode == BaseMode.NONE)
            {
                MetroMessageBox.Show(this, "신규등록시 신규 버튼을 눌러주세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            try
            {
                // DB에 새로운 값 추가/변경
                using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR))
                {
                    conn.Open();
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.Connection = conn;

                    // 저장 버튼을 눌렀을 때
                    if (myMode == BaseMode.UPDATE)
                    {
                        cmd.CommandText = @"UPDATE rentaltbl
											SET
												memberIdx = @memberIdx,
												bookIdx = @bookIdx,
												rentalDate = @rentalDate,
												returnDate = @returnDate
											WHERE Idx = @Idx"                                            ;
                    }
                    // 신규 버튼을 눌렀을 때
                    else if (myMode == BaseMode.INSERT)
                    {
                        cmd.CommandText = @"INSERT INTO rentaltbl
											(
											 memberIdx,
											 bookIdx,
											 rentalDate,
											 returnDate
											)
											VALUES
											(
											 @memberIdx,
											 @bookIdx,
											 @rentalDate,
											 @returnDate
											)"                                            ;
                    }

                    MySqlParameter paramMemberIdx = new MySqlParameter("@memberIdx", MySqlDbType.Int32);
                    paramMemberIdx.Value = CboMember.SelectedValue;
                    cmd.Parameters.Add(paramMemberIdx);

                    MySqlParameter paramBookIdx = new MySqlParameter("@bookIdx", MySqlDbType.Int32);
                    paramBookIdx.Value = CboBookNames.SelectedValue;
                    cmd.Parameters.Add(paramBookIdx);

                    MySqlParameter paramRentalDate = new MySqlParameter("@rentalDate", MySqlDbType.Date);
                    paramRentalDate.Value = DtirentalDate.Value;
                    cmd.Parameters.Add(paramRentalDate);

                    // INSERT인 경우 ReturnDate(반납일)는 빈 값으로 저장한다.
                    MySqlParameter paramReturnDate = new MySqlParameter("@returnDate", MySqlDbType.Date);
                    if (myMode == BaseMode.INSERT)
                    {
                        paramReturnDate.Value = null;
                    }
                    else
                    {
                        paramReturnDate.Value = DtireturnDate.Value;
                    }
                    cmd.Parameters.Add(paramReturnDate);

                    if (myMode == BaseMode.UPDATE)
                    {
                        MySqlParameter paramIdx = new MySqlParameter("@Idx", MySqlDbType.Int32);
                        paramIdx.Value = TxtIdx.Text;
                        cmd.Parameters.Add(paramIdx);
                    }

                    // 값이 제대로 DB로 넘어가면 return 1
                    var result = cmd.ExecuteNonQuery();

                    if (myMode == BaseMode.INSERT)
                    {
                        MetroMessageBox.Show(this, $"{result}건이 신규입력되었습니다.", "신규입력");
                    }
                    else if (myMode == BaseMode.UPDATE)
                    {
                        MetroMessageBox.Show(this, $"{result}건이 추가되었습니다.", "추가");
                    }
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, $"에러발생 : {ex.Message}", "에러", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                UpdateData();
            }
        }
Exemplo n.º 25
0
        private void BtnCreateInvoiceData_Click(object sender, EventArgs e)
        {
            if (!CheckUtility.SearchConditionCheck(this, lblDate.LabelText, txtBilling_Date.Text.Trim(), true, Utility.DataType.YEARMONTH, 7, 6))
            {
                return;
            }
            string status = "0";
            frmInvoiceListController oController = new frmInvoiceListController();
            DataTable dt = oController.CreateInvoiceData(txtBilling_Date.Text, status);

            string return_message = "";
            string count          = "";
            string strMsg         = "";

            try
            {
                return_message = dt.Rows[0]["Error Message"].ToString();
                count          = dt.Rows[0]["Count"].ToString();
            }
            catch (Exception)
            {
            }

            if (!string.IsNullOrEmpty(return_message) && count == "1")
            {
                var confirmResult = MetroMessageBox.Show(this, "\n" + return_message, "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (confirmResult == DialogResult.OK)
                {
                    status = "1";
                    //send to web service
                    frmInvoiceListController controller = new frmInvoiceListController();
                    DataTable dtResult = oController.CreateInvoiceData(txtBilling_Date.Text, status);


                    try
                    {
                        strMsg = dtResult.Rows[0]["Error Message"].ToString();
                        count  = dtResult.Rows[0]["Count"].ToString();
                        //messageInfo = dtResult.Rows[0]["Message Info"].ToString();
                    }
                    catch (Exception ex)
                    {
                    }
                    if (!string.IsNullOrEmpty(strMsg) && !string.IsNullOrEmpty(count))
                    {
                        if (count == "2")
                        {
                            MetroMessageBox.Show(this, "\n" + strMsg, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        }

                        if (count == "0")
                        {
                            MetroMessageBox.Show(this, "\n" + strMsg, "Fail", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            else
            {
                if (count == "2")
                {
                    MetroMessageBox.Show(this, "\n" + return_message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
                if (count == "0")
                {
                    MetroMessageBox.Show(this, "\n" + return_message, "Fail", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 26
0
        void ChoosePreset()
        {
            var spv = new SelectPresetView();

            if (spv.ShowDialog() == DialogResult.OK)
            {
                var msg = "Wenn Du jetzt auf Ok klickst, werden die bereits vorhandenen Namen der Eigenschaften (linke Spalte) überschrieben!";
                if (MetroMessageBox.Show(this, msg, "Catalist - Preset", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var preset = spv.SelectedPreset;

                    if (!preset.IsProperty1Null())
                    {
                        this.myProduct.Eigenschaft1 = preset.Property1;
                        this.txtProperty1.Text      = preset.Property1;
                    }
                    if (!preset.IsProperty2Null())
                    {
                        this.myProduct.Eigenschaft2 = preset.Property2;
                        this.txtProperty2.Text      = preset.Property2;
                    }
                    if (!preset.IsProperty3Null())
                    {
                        this.myProduct.Eigenschaft3 = preset.Property3;
                        this.txtProperty3.Text      = preset.Property3;
                    }
                    if (!preset.IsProperty4Null())
                    {
                        this.myProduct.Eigenschaft4 = preset.Property4;
                        this.txtProperty4.Text      = preset.Property4;
                    }
                    if (!preset.IsProperty5Null())
                    {
                        this.myProduct.Eigenschaft5 = preset.Property5;
                        this.txtProperty5.Text      = preset.Property5;
                    }
                    if (!preset.IsProperty6Null())
                    {
                        this.myProduct.Eigenschaft6 = preset.Property6;
                        this.txtProperty6.Text      = preset.Property6;
                    }
                    if (!preset.IsProperty7Null())
                    {
                        this.myProduct.Eigenschaft7 = preset.Property7;
                        this.txtProperty7.Text      = preset.Property7;
                    }
                    if (!preset.IsProperty8Null())
                    {
                        this.myProduct.Eigenschaft8 = preset.Property8;
                        this.txtProperty8.Text      = preset.Property8;
                    }
                    if (!preset.IsProperty9Null())
                    {
                        this.myProduct.Eigenschaft9 = preset.Property9;
                        this.txtProperty9.Text      = preset.Property9;
                    }
                    if (!preset.IsProperty10Null())
                    {
                        this.myProduct.Eigenschaft10 = preset.Property10;
                        this.txtProperty10.Text      = preset.Property10;
                    }
                    if (!preset.IsProperty11Null())
                    {
                        this.myProduct.Eigenschaft11 = preset.Property11;
                        this.txtProperty11.Text      = preset.Property11;
                    }
                    if (!preset.IsProperty12Null())
                    {
                        this.myProduct.Eigenschaft12 = preset.Property12;
                        this.txtProperty12.Text      = preset.Property12;
                    }
                    if (!preset.IsProperty13Null())
                    {
                        this.myProduct.Eigenschaft13 = preset.Property13;
                        this.txtProperty13.Text      = preset.Property13;
                    }
                    if (!preset.IsProperty14Null())
                    {
                        this.myProduct.Eigenschaft14 = preset.Property14;
                        this.txtProperty14.Text      = preset.Property14;
                    }
                }
                else
                {
                    string msg1 = "Sollen alle vorhandenen Bezeichnungen der Eigenschaften gelöscht werden?";
                    if (MetroMessageBox.Show(this, msg1, "Catalist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        this.txtProperty1.Text  = string.Empty;
                        this.txtProperty2.Text  = string.Empty;
                        this.txtProperty3.Text  = string.Empty;
                        this.txtProperty4.Text  = string.Empty;
                        this.txtProperty5.Text  = string.Empty;
                        this.txtProperty6.Text  = string.Empty;
                        this.txtProperty7.Text  = string.Empty;
                        this.txtProperty8.Text  = string.Empty;
                        this.txtProperty9.Text  = string.Empty;
                        this.txtProperty10.Text = string.Empty;
                        this.txtProperty11.Text = string.Empty;
                        this.txtProperty12.Text = string.Empty;
                        this.txtProperty13.Text = string.Empty;
                    }
                }
            }
        }
Exemplo n.º 27
0
        private void txtPID_Leave(object sender, EventArgs e)
        {
            //txtPID.Text = (txtPID.Text == "") ? "1000000" : txtPID.Text;

            //if (txtPID.Text == "" || txtPID.Text== "1000000" || (txtPID.Text.Length>3 && txtPID.Text.Length <5) )
            //{
            //    cmbDepartment.Visible = false;
            //    cmbCourse.Visible = false;
            //    cmbYear.Visible = false;
            //    cmbDepartment.Enabled = false;
            //    cmbCourse.Enabled = false;
            //    cmbYear.Enabled = false;
            //    cmbDepartment.Text = "SEAIT";
            //    cmbYear.Text = "1st";
            //    cmbCourse.Text = "BSIT";
            //    gbImmu.Enabled = false;
            //    gbImmu.Visible = false;
            //}
            //else if(txtPID.Text.Length>7)
            //{
            //    cmbDepartment.Enabled = true;
            //    cmbCourse.Enabled = true;
            //    cmbYear.Enabled = true;
            //    gbImmu.Enabled = true;
            //    gbImmu.Visible = true;
            //    cmbDepartment.Visible = true;
            //    cmbCourse.Visible = true;
            //    cmbYear.Visible = true;
            //}
            pm.studentId = txtPID.Text;
            if (pm.verifyID() && txtPID.Text != "")
            {
                DialogResult res = MetroMessageBox.Show(this, "ID is already on the system \n" + "Do you want to view the record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (res == DialogResult.Yes)
                {
                    frmPatients fp = new frmPatients();
                    fp.txtSearch1.Text = txtPID.Text;
                    fp.uid             = uid;
                    fp.ShowDialog();
                }
                txtPID.Text = "";
                txtPID.Focus();
            }
            //else
            //  {

            //      DialogResult res = MetroMessageBox.Show(this,"If Yes, Kindly Tap your ID Card to Card Reader","Register your SMU ID Card?",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
            //      if (res == DialogResult.Yes)
            //      {
            //          frmRFID rf = new frmRFID();
            //          for (int i = 0; i == 0; i++)
            //          {
            //              if (rf.connectCard())
            //              {
            //                  pm.uid = rf.getcardUID();
            //              }
            //              else
            //              {
            //                  pm.uid = "";
            //                  DialogResult ress = MetroMessageBox.Show(this, "No ID Card Recognized!", "Do you want to try again?", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
            //                  if (res == DialogResult.Retry)
            //                  {

            //                      i = 0;
            //                  }
            //              }
            //          }
            //          rf.Dispose();
            //      }
            //      MessageBox.Show(pm.uid);
            //  }
        }
Exemplo n.º 28
0
        private void accepSetting()
        {
            bool is_restartThread = false;

            if (MetroMessageBox.Show(this, "Bạn có chắc muốn thực hiện hành động này ?, Có thể bạn sẽ phải đóng ứng dụng để áp dụng thiết lập này!", "Warning !", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                try
                {
                    Properties.Settings.Default.FPIPWidth         = trackWidth.Value;
                    Properties.Settings.Default.FPIPHeight        = trackHeight.Value;
                    Properties.Settings.Default.FPIPPanelWidth    = Library.PIPPanelWidth;
                    Properties.Settings.Default.FPIPPanelHeight   = Library.PIPPanelHeight;
                    Properties.Settings.Default.FPIPPanelLocation = Library.PIPPanelLocation;
                    Properties.Settings.Default.FIsMessenging     = cbMessenging.Checked;

                    Library.PIPWidth  = trackWidth.Value;
                    Library.PIPHeight = trackHeight.Value;
                    this.Close();

                    if (cbClear.Checked)
                    {
                        Cef.GetGlobalCookieManager().DeleteCookies("", "");
                        Library.RestartMessenger();
                    }

                    if (Properties.Settings.Default.FStopGPU != cbDisableGPU.Checked)
                    {
                        Properties.Settings.Default.FStopGPU = cbDisableGPU.Checked;
                        is_restartThread = true;
                    }

                    if (rdbHideName.Checked)
                    {
                        Properties.Settings.Default.FPIPIsShowName = false;
                    }
                    else
                    {
                        Properties.Settings.Default.FPIPIsShowName = true;
                    }

                    if (Properties.Settings.Default.FIsShowTop != cbHead.Checked)
                    {
                        //is_restartThread = true;
                        Library.RunTopMost(cbHead.Checked);
                    }

                    if (Properties.Settings.Default.FEnableFA != cbFA.Checked)
                    {
                        if (Library.int_windows != 1 && !cbFA.Checked)
                        {
                            Library.FacebookCefShutdow();
                        }
                        Properties.Settings.Default.FEnableFA = cbFA.Checked;
                    }

                    Properties.Settings.Default.FIsPIPTopMost = cbbPIPTopMost.Checked;

                    Properties.Settings.Default.FIntWinStyle = cbbStyleWin.SelectedIndex;

                    Properties.Settings.Default.FIsOutApplication = cbOutApplication.Checked;

                    Properties.Settings.Default.FIsRunbackground = !cbOffSystem.Checked;

                    Properties.Settings.Default.FIsShowMessenger = cbOffNotifi.Checked;

                    Properties.Settings.Default.FIsShowTop = cbHead.Checked;

                    Properties.Settings.Default.FPIPPanelLocation = Library.PIPPanelLocation;

                    Properties.Settings.Default.FIsAutoUpdate = cbOffUpdate.Checked;

                    Properties.Settings.Default.Save();

                    if (is_restartThread)
                    {
                        Application.ExitThread();
                        Application.Restart();
                    }
                    this.Dispose();
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
                catch
                {
                    MetroMessageBox.Show(this, "Hệ thống gặp lỗi không xác định!", "Lỗi !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 29
0
        private void PokePCPatch()
        {
            try
            {
                if (string.IsNullOrEmpty(currentPatchToPoke.BuildString))
                {
                    return;
                }

                var pokeInfo = App.AssemblyStorage.AssemblySettings.DefaultDatabase.FindEngineByVersion(currentPatchToPoke.BuildString);
                if (pokeInfo == null)
                {
                    MetroMessageBox.Show("Unsupported Build",
                                         "This patch is for a build (" + currentPatchToPoke.BuildString + ") that this installation of Assembly does not support. Make sure you are up to date or add a definition manually.");
                    return;
                }

                if (pokeInfo.Name.Contains("Vista"))
                {
                    MetroMessageBox.Show("Unsupported Build",
                                         "This patch is for Halo 2 Vista which cannot be poked at this time.");
                    return;
                }

                if (string.IsNullOrEmpty(pokeInfo.GameExecutable) || string.IsNullOrEmpty(pokeInfo.GameModule) || pokeInfo.Poking == null)
                {
                    MetroMessageBox.Show("Unsupported Build",
                                         "This patch is for a build (" + pokeInfo.Version + ") that this installation of Assembly does not have enough information for to poke patches.\r\n" +
                                         "This includes a gameExecutable and gameModule value and a poking definition which includes a pointer with the game version you are running.\r\n" +
                                         "Make sure you are up to date or add a definition manually.");
                    return;
                }



                var gameRTE    = new ThirdGenMCCRTEProvider(pokeInfo);
                var gameStream = gameRTE.GetMetaStream();

                if (currentPatchToPoke.MetaChangesIndex >= 0)
                {
                    if (currentPatchToPoke.SegmentChanges.Count > 1)
                    {
                        if (MetroMessageBox.Show("Possible unexpected results ahead!",
                                                 "This patch contains edits to segments other than the meta, ie locales and the file header, it could crash if you continue. \n\nDo you wish to continue?",
                                                 MetroMessageBox.MessageBoxButtons.YesNo) == MetroMessageBox.MessageBoxResult.No)
                        {
                            return;
                        }
                    }

                    SegmentChange changes = currentPatchToPoke.SegmentChanges[currentPatchToPoke.MetaChangesIndex];
                    if (changes.OldSize != changes.NewSize)
                    {
                        // can't poke, patch injects meta
                        MetroMessageBox.Show("Unable to Poke Patch",
                                             "This patch contains meta that has been injected, and can't be poked.");
                        return;
                    }

                    foreach (DataChange change in changes.DataChanges)
                    {
                        gameStream.BaseStream.Seek(currentPatchToPoke.MetaPokeBase + change.Offset,
                                                   SeekOrigin.Begin);
                        gameStream.BaseStream.Write(change.Data, 0x00, change.Data.Length);
                    }
                }
                else if (currentPatchToPoke.MetaChanges.Count > 0)
                {
                    foreach (DataChange change in currentPatchToPoke.MetaChanges)
                    {
                        gameStream.BaseStream.Seek(change.Offset, SeekOrigin.Begin);
                        gameStream.BaseStream.Write(change.Data, 0x00, change.Data.Length);
                    }
                }

                MetroMessageBox.Show("Patch Poked!", "Your patch has been poked successfully. Have fun!");
            }
            catch (Exception ex)
            {
                MetroException.Show(ex);
            }
        }
Exemplo n.º 30
0
        private void metroButtonGuardar_Click(object sender, EventArgs e)
        {
            if (ValidateDataInput())
            {
                if (IsNotToLargeTextBox())
                {
                    List <string> autores;
                    List <string> keyWords;

                    FillDocumentData(out autores, out keyWords);

                    if (_updateForm)
                    {
                        if (_urlPdfSelected != _oldUrlPdfSelected)
                        {
                            string currentDir = Environment.CurrentDirectory;
                            string directory  = currentDir + _oldUrlPdfSelected;
                            if (File.Exists(directory))
                            {
                                try
                                {
                                    System.IO.File.Delete(directory);
                                    _documentServices.Update(_datos, autores, keyWords, _tipoDocumento, _idDocument,
                                                             _documentsParList);
                                    ShowNotification("Se ha actualizado correctamente.");
                                }
                                catch (Exception)
                                {
                                    MetroMessageBox.Show(this, Resources.UpdateFileError, Resources.Information,
                                                         MessageBoxButtons.OK,
                                                         MessageBoxIcon.Warning, 120);

                                    currentDir = Environment.CurrentDirectory;
                                    directory  = currentDir + _urlPdfSelected;
                                    System.IO.File.Delete(directory);
                                }
                            }
                            else
                            {
                                _documentServices.Update(_datos, autores, keyWords, _tipoDocumento, _idDocument,
                                                         _documentsParList);
                                ShowNotification("Se ha actualizado correctamente.");
                            }
                        }
                        else
                        {
                            _documentServices.Update(_datos, autores, keyWords, _tipoDocumento, _idDocument,
                                                     _documentsParList);
                            ShowNotification("Se ha actualizado correctamente.");
                        }
                        this.Close();
                    }
                    else
                    {
                        if (_documentServices.IsUnicDocument(_datos[0], _datos[1], _tipoDocumento))
                        {
                            try
                            {
                                _documentServices.Insert(_datos, autores, keyWords, _tipoDocumento);
                                //limpio los campos luego d ela insercion
                                metroButtClean_Click(sender, e);
                                ShowNotification("Se ha insertado correctamente.");
                            }
                            catch (Exception exception)
                            {
                                MetroMessageBox.Show(this, Resources.IncorrectInsert, Resources.Information,
                                                     MessageBoxButtons.OK,
                                                     MessageBoxIcon.Warning, 100);
                                textBoxTittle.Focus();
                            }
                        }
                        else
                        {
                            MetroMessageBox.Show(this, Resources.UnicDocument, Resources.Information,
                                                 MessageBoxButtons.OK,
                                                 MessageBoxIcon.Warning, 100);
                            textBoxTittle.Focus();
                        }
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, Resources.ToLargeFields, Resources.Information, MessageBoxButtons.OK,
                                         MessageBoxIcon.Warning, 100);
                }
            }
            else
            {
                MetroMessageBox.Show(this, Resources.EmptyFields, Resources.Information, MessageBoxButtons.OK,
                                     MessageBoxIcon.Warning, 100);
                textBoxTittle.Focus();
            }
        }
Exemplo n.º 31
0
        // Patch Applying
        private void btnApplyPatch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Check the user isn't completly retarded
                if (!CheckAllApplyMandatoryFields() || currentPatch == null)
                {
                    return;
                }

                // Check the output name
                if (cacheOutputName != "")
                {
                    if (Path.GetFileNameWithoutExtension(txtApplyPatchOutputMap.Text) != cacheOutputName)
                    {
                        if (MetroMessageBox.Show("Warning",
                                                 "This patch suggests to use the filename \"" + cacheOutputName +
                                                 ".map\" to save this map. This filename may be required in order for the map to work correctly.\r\n\r\nAre you sure you want to save this map as \"" +
                                                 Path.GetFileName(txtApplyPatchOutputMap.Text) + "\"?",
                                                 MetroMessageBox.MessageBoxButtons.OkCancel) != MetroMessageBox.MessageBoxResult.OK)
                        {
                            Close();
                            return;
                        }
                    }
                }

                // Paths
                string unmoddedMapPath = txtApplyPatchUnmodifiedMap.Text;
                string outputPath      = txtApplyPatchOutputMap.Text;

                // Copy the original map to the destination path
                File.Copy(unmoddedMapPath, outputPath, true);

                // Open the destination map
                using (var stream = new EndianStream(File.Open(outputPath, FileMode.Open, FileAccess.ReadWrite), Endian.BigEndian))
                {
                    EngineDatabase engineDb  = XMLEngineDatabaseLoader.LoadDatabase("Formats/Engines.xml");
                    ICacheFile     cacheFile = CacheFileLoader.LoadCacheFile(stream, outputPath, engineDb);
                    if (currentPatch.MapInternalName != null && cacheFile.InternalName != currentPatch.MapInternalName)
                    {
                        MetroMessageBox.Show("Unable to apply patch",
                                             "Hold on there! That patch is for " + currentPatch.MapInternalName +
                                             ".map, and the unmodified map file you selected doesn't seem to match that. Find the correct file and try again.");
                        return;
                    }
                    if (!string.IsNullOrEmpty(currentPatch.BuildString) && cacheFile.BuildString != currentPatch.BuildString)
                    {
                        MetroMessageBox.Show("Unable to apply patch",
                                             "Hold on there! That patch is for a map with a build version of" + currentPatch.BuildString +
                                             ", and the unmodified map file you selected doesn't seem to match that. Find the correct file and try again.");
                        return;
                    }

                    // Apply the patch!
                    if (currentPatch.MapInternalName == null)
                    {
                        currentPatch.MapInternalName = cacheFile.InternalName;
                    }
                    // Because Ascension doesn't include this, and ApplyPatch() will complain otherwise

                    PatchApplier.ApplyPatch(currentPatch, cacheFile, stream);

                    // Check for blf snaps
                    if (cbApplyPatchBlfExtraction.IsChecked != null &&
                        (PatchApplicationPatchExtra.Visibility == Visibility.Visible && (bool)cbApplyPatchBlfExtraction.IsChecked))
                    {
                        string extractDir   = Path.GetDirectoryName(outputPath);
                        string blfDirectory = Path.Combine(extractDir, "images");
                        string infDirectory = Path.Combine(extractDir, "info");
                        if (!Directory.Exists(blfDirectory))
                        {
                            Directory.CreateDirectory(blfDirectory);
                        }
                        if (!Directory.Exists(infDirectory))
                        {
                            Directory.CreateDirectory(infDirectory);
                        }

                        string infPath = Path.Combine(infDirectory, Path.GetFileName(currentPatch.CustomBlfContent.MapInfoFileName));
                        File.WriteAllBytes(infPath, currentPatch.CustomBlfContent.MapInfo);

                        foreach (BlfContainerEntry blfContainerEntry in currentPatch.CustomBlfContent.BlfContainerEntries)
                        {
                            string blfPath = Path.Combine(blfDirectory, Path.GetFileName(blfContainerEntry.FileName));
                            File.WriteAllBytes(blfPath, blfContainerEntry.BlfContainer);
                        }
                    }
                }

                MetroMessageBox.Show("Patch Applied!", "Your patch has been applied successfully. Have fun!");
            }
            catch (Exception ex)
            {
                MetroException.Show(ex);
            }
        }
Exemplo n.º 32
0
        private void BtnCancelAllocation_Click(object sender, EventArgs e)
        {
            #region CheckSelectedRow
            int status     = 0;
            int index      = 0;
            int foundindex = 0;
            foreach (DataGridViewRow row in dgvList.Rows)
            {
                if (row.Cells["colCheck"].Value == null ? false : bool.Parse(row.Cells["colCheck"].Value.ToString()))
                {
                    if (status >= 1) //if already found
                    {
                        status = 2;
                    }
                    else //first selected
                    {
                        status     = 1;
                        foundindex = index;
                    }
                }
                index++;
            }
            #endregion

            if (status == 0) //if no row selected
            {
                MetroMessageBox.Show(this, "\n" + Messages.ComparisonResultDetail.NoSelectedRow, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    DataTable dt = new DataTable();
                    dt.Columns.Add("SEQ_NO");
                    dt.Columns.Add("COMPANY_NO_BOX");
                    dt.Columns.Add("YEAR_MONTH");

                    string strCompanyNoBox = "";
                    int    intseqno        = 0;
                    string strYearMonth    = "";

                    for (int i = 0; i < dgvList.Rows.Count; i++) //get selected items
                    {
                        bool value = bool.Parse(dgvList[0, i].Value == null ? "false" : dgvList[0, i].Value.ToString());
                        if (value == true)
                        {
                            strCompanyNoBox = dgvList.Rows[i].Cells["COMPANY_NO_BOX"].Value.ToString();
                            intseqno        = int.Parse(dgvList.Rows[i].Cells["SEQ_NO"].Value.ToString());
                            strYearMonth    = dgvList.Rows[i].Cells["YEAR_MONTH"].Value.ToString();

                            DataRow dr = dt.NewRow();
                            dr["SEQ_NO"]         = intseqno;
                            dr["COMPANY_NO_BOX"] = strCompanyNoBox;
                            dr["YEAR_MONTH"]     = strYearMonth;
                            dt.Rows.Add(dr);
                        }
                    }

                    Controllers.frm35Controller oController = new Controllers.frm35Controller();
                    bool success = oController.CancelAllocation(dt);
                    if (success)
                    {
                        btnCheckTheResult.PerformClick();
                        MetroMessageBox.Show(this, "\n" + Messages.ComparisonResultDetail.StatusUpdatedToCancel, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (System.TimeoutException)
                {
                    MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (System.Net.WebException)
                {
                    MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    Utility.WriteErrorLog(ex.Message, ex, false);
                    MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }