private void metroButton1_Click(object sender, EventArgs e)
        {
            string currentDate = DateTime.Today.ToString("dd-MM-yyyy");



            // البحث عن طالب
            try
            {
                if (txtseatNo.Text != "")
                {
                    int count = adabstu.FillBy(dataDataSet1.studentData, Convert.ToInt32(txtseatNo.Text));
                    if (count != 0)
                    {
                        txtname.Text     = dataDataSet1.studentData.Rows[0]["stname"].ToString();
                        txtschool.Text   = dataDataSet1.studentData.Rows[0]["scname"].ToString();
                        regionText.Text  = dataDataSet1.studentData.Rows[0]["examScid"].ToString();
                        seerTxt.Text     = dataDataSet1.studentData.Rows[0]["examscname"].ToString();
                        lagnaNumTxt.Text = dataDataSet1.studentData.Rows[0]["seercode"].ToString();
                        typedesc.Text    = dataDataSet1.studentData.Rows[0]["type_adesc"].ToString();
                        stType.Text      = dataDataSet1.studentData.Rows[0]["st_type"].ToString();
                        // depatText.Text = dataDataSet1.studentData.Rows[0]["typecode"].ToString();
                        //gender = dataDataSet1.studentData.Rows[0]["sex"];

                        int typecode = Convert.ToInt32(dataDataSet1.studentData.Rows[0]["typecode"].ToString());
                        if (cmbcourse.SelectedIndex == -1)
                        {
                            //  adabexam.FillBytype(dataDataSet1.examTable, typecode);
                            adabexam.FillByToday(dataDataSet1.examTable, typecode, DateTime.Today);
                        }



                        if (!IsEqualprevDep())
                        {
                            // adabexam.FillBytype(dataDataSet1.examTable, typecode);
                            adabexam.FillByToday(dataDataSet1.examTable, typecode, DateTime.Today);
                        }



                        cmbcourse.DisplayMember = "examName";
                        cmbcourse.ValueMember   = "examId";
                        list = dataDataSet1.examTable;
                        cmbcourse.DataSource = list;


                        //if (!IsEqualprevDep())



                        examscname = dataDataSet1.studentData.Rows[0]["examscname"].ToString();
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "رقم الجلوس غير مسجل بالنظام", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150);
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "من فضلك أدخل رقم الجلوس", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150);
                }
            }
            catch (Exception g)
            {
            }
        }
예제 #2
0
 private void metroButton2_Click(object sender, EventArgs e)
 {
     MetroMessageBox.Show(this, "Do you like this metro message box?", "Metro Title", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk);
 }
예제 #3
0
 private void metroButton8_Click(object sender, EventArgs e)
 {
     MetroMessageBox.Show(this, "This is a sample MetroMessagebox `Yes`, `No` and `Cancel` button", "MetroMessagebox", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
 }
예제 #4
0
 private void metroLink2_Click(object sender, EventArgs e)
 {
     Clipboard.SetData(DataFormats.Text, "https://bowlroll.net/file/95442");
     System.Diagnostics.Process.Start("https://bowlroll.net/file/95442");
     MetroMessageBox.Show(this, "已经复制到剪切板", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
예제 #5
0
        private void btnCreate_Click(object sender, EventArgs e) //triggers the creation of a new field
        {
            bool error = false;

            foreach (TableDef oneTable in clsDataStorage.db.TableDefs) //loops through the tabledefinitions
            {
                if (oneTable.Attributes == 0)
                {
                    foreach (Field abcd in oneTable.Fields)
                    {
                        if (abcd.Name == txtFieldName.Text) //check if table already contains a field with the same name
                        {
                            MetroMessageBox.Show(this, "This table already contains a field with the name " + abcd.Name + ".\nField names have to be unique!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            error = true;
                        }
                    }
                    if (cmbFieldProperty.Text == "Primary" || cmbFieldProperty.Text == "Unique") //check if table contains primary or unique elements
                    {
                        foreach (Index inx in oneTable.Indexes)
                        {
                            if (inx.Primary == true && !error)
                            {
                                MetroMessageBox.Show(this, "This table already contains a field with the property INDEX.\nA table can only contain one index.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                error = true;
                                break;
                            }
                            if (inx.Unique == true && !error)
                            {
                                MetroMessageBox.Show(this, "This table already contains a field with the property UNIQUE.\nA table can only contain one UNIQUE.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                error = true;
                                break;
                            }
                        }
                    }
                }
            }
            if (!error) //if no primary or unique, then create a new field
            {
                table = clsDataStorage.db.TableDefs[cmbListTable.Text];
                string name;
                name = txtFieldName.Text;
                int   size;
                Field field = new Field();
                //creates the field according to the type chosen by the user
                if (cmbFieldType.Text == "Long")
                {
                    size  = Convert.ToInt32(txtFieldSize.Text);
                    field = table.CreateField(name, DAO.DataTypeEnum.dbLong, size);
                    if (chkAuto.Checked)
                    {
                        field.Attributes = (int)DAO.FieldAttributeEnum.dbAutoIncrField;
                    }
                }

                else if (cmbFieldType.Text == "Double")
                {
                    size  = Convert.ToInt32(txtFieldSize.Text);
                    field = table.CreateField(name, DAO.DataTypeEnum.dbDouble, size);
                }

                else if (cmbFieldType.Text == "Text")
                {
                    size  = Convert.ToInt32(txtFieldSize.Text);
                    field = table.CreateField(name, DAO.DataTypeEnum.dbText, size);
                }
                else if (cmbFieldType.Text == "Currency")
                {
                    size  = Convert.ToInt32(txtFieldSize.Text);
                    field = table.CreateField(name, DAO.DataTypeEnum.dbCurrency, size);
                }
                else if (cmbFieldType.Text == "Boolean")
                {
                    size  = Convert.ToInt32(txtFieldSize.Text);
                    field = table.CreateField(name, DAO.DataTypeEnum.dbBoolean, size);
                }
                else
                {
                    field = table.CreateField(name, DAO.DataTypeEnum.dbDate);
                }

                table.Fields.Append(field);             //appends the field to the table

                if (cmbFieldProperty.Text == "Primary") //check if field is primary, then append the property
                {
                    Index index = table.CreateIndex("pk_" + name);
                    field             = index.CreateField(name);
                    index.Primary     = true;
                    index.Required    = true;
                    index.IgnoreNulls = false;
                    ((IndexFields)index.Fields).Append(field);
                    table.Indexes.Append(index);
                }

                else if (cmbFieldProperty.Text == "Unique") //check if field is unique, then append the property
                {
                    Index index = table.CreateIndex("unq_" + name);
                    field             = index.CreateField(name);
                    index.Required    = true;
                    index.Unique      = true;
                    index.IgnoreNulls = false;
                    ((IndexFields)index.Fields).Append(field);
                    table.Indexes.Append(index);
                }
                else if (cmbFieldProperty.Text == "Index") //check if field is index, then append the property
                {
                    Index index = table.CreateIndex("idx_" + name);
                    field             = index.CreateField(name);
                    index.Required    = true;
                    index.Unique      = true;
                    index.IgnoreNulls = false;
                    ((IndexFields)index.Fields).Append(field);
                    table.Indexes.Append(index);
                }
                MetroMessageBox.Show(this, "The new field was included successfully.", "New field", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close(); //after the field being added, closes the form
            }
        }
예제 #6
0
파일: Client.cs 프로젝트: Probeh/CustomChat
 private void OnDisconnect(object sender, SessionEventArgs e)
 {
     MetroMessageBox.Show(this, $"\nNetwork Session Successfully Disposed",
                          $"Disconnected", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
예제 #7
0
 private void metroButton9_Click(object sender, EventArgs e)
 {
     MetroMessageBox.Show(this, "This is a sample MetroMessagebox `Abort`, `Retry` and `Ignore` button.  With Error style.", "MetroMessagebox", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
 }
예제 #8
0
 public static void ShowError(string message)
 {
     MetroMessageBox.Show(FrmMain.Instance, message, "Ha ocurrido un error! Nooooo", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
예제 #9
0
        private void LoginProcess()
        {
            // 빈값 비교 처리
            // TxtUserID나 TxtUserPW가 빈 값일 경우 아래 코드 실행
            if (string.IsNullOrEmpty(TxtUserID.Text) || string.IsNullOrEmpty(TxtUserPW.Text))
            {
                MetroMessageBox.Show(this, "아이디나 패스워드를 입력하세요!", "로그인", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // 실제 DB처리
            string resultId = string.Empty;

            try
            {
                // MySql Connection
                using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR))
                {
                    conn.Open();

                    MySqlCommand cmd = new MySqlCommand();
                    cmd.Connection = conn;
                    // space 신경써서 꼭! 넣어주기
                    // @userID, @password -> 파라미터 : 입력값을 가져옴
                    cmd.CommandText = "SELECT UserID FROM usertbl " +
                                      " WHERE UserID = @userID " +
                                      "   AND Password = @password ";

                    MySqlParameter paramUserId = new MySqlParameter("@userID", MySqlDbType.VarChar, 12);
                    // 입력시 발생하는 공백을 제거하기 위해 Trim()을 사용한다.
                    paramUserId.Value = TxtUserID.Text.Trim();
                    MySqlParameter paramUserPw = new MySqlParameter("@password", MySqlDbType.VarChar);
                    paramUserPw.Value = TxtUserPW.Text.Trim();

                    // Id, PW를 입력
                    cmd.Parameters.Add(paramUserId);
                    cmd.Parameters.Add(paramUserPw);

                    MySqlDataReader reader = cmd.ExecuteReader();
                    // 값을 확인하고 읽어옴
                    reader.Read();

                    // 읽어온 값이 아무것도 없는 경우 (읽어온 값이 있으면 return 1;)
                    if (!reader.HasRows)
                    {
                        MetroMessageBox.Show(this, "아이디나 패스워드를 정확히 입력하세요.", "로그인 실패",
                                             MessageBoxButtons.OK, MessageBoxIcon.Error);
                        TxtUserID.Text = TxtUserPW.Text = "";
                        TxtUserID.Focus();
                        return;
                    }
                    // 읽어온 값 중 userID의 값이 null 이 아니면 문자열로 변환
                    resultId = reader["userID"] != null ? reader["userID"].ToString() : string.Empty;

                    this.mainForm.Login = true;
                    MetroMessageBox.Show(this, $"로그인성공 : {resultId}");
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, $"DB접속 에러 : {ex.Message}", "로그인에러", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (string.IsNullOrEmpty(resultId))
            {
                MetroMessageBox.Show(this, "아이디나 패스워드를 정확히 입력하세요.", "로그인 실패",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtUserID.Text = TxtUserPW.Text = "";
                TxtUserID.Focus();
                return;
            }
            // resultID의 결과가 있는 경우 로그인창 종료
            else
            {
                this.Close();
            }
        }
예제 #10
0
        /// <summary>
        /// Entry point... this will check if we are at the initial setup
        /// phase, and show the installation forms
        /// </summary>
        /// <returns>Returns false if the user cancels the setup before the basic settings are setup, true otherwise</returns>
        public static bool Run()
        {
            // Load the program config
            Settings Config = Settings.Default;

            // If this is the first time running a new update, we need to update the config file
            if (!Config.SettingsUpdated)
            {
                Config.Upgrade();
                Config.SettingsUpdated = true;
                Config.Save();
            }

            // If this is the first run, Get client and server install paths
            if (String.IsNullOrWhiteSpace(Config.Bf2InstallDir) || !File.Exists(Path.Combine(Config.Bf2InstallDir, "bf2.exe")))
            {
                TraceLog.WriteLine("Empty or Invalid BF2 directory detected, running Install Form.");
                if (!ShowInstallForm())
                {
                    return(false);
                }
            }

            // Create the "My Documents/BF2Statistics" folder
            try
            {
                // Make sure documents folder exists
                if (!Directory.Exists(Program.DocumentsFolder))
                {
                    Directory.CreateDirectory(Program.DocumentsFolder);
                }
            }
            catch (Exception E)
            {
                // Alert the user that there was an error
                MessageBox.Show("We encountered an error trying to create the required \"My Documents/BF2Statistics\" folder!"
                                + Environment.NewLine.Repeat(1) + E.Message,
                                "Setup Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error
                                );
                return(false);
            }

            // Load server go.. If we fail to load a valid server, we will come back to here
LoadClient:
            {
                // Load the BF2 Server
                try
                {
                    BF2Client.SetInstallPath(Config.Bf2InstallDir);
                }
                catch (Exception E)
                {
                    MetroMessageBox.Show(Form.ActiveForm, E.Message, "Battlefield 2 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    // Re-prompt
                    if (!ShowInstallForm())
                    {
                        return(false);
                    }

                    goto LoadClient;
                }
            }

            return(true);
        }
예제 #11
0
        private async void MoreInfoForm_Shown(object sender, EventArgs e)
        {
            ActiveControl = null;
            EnableControlls(false);
            var data = await _apiLib.TitleAsync(_id);

            if (!string.IsNullOrEmpty(data.ErrorMessage))
            {
                MetroMessageBox.Show(this, data.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                EnableControlls(true);
                return;
            }
            this.Text             = data.Title;
            lblFullTitle.Text     = data.FullTitle;
            lblOriginalTitle.Text = data.OriginalTitle;
            if (string.IsNullOrEmpty(lblOriginalTitle.Text))
            {
                lblOriginalTitle.Visible = false;
            }
            if (string.IsNullOrEmpty(data.PlotLocal))
            {
                txtPlot.Text = data.Plot;
            }
            else
            {
                txtPlot.Text = data.PlotLocal;
                if (data.PlotLocalIsRtl)
                {
                    txtPlot.RightToLeft = RightToLeft.Yes;
                }
            }

            var creators = new List <StarShort>();

            if (data.DirectorList != null)
            {
                creators.AddRange(data.DirectorList);
            }
            if (data.WriterList != null)
            {
                creators.AddRange(data.WriterList);
            }
            if (data.TvSeriesInfo != null && !string.IsNullOrEmpty(data.TvSeriesInfo.Creators))
            {
                creators.AddRange(data.TvSeriesInfo.CreatorList);
            }

            txtPlot.Visible = lblCreatorsTitle.Visible = lblCountryTitle.Visible = lblCompanyTitle.Visible = lblRuntimeTitle.Visible = lblGenreTitle.Visible = true;

            lblCreators.Text = string.Join(", ", creators.Select(cx => cx.Name).Distinct());
            lblCountry.Text  = string.Join(", ", data.CountryList.Select(cx => cx.Key));
            lblCompany.Text  = data.Companies;
            lblRuntime.Text  = data.RuntimeStr;
            lblGenre.Text    = string.Join(", ", data.GenreList.Select(cx => cx.Key));

            data.Image = data.Image.Replace("/original/", "/224x308/");
            using (var wc = new WebClient())
                picPoster.Image = Utils.BytesToImage(await wc.DownloadDataTaskAsync(data.Image));

            foreach (var act in data.ActorList.Take(6))
            {
                var uc = new CastUserControl();
                act.Image = act.Image.Replace("/original/", "/96x132/");
                using (var wc = new WebClient())
                    uc.CastImage = Utils.BytesToImage(await wc.DownloadDataTaskAsync(act.Image));
                uc.CastName        = act.Name;
                uc.CastAsCharacter = act.AsCharacter;

                flowLayoutPanel1.Controls.Add(uc);
            }
            EnableControlls(true);
        }
예제 #12
0
        private void btnConfirmClassInfor_Click(object sender, EventArgs e)
        {
            Class _class = new Class();

            _class.ID              = txtClassId.Text;
            _class.Room            = txtRoom.Text;
            _class.StudentNum      = 0;
            _class.FormerTeacherID = null;
            if (!Helper.IsInformationOfClassCorrected(_class))
            {
                return;
            }
            BackgroundWorker worker = new BackgroundWorker();

            mainProgressbar.Visible = lbInformation.Visible = true;
            bool success = false, isExist = true;

            if (is_New)
            {
                lbInformation.Text = "Đang thêm lớp...";
                worker.DoWork     += (s, e) =>
                {
                    isExist = classControll.IsClassExist(_class.ID);
                    if (!isExist)
                    {
                        success = classControll.AddNewClass(_class);
                    }
                    if (success)
                    {
                        success = teachingController.AddTeachingForClass(_class.ID);
                    }
                };
                worker.RunWorkerCompleted += (s, e) =>
                {
                    mainProgressbar.Visible = lbInformation.Visible = false;
                    progressSuccess         = success;
                    if (success && !isExist)
                    {
                        MetroMessageBox.Show(this, "Thêm lớp thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        if (isExist)
                        {
                            MetroMessageBox.Show(this, "Mã lớp này đã tồn tại. Vui lòng kiểm tra lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MetroMessageBox.Show(this, "Thêm thất bại vui lòng thử lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                };
            }
            else
            {
                lbInformation.Text = "Đang cập nhật lớp...";
                worker.DoWork     += (s, e) =>
                {
                    success = classControll.UpdateClassInfor(_class.ID, _class.Room);
                };
                worker.RunWorkerCompleted += (s, e) =>
                {
                    mainProgressbar.Visible = lbInformation.Visible = false;
                    progressSuccess         = success;
                    if (success)
                    {
                        MetroMessageBox.Show(this, "Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                        return;
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "Cập nhật thất bại vui lòng thử lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                };
            }
            worker.RunWorkerAsync();
        }
        // طباعة قرار الحرمان
        private void btnprintqarar_Click(object sender, EventArgs e)
        {
            // cofigure data

            DataTable dt = new DataTable();

            dt.Columns.Add("seatno", typeof(string));
            dt.Columns.Add("studentname", typeof(string));

            dt.Columns.Add("school", typeof(string));
            dt.Columns.Add("subject", typeof(string));
            dt.Columns.Add("description", typeof(string));


            dt.Columns.Add("seername", typeof(string));
            dt.Columns.Add("examname", typeof(string));
            dt.Columns.Add("examdate", typeof(string));
            dt.Columns.Add("examday", typeof(string));
            dt.Columns.Add("depart", typeof(string));
            dt.Columns.Add("period", typeof(string));
            dt.Columns.Add("year", typeof(string));
            dt.Columns.Add("number", typeof(string));
            dt.Columns.Add("region", typeof(string));
            dt.Columns.Add("seercode", typeof(string));

            dt.Rows.Add(new object[] { txtseatNo.Text, txtname.Text, txtschool.Text, cmbcourse.Text, txtreport.Text, seerTxt.Text, cmbcourse.Text, txtDate.Text, txtDay.Text, "", "", "", txtnumherman.Text, regionText.Text, lagnaNumTxt.Text });
            int test = 0;



            try
            {
                if (txtname.Text != "" && txtschool.Text != "" && txtnumherman.Text != "" && cmbType.Text != "" && cmbcourse.SelectedIndex != -1 && txtDate.Text != "" && txtDay.Text != "" && txtreport.Text != "")
                {
                    // found in grid

                    if (contain() == 1)
                    {
                        String descCode = getCodeType();

                        adabdec.UpdateQuery1(txtreport.Text, cmbType.Text, descCode, txtnumherman.Text);

                        printreport(dt);
                    }



                    // else not contain
                    else
                    {
                        if (checknameandid() == 1)
                        {
                            // show error message

                            MetroMessageBox.Show(this, "هذا الرقم مسجل لطالب اخر", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, 100);

                            txtnumherman.Text = "";
                            return;
                        }



                        else
                        {
                            if (!hasOldReport(txtseatNo.Text))
                            {
                                if (addtodb(dt) == 1)
                                {
                                    MetroMessageBox.Show(this, "تم إدخال البيانات بنجاح", "معلومات ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, 100);

                                    printreport(dt);
                                    clear();
                                    show();
                                }
                            }
                            else
                            {
                                MetroMessageBox.Show(this, "مسجل للطالب قرار حرمان جميع مجالات او نهائي", " موجود من قبل ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, 100);
                            }
                        }
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "من فضلك أكمل البيانات أولا", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, 100);
                }
            }
            catch (Exception ff)
            {
                if (test == 1)
                {
                    MetroMessageBox.Show(this, "تم إدخال البيانات بنجاح", "معلومات ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, 100);
                    frmReportsMahader f = new frmReportsMahader(dt);

                    clear();
                    show();
                }
            }
        }
        private void devgrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    // عرض قرار سابق من الجريد
                    if (e.ColumnIndex == 6)
                    {
                        adabdec.SearchByID(dataDataSet1.decTbl, Convert.ToInt32(devgrid.Rows[e.RowIndex].Cells[0].Value));
                        dataDataSet.decTblDataTable list1 = dataDataSet1.decTbl;
                        if (list1.Count != 0)
                        {
                            txtname.Text   = list1[0].stName;
                            txtschool.Text = list1[0].scName;
                            txtseatNo.Text = list1[0].seatNo.ToString();
                            cmbcourse.Text = list1[0].examName;



                            txtnumherman.Text = list1[0].decNumber;
                            txtreport.Text    = list1[0].dec_desc;
                            regionText.Text   = list1[0].region;
                            seerTxt.Text      = list1[0].examscName;

                            lagnaNumTxt.Text = list1[0].type_str;

                            txtDate.Text = list1[0].examDate;

                            DateTime dateTime = DateTime.Parse(txtDate.Text);



                            txtDay.Text = dateTime.ToString("dddd", new System.Globalization.CultureInfo("ar-AE"));
                            //  txtDay.Text = list1[0].examday;

                            //cmbcourse.Text = list1[0].examName;



                            adabstu.FillBy(dataDataSet1.studentData, Convert.ToInt32(txtseatNo.Text));

                            adabexam.FillBytype(dataDataSet1.examTable, Convert.ToInt32(dataDataSet1.studentData.Rows[0][4].ToString()));
                            cmbcourse.DisplayMember = "examName";
                            cmbcourse.ValueMember   = "examId";
                            list = dataDataSet1.examTable;
                            cmbcourse.DataSource = list;
                            cmbcourse.Text       = list1[0].examName;



                            // cmbType.Text = cmbcourse.Text;
                            metroTextBox1.Text = list1[0].decType;


                            adabeReport.Fill(dataDataSet1.reportTypes);

                            cmbType.DisplayMember = "description";
                            cmbType.ValueMember   = "Id";
                            reportTypeList        = dataDataSet1.reportTypes;
                            cmbType.DataSource    = reportTypeList;
                            cmbType.Text          = metroTextBox1.Text;
                        }
                    }

                    // حذف قرار
                    else if (e.ColumnIndex == 7)
                    {
                        int          test = 0;
                        DialogResult res  = MetroMessageBox.Show(this, "هل أنت متأكد من حذف هذا القرار \n مع العلم  سيتم حذفه نهائياَ؟", "معلومات", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, 150);
                        if (res == DialogResult.Yes)
                        {
                            adabdec.SearchByID(dataDataSet1.decTbl, Convert.ToInt32(devgrid.Rows[e.RowIndex].Cells[0].Value));
                            dataDataSet.decTblDataTable list = dataDataSet1.decTbl;
                            if (list.Count != 0)
                            {
                                test = adabdec.DeleteQuery(list[0].decNumber, Int32.Parse(list[0].seatNo));

                                if (test == 1)
                                {
                                    MetroMessageBox.Show(this, "تم حذف البيانات بنجاح", "معلومات ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, 100);

                                    show();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception v)
            {
            }
        }
예제 #15
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            var strUserId = "";

            if (string.IsNullOrEmpty(TxtUserId.Text) || string.IsNullOrEmpty(TxtPassword.Text))
            {
                MetroMessageBox.Show(this, "아이디/패스워드를 입력하세요!", "오류",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                // SqlConnection 연결
                using (SqlConnection conn = new SqlConnection(Helper.Common.ConnString))
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }

                    var query = "SELECT userID FROM membertbl " +
                                " WHERE userID = @userID    " +
                                "   AND passwords = @passwords " +
                                "   AND levels = 'S' ";

                    // SqlCommand 생성
                    SqlCommand cmd = new SqlCommand(query, conn);

                    // SqlInjection 해킹 막기 위해서 사용
                    SqlParameter pUserID = new SqlParameter("@userId", SqlDbType.VarChar, 20);
                    pUserID.Value = TxtUserId.Text;
                    cmd.Parameters.Add(pUserID);

                    SqlParameter pPasswords = new SqlParameter("@passwords", SqlDbType.VarChar, 20);
                    pPasswords.Value = TxtPassword.Text;
                    cmd.Parameters.Add(pPasswords);

                    // SqlDataReader 실행(1)
                    SqlDataReader reader = cmd.ExecuteReader();
                    // reader로 처리
                    reader.Read();
                    strUserId = reader["userID"] != null ? reader["userID"].ToString() : "";
                    reader.Close();
                    // 값이 넘어오는지 중간 확인
                    //MessageBox.Show(strUserId);

                    if (string.IsNullOrEmpty(strUserId))
                    {
                        MetroMessageBox.Show(this, "접속실패", "로그인실패", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var updateQuery = $@"UPDATE membertbl SET 
                                               lastloginDt = GETDATE() 
                                               , loginIpAddr = '{Helper.Common.GetLocalIp()}' 
                                               WHERE userId = '{strUserId}' ";
                        cmd.CommandText = updateQuery;
                        cmd.ExecuteNonQuery();
                        MetroMessageBox.Show(this, "접속성공", "로그인성공", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, $"Error : {ex.Message}", "Error",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        private async void BtnPreview_Click(object sender, EventArgs e)
        {
            if (CheckUtility.SearchConditionCheck(this, lblDestinationMailAddress.Text, txtDestinationMailAddress.Text, false, Utility.DataType.EMAIL, 255, 0))
            {
                frmRegisterCompleteNotificationController oController = new frmRegisterCompleteNotificationController();
                try
                {
                    DataTable result = oController.PreviewFunction(txtCompanyName.Text, txtCompanyNoBox.Text, REQ_SEQ, txtEDIAccount.Text);

                    string return_message = "";
                    try
                    {
                        return_message = result.Rows[0]["Message"].ToString();
                    }
                    catch (Exception)
                    {
                    }
                    string FILENAME = "";
                    if (string.IsNullOrEmpty(return_message))
                    {
                        FILENAME = result.Rows[0]["FILENAME"].ToString();
                        MetroMessageBox.Show(this, "\n" + JimugoMessages.I000WB001, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "\n" + return_message, "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    DataTable dt = DTParameter(txtCompanyNoBox.Text, REQ_SEQ, QUOTATION_DATE, ORDER_DATE, COMPLETION_NOTIFICATION_DATE, COMPANY_NAME, txtDestinationMailAddress.Text, txtEDIAccount.Text, FILENAME);

                    #region CallPreviewScreen
                    string temp_deirectory = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"/Temp";

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

                    //delete temp files
                    Utility.DeleteFiles(temp_deirectory);

                    string destinationpath = temp_deirectory + "/" + FILENAME;
                    btnPreview.Enabled = false;
                    bool success = await Core.WebUtility.Download(Properties.Settings.Default.GetTempFile + "?FILENAME=" + FILENAME, destinationpath);

                    if (success)
                    {
                        frmRegisterCompleteNotificationPreview frm = new frmRegisterCompleteNotificationPreview(dt);
                        frm.ShowDialog();
                        this.Show();
                        UPDATED_AT     = frm.UPDATED_AT;
                        UPDATED_AT_RAW = frm.UPDATED_AT_RAW;
                        COMPLETION_NOTIFICATION_DATE = txtRegisterCompleteNotificationDate.Text.Trim();
                        Dialog = DialogResult.OK;
                        this.BringToFront();
                    }
                    btnPreview.Enabled = true;
                    #endregion
                }
                catch (Exception ex)
                {
                    Utility.WriteErrorLog(ex.Message, ex, false);
                }
            }
        }
예제 #17
0
        private void SaveProcess()
        {
            if (string.IsNullOrEmpty(mode))
            {
                MetroMessageBox.Show(this, "신규버튼을 누르고 데이터를 저장하십시오", "경고",
                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            using (SqlConnection conn = new SqlConnection(Commons.CONNSTRING))
            { // using 괄호가 없어서 오류
                conn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = conn;
                string strQuery = "";

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

                SqlParameter parmAuthor = new SqlParameter("@Author", SqlDbType.VarChar, 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();
            }
        }
예제 #18
0
        //입력(수정)처리 프로세스
        private void SaveData()
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(BookRentalShopApp.Helper.Common.ConnString))
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }

                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = conn;

                    var query = "";

                    if (isNew == true) //insert
                    {
                        query = @"INSERT INTO [dbo].[rentaltbl]
                                             ([memberIdx]
                                             ,[bookIdx]
                                             ,[rentalDate]
                                             ,[rentalState])
                                       VALUES
                                             (@memberIdx
                                             ,@bookIdx
                                             ,@rentalDate
                                             ,@rentalState)";
                    }
                    else //update
                    {
                        query = @"UPDATE [dbo].[rentaltbl]
                                       SET [returnDate] = case @rentalState
                                                          when 'T' then GETDATE()
                                                          When 'R' then  null end
                                          ,[rentalState] = @rentalState
                                     WHERE Idx = @Idx";
                    }
                    cmd.CommandText = query;

                    if (isNew == true) // 신규
                    {
                        var pMemberIdx = new SqlParameter("@memberIdx", SqlDbType.Int);
                        pMemberIdx.Value = selMemberIdx;
                        cmd.Parameters.Add(pMemberIdx);

                        var pBookIdx = new SqlParameter("@bookIdx", SqlDbType.Int);
                        pBookIdx.Value = selBookIdx;
                        cmd.Parameters.Add(pBookIdx);

                        var pRentalDate = new SqlParameter("@rentalDate", SqlDbType.Date);
                        pRentalDate.Value = DtpRentaldate.Value;
                        cmd.Parameters.Add(pRentalDate);

                        var pRentalState = new SqlParameter("@rentalState", SqlDbType.Char, 1);
                        pRentalState.Value = CboRentalState.SelectedValue;
                        cmd.Parameters.Add(pRentalState);
                    }
                    else // 업데이트일땐
                    {
                        var pRentalState = new SqlParameter("@rentalState", SqlDbType.Char, 1);
                        pRentalState.Value = CboRentalState.SelectedValue;
                        cmd.Parameters.Add(pRentalState);

                        var pIdx = new SqlParameter("@Idx", SqlDbType.Int);
                        pIdx.Value = TxtIdx.Text;
                        cmd.Parameters.Add(pIdx);
                    }

                    var result = cmd.ExecuteNonQuery();
                    if (result == 1)
                    {
                        MetroMessageBox.Show(this, "저장 성공", "저장",
                                             MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "저장 실패", "저장",
                                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, $"예외발생 : {ex.Message}", "오류",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #19
0
        private void SaveData()
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(Helper.Common.ConnString))
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = conn;

                    var query = "";

                    if (isNew == true) // INSERT
                    {
                        query = @"INSERT INTO [dbo].[membertbl]
                                           ([Names]
                                           ,[Levels]
                                           ,[Addr]
                                           ,[Mobile]
                                           ,[Email]
                                           ,[userID]
                                           ,[passwords])
                                     VALUES
                                           (@Names
                                           ,@Levels
                                           ,@Addr
                                           ,@Mobile
                                           ,@Email
                                           ,@userID
                                           ,@passwords) ";
                    }
                    else // UPDATE
                    {
                        query = @"UPDATE [dbo].[membertbl]
                                       SET [Names] = @Names
                                          ,[Levels] = @Levels
                                          ,[Addr] = @Addr
                                          ,[Mobile] = @Mobile
                                          ,[Email] = @Email
                                          ,[userID] = @userID
                                          ,[passwords] = @passwords
                                     WHERE Idx = @Idx ";
                    }
                    cmd.CommandText = query;

                    SqlParameter pNames = new SqlParameter("@Names", SqlDbType.NVarChar, 50);
                    pNames.Value = TxtNames.Text;
                    cmd.Parameters.Add(pNames);

                    SqlParameter pLevels = new SqlParameter("@Levels", SqlDbType.Char, 1);
                    pLevels.Value = CboLevels.SelectedItem.ToString();
                    cmd.Parameters.Add(pLevels);

                    SqlParameter pAddr = new SqlParameter("@Addr", SqlDbType.NVarChar, 100);
                    pAddr.Value = TxtAddr.Text;
                    cmd.Parameters.Add(pAddr);

                    SqlParameter pMobile = new SqlParameter("@Mobile", SqlDbType.VarChar, 13);
                    pMobile.Value = TxtMobile.Text;
                    cmd.Parameters.Add(pMobile);

                    SqlParameter pEmail = new SqlParameter("@Email", SqlDbType.VarChar, 50);
                    pEmail.Value = TxtEmail.Text;
                    cmd.Parameters.Add(pEmail);

                    SqlParameter puserID = new SqlParameter("@userID", SqlDbType.VarChar, 20);
                    puserID.Value = TxtUserId.Text;
                    cmd.Parameters.Add(puserID);

                    SqlParameter ppasswords = new SqlParameter("@passwords", SqlDbType.VarChar, 100);
                    ppasswords.Value = TxtPasswords.Text;
                    cmd.Parameters.Add(ppasswords);

                    if (isNew == false)
                    {
                        SqlParameter pIdx = new SqlParameter("@Idx", SqlDbType.Int);
                        pIdx.Value = TxtIdx.Text;
                        cmd.Parameters.Add(pIdx);
                    }

                    var result = cmd.ExecuteNonQuery();
                    if (result == 1)
                    {
                        MetroMessageBox.Show(this, "저장 성공", "저장",
                                             MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "저장 실패", "저장",
                                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, $"예외발생 : {ex.Message}", "오류", MessageBoxButtons.OK,
                                     MessageBoxIcon.Error);
            }
        }
        private void btnInjectImage_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _blf = new PureBLF(_blfLocation);
                var ofd = new OpenFileDialog
                {
                    Title  = "Open an image to be injected",
                    Filter = "JPEG Image (*.jpg,*.jpeg,)|*.jpg;*.jpeg|PNG Image [H3/ODST]|*.png|BMP Image [H3/ODST]|*.bmp"
                };

                if (!((bool)ofd.ShowDialog()))
                {
                    Close();
                    return;
                }
                byte[] newImage = File.ReadAllBytes(ofd.FileName);
                var    stream   = new EndianStream(new MemoryStream(newImage), Endian.BigEndian);

                // Check if it's a supported image
                stream.SeekTo(0x0);
                ushort imageMagic = stream.ReadUInt16();
                if (imageMagic != 0xFFD8 && imageMagic != 0x8950 && imageMagic != 0x424D)
                {
                    throw new Exception("Invalid image type. Only JPEG, PNG, and BMP are supported.");
                }

                // Check for size and dimension differences
                var imageSize = new FileInfo(ofd.FileName).Length;
                var image     = new BitmapImage();
                image.BeginInit();
                image.StreamSource = new MemoryStream(newImage);
                image.EndInit();
                string sizeMessage      = "";
                string dimensionMessage = "";

                if (new FileInfo(ofd.FileName).Length >= 0x1C000)
                {
                    sizeMessage = String.Format("- The size of the new image (0x{0}) exceeds Halo 3/ODST's modified limit of 0x1C000. This image will not display in those games as a result. Can be ignored otherwise.\n",
                                                imageSize.ToString("X"));
                }

                if (image.PixelWidth != ((BitmapImage)imgBLF.Source).PixelWidth ||
                    image.PixelHeight != ((BitmapImage)imgBLF.Source).PixelHeight)
                {
                    dimensionMessage = String.Format("- The dimensions of the new image ({0}x{1}) are not the same as the dimensions of the original image ({2}x{3}). This blf may appear stretched or not appear at all as a result.\n",
                                                     image.PixelWidth, image.PixelHeight, ((BitmapImage)imgBLF.Source).PixelWidth, ((BitmapImage)imgBLF.Source).PixelHeight);
                }

                if (dimensionMessage != "" || sizeMessage != "")
                {
                    if (MetroMessageBox.Show("Warning",
                                             "There were some potential issue(s) found with your new image;\n\n" + String.Format("{0}{1}",
                                                                                                                                 sizeMessage, dimensionMessage) + "\nInject anyway?",
                                             MetroMessageBox.MessageBoxButtons.OkCancel) != MetroMessageBox.MessageBoxResult.OK)
                    {
                        Close();
                        return;
                    }
                }

                // It's the right everything! Let's inject

                var newImageChunkData = new List <byte>();
                newImageChunkData.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00 });
                byte[] imageLength = BitConverter.GetBytes(newImage.Length);
                Array.Reverse(imageLength);
                newImageChunkData.AddRange(imageLength);
                newImageChunkData.AddRange(newImage);

                // Write data to chunk file
                _blf.BLFChunks[1].ChunkData = newImageChunkData.ToArray <byte>();

                _blf.RefreshRelativeChunkData();
                _blf.UpdateChunkTable();

                // Update eof offset value
                var eofstream = new EndianStream(new MemoryStream(_blf.BLFChunks[2].ChunkData), Endian.BigEndian);

                uint eofFixup = (uint)_blf.BLFStream.Length - 0x111;                 //real cheap but hey it works and is always the same in all games

                eofstream.SeekTo(0);
                eofstream.WriteUInt32(eofFixup);

                _blf.RefreshRelativeChunkData();
                _blf.UpdateChunkTable();

                Close();
                MetroMessageBox.Show("Injected!", "The BLF Image has been injected. This image tab will now close.");
                App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose(_tab);
            }
            catch (Exception ex)
            {
                Close();
                MetroMessageBox.Show("Inject Failed!", "The BLF Image failed to be injected: \n " + ex.Message);
            }
        }
예제 #21
0
 private void metroButton12_Click(object sender, EventArgs e)
 {
     MetroMessageBox.Show(this, "This is a sample `default` MetroMessagebox ", "MetroMessagebox");
 }
        private void loadBLF()
        {
            try
            {
                _blf = new PureBLF(_blfLocation);

                var imgChunkData = new List <byte>(_blf.BLFChunks[1].ChunkData);
                imgChunkData.RemoveRange(0, 0x08);

                Dispatcher.Invoke(new Action(delegate
                {
                    var image = new BitmapImage();
                    image.BeginInit();
                    image.StreamSource = new MemoryStream(imgChunkData.ToArray());
                    image.EndInit();

                    imgBLF.Source = image;

                    var stream = new EndianStream(new MemoryStream(imgChunkData.ToArray <byte>()), Endian.BigEndian);
                    stream.SeekTo(0x0);
                    ushort imageMagic = stream.ReadUInt16();

                    switch (imageMagic)
                    {
                    case 0xFFD8:
                        blfImageFormat = "JPEG";
                        break;

                    case 0x8950:
                        blfImageFormat = "PNG";
                        break;

                    case 0x424D:
                        blfImageFormat = "BMP";
                        break;

                    default:
                        blfImageFormat = "Unknown";
                        break;
                    }

                    // Add Image Info
                    paneImageInfo.Children.Insert(0, new MapHeaderEntry("Image Format:", blfImageFormat));
                    paneImageInfo.Children.Insert(1, new MapHeaderEntry("Image Width:", image.PixelWidth + "px"));
                    paneImageInfo.Children.Insert(2, new MapHeaderEntry("Image Height", image.PixelHeight + "px"));

                    // Add BLF Info
                    paneBLFInfo.Children.Insert(0, new MapHeaderEntry("BLF Length:", "0x" + _blf.BLFStream.Length.ToString("X")));
                    paneBLFInfo.Children.Insert(1,
                                                new MapHeaderEntry("BLF Chunks:", _blf.BLFChunks.Count.ToString(CultureInfo.InvariantCulture)));

                    if (App.AssemblyStorage.AssemblySettings.StartpageHideOnLaunch)
                    {
                        App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose(Home.TabGenre.StartPage);
                    }

                    RecentFiles.AddNewEntry(new FileInfo(_blfLocation).Name, _blfLocation, "BLF Image", Settings.RecentFileType.Blf);
                    Close();
                }));
            }
            catch (Exception ex)
            {
                Close();
                Dispatcher.Invoke(new Action(delegate
                {
                    MetroMessageBox.Show("Unable to open BLF", ex.Message.ToString(CultureInfo.InvariantCulture));
                    App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose((LayoutDocument)Parent);
                }));
            }
        }
예제 #23
0
        private void DatosMetroGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                DataGridViewRow r     = DatosMetroGrid.SelectedRows[0];
                Marca           marca = (Marca)r.Tag;
                DialogResult    dr    = MetroMessageBox.Show(this, $"¿Desea dar de baja a la marca {marca.Nombre}?",
                                                             "Confirmar Baja",
                                                             MessageBoxButtons.YesNo,
                                                             MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    try
                    {
                        servicio.Borrar(marca.MarcaId);
                        DatosMetroGrid.Rows.Remove(r);
                        MetroMessageBox.Show(this, "Registro borrado", "Mensaje",
                                             MessageBoxButtons.OK,
                                             MessageBoxIcon.Information);
                    }
                    catch (Exception exception)
                    {
                        MetroMessageBox.Show(this, exception.Message, "Error",
                                             MessageBoxButtons.OK,
                                             MessageBoxIcon.Error);
                    }
                }
            }
            if (e.ColumnIndex == 2)
            {
                DataGridViewRow r        = DatosMetroGrid.SelectedRows[0];
                MarcaDto        marcaDto = (MarcaDto)r.Tag;
                //MarcaDto marcaAux =(Marca) marca.Clone();
                MarcasAEForm frm = new MarcasAEForm();
                frm.Text = "Editar Marca";
                frm.SetMarca(marcaDto);
                DialogResult dr = frm.ShowDialog(this);
                if (dr == DialogResult.OK)
                {
                    try
                    {
                        marcaDto = frm.GetMarca();

                        if (!servicio.Existe(marcaDto))
                        {
                            servicio.Editar(marcaDto);
                            SetearFila(r, marcaDto);
                            MetroMessageBox.Show(this, "Registro Editado", "Mensaje",
                                                 MessageBoxButtons.OK,
                                                 MessageBoxIcon.Information);
                        }
                        else
                        {
                            MetroMessageBox.Show(this, "Marca repetida", "Error",
                                                 MessageBoxButtons.OK,
                                                 MessageBoxIcon.Error);
                            //SetearFila(r,marcaAux);
                            LoadRegistros();
                        }
                    }
                    catch (Exception exception)
                    {
                        MetroMessageBox.Show(this, exception.Message, "Error",
                                             MessageBoxButtons.OK,
                                             MessageBoxIcon.Error);
                    }
                }
            }
        }
예제 #24
0
        private void retrieveDotaDir()
        {
            // start process of retrieving dota dir
            dotaDir = Settings.Default.DotaDir;

            if (Settings.Default.DotaDir == "")
            {
                // this is first run of application

                // try to auto-get the dir
                dotaDir = Util.getDotaDir();

                DialogResult dr = DialogResult.No;
                if (dotaDir != "")
                {
                    // first run of modkit on this computer.
                    dr = MetroMessageBox.Show(this,
                                              "Dota directory has been set to: " + dotaDir + ". Is this correct?",
                                              "Dota Directory",
                                              MessageBoxButtons.YesNo,
                                              MessageBoxIcon.Information);
                }

                if (dr == DialogResult.No)
                {
                    FolderBrowserDialog fbd = new FolderBrowserDialog();
                    fbd.Description = "Dota 2 directory (i.e. 'dota 2 beta')";
                    var dr2 = fbd.ShowDialog();

                    if (dr2 != DialogResult.OK)
                    {
                        MetroMessageBox.Show(this, "No folder selected. Exiting.",
                                             "Error",
                                             MessageBoxButtons.OK,
                                             MessageBoxIcon.Error);

                        Environment.Exit(0);
                    }
                    string p = fbd.SelectedPath;
                    dotaDir = p;
                }
            }

            // ModKit must ran in the same drive as the dota dir.
            if (!Util.hasSameDrives(Environment.CurrentDirectory, dotaDir))
            {
                MetroMessageBox.Show(this, "Dota 2 ModKit must be ran from the same drive as Dota 2 or else errors " +
                                     "will occur. Please move Dota 2 ModKit to the '" + dotaDir[0] + "' Drive and create a shortcut to it. Exiting.",
                                     "Error",
                                     MessageBoxButtons.OK,
                                     MessageBoxIcon.Error);

                Environment.Exit(0);
            }

            // trying to read vpk practice. this works currently

            /*
             * string s2vpkPath = Path.Combine(dotaDir, "game", "dota_imported", "pak01_dir.vpk");
             * using (var vpk = new VpkFile(s2vpkPath)) {
             *      vpk.Open();
             *      Debug.WriteLine("Got VPK version {0}", vpk.Version);
             *      VpkNode node = vpk.GetFile("scripts/npc/npc_units.txt");
             *      using (var inputStream = VPKUtil.GetInputStream(s2vpkPath, node)) {
             *              var pathPieces = node.FilePath.Split('/');
             *              var directory = pathPieces.Take(pathPieces.Count() - 1);
             *              var fileName = pathPieces.Last();
             *
             *              //EnsureDirectoryExists(Path.Combine(directory.ToArray()));
             *
             *              using (var fsout = File.OpenWrite(Path.Combine(Environment.CurrentDirectory, "something.txt"))) {
             *                      var buffer = new byte[1024];
             *                      int amtToRead = (int)node.EntryLength;
             *                      int read;
             *
             *                      while ((read = inputStream.Read(buffer, 0, buffer.Length)) > 0 && amtToRead > 0) {
             *                              fsout.Write(buffer, 0, Math.Min(amtToRead, read));
             *                              amtToRead -= read;
             *                      }
             *              }
             *      }
             * }*/
        }
예제 #25
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            String s = metroComboBox1.SelectedItem.ToString();

            MySqlConnection con1 = new MySqlConnection("SERVER=localhost;DATABASE=sales;UID=root;PASSWORD=smhs;");
            String          q1   = "Select * from invent where id='" + s + "';";
            MySqlCommand    cmd1 = new MySqlCommand(q1, con1);
            MySqlDataReader dataReader1;

            con1.Open();
            dataReader1 = cmd1.ExecuteReader();
            if (dataReader1.Read())
            {
                String re = metroLabel2.Text.ToString();
                if (re == "edit")
                {
                    EditStock e1 = new EditStock();
                    e1.metroLabel13.Text = s;
                    e1.Visible           = true;
                    Close();
                }
                else if (re == "Search")
                {
                    Transaction t = new Transaction();
                    t.Text = "PAYMENT HISTORY";
                    t.Show();
                    t.metroButton1.PerformClick();
                    t.metroComboBox1.SelectedItem = "Unique ID";
                    t.metroTextBox1.Text          = s;
                    t.metroButton3.PerformClick();
                    //t.metroButton2.PerformClick();
                    //this.Dispose();
                    Application.OpenForms["Mbox_Search"].Dispose();
                    Application.OpenForms["Home"].BringToFront();
                    Application.OpenForms["Transaction"].BringToFront();
                }
                else if (re == "delete")
                {
                    DialogResult d = new DialogResult();
                    d = MetroMessageBox.Show(this, "\n\nAre Your Sure you want to delete this Entry?\nEntry Once deleted cant be recovered Back..", "WARNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (d == DialogResult.OK)
                    {
                        MySqlConnection con = new MySqlConnection("SERVER=localhost;DATABASE=Sales;UID=root;PASSWORD=smhs;");
                        con.Open();
                        MySqlCommand    cmd  = new MySqlCommand("Select id, status, bid, netamt from invent,sell where id='" + s + "' and id=sell.specs;", con);
                        MySqlDataReader dr1  = cmd.ExecuteReader();
                        double          amt  = 0;
                        int             bid  = 0;
                        String          stat = "";
                        while (dr1.Read())
                        {
                            stat = dr1.GetValue(1).ToString();
                            amt  = Convert.ToDouble(dr1.GetValue(3));
                            bid  = Convert.ToInt32(dr1.GetValue(2));
                        }
                        dr1.Close();
                        double sum = 0;
                        cmd.CommandText = "Select Sum(amt) from history where pid='" + s + "';";
                        dr1             = cmd.ExecuteReader();
                        while (dr1.Read())
                        {
                            String s1 = Convert.ToString(dr1.GetValue(0));
                            if (s1.Length > 0)
                            {
                                sum = sum + Convert.ToDouble(s1);
                            }
                        }
                        dr1.Close();
                        cmd.CommandText = "DELETE from history where pid='" + s + "';";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "UPDATE buyer set Total=Total-" + amt + ", Deposited=Deposited-" + sum + " where Buyid=" + bid + ";";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "UPDATE Seller set Total=Total-" + amt + ", Deposited=Deposited-" + sum + " where Selid=10001;";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "DELETE from sell where specs='" + s + "';";
                        int result = cmd.ExecuteNonQuery();
                        cmd.CommandText = "DELETE from invent where id='" + s + "';";
                        result          = cmd.ExecuteNonQuery();

                        if (result > 0)
                        {
                            MetroMessageBox.Show(this, "\n\nEntry Deleted Successfully", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Question);
                        }
                    }
                }
                else if (re == "balance")
                {
                }
            }
            else
            {
                DialogResult d = new DialogResult();
                d = MetroMessageBox.Show(this, "STOCK NOT FOUND!! Please Re-Enter a Valid Stock-Code to proceed Further..", "INVALID STOCK CODE", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);
                if (d.ToString() == "Retry")
                {
                    Application.OpenForms["Home"].BringToFront();
                    Application.OpenForms["Mbox_Search"].BringToFront();
                    //metroTextBox1.Select();
                }
                else
                {
                    Close();
                    Application.OpenForms["Home"].BringToFront();
                }
            }
        }
예제 #26
0
        public MainForm()
        {
            // bring up the UI
            InitializeComponent();

            Localizer localizer = new Localizer(this);

            localizer.localize();

            //Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("cn-CN");
            Console.WriteLine(strings.Hello);

            setupMainFormHooks();

            // check for updates
            updater = new Updater(this);
            updater.checkForUpdates();

            // init mainform controls stuff
            initControls();

            // get the dota dir
            retrieveDotaDir();

            // *** at this point assume valid dota dir. ***

            // save the dota dir
            Settings.Default.DotaDir = dotaDir;

            Debug.WriteLine("Directory: " + dotaDir);

            // get the master 'game' and 'content' paths.
            gamePath    = Path.Combine(dotaDir, "game", "dota_addons");
            contentPath = Path.Combine(dotaDir, "content", "dota_addons");

            // create these dirs if they don't exist.
            if (!Directory.Exists(gamePath))
            {
                Directory.CreateDirectory(gamePath);
            }
            if (!Directory.Exists(contentPath))
            {
                Directory.CreateDirectory(contentPath);
            }

            // get all the addons in the 'game' dir.
            addons = getAddons();

            // does this computer have any dota addons?
            if (addons.Count == 0)
            {
                MetroMessageBox.Show(this, strings.NoDota2AddonsDetectedMsg,
                                     strings.NoDota2AddonsDetectedCaption,
                                     MessageBoxButtons.OK,
                                     MessageBoxIcon.Error);
                Environment.Exit(0);
            }

            // setup custom tiles
            setupCustomTiles();

            // some functions in the Tick try and use mainform's controls on another thread. so we need to allot a very small amount of time for
            // mainform to init its controls. this is mainly for the very first run of modkit.
            Timer initTimer = new Timer();

            initTimer.Interval = 100;
            initTimer.Tick    += (s, e) => {
                // run it once
                Timer t = (Timer)s;
                t.Stop();

                // clone a barebones repo if we don't have one, pull if we do
                updater.clonePullBarebones();

                // deserialize settings
                deserializeSettings();

                // auto-retrieve the workshop IDs for published addons if there are any.
                getWorkshopIDs();

                // set currAddon to the addon that was last opened in last run of modkit.
                if (Settings.Default.LastAddon != "")
                {
                    Addon a = getAddonFromName(Settings.Default.LastAddon);
                    if (a != null)
                    {
                        changeCurrAddon(a);
                    }
                }

                // basically, if this is first run of modkit, set the currAddon to w/e the default addon is in the workshop tools.
                if (currAddon == null)
                {
                    changeCurrAddon(addons[getDefaultAddonName()]);
                }

                // init our features of Modkit
                initFeatures();
            };
            initTimer.Start();
        }
예제 #27
0
 private void metroButton10_Click(object sender, EventArgs e)
 {
     MetroMessageBox.Show(this, "This is a sample MetroMessagebox `OK` and `Cancel` button", "MetroMessagebox", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
 }
예제 #28
0
        private void SaveProcess()
        {
            if (String.IsNullOrEmpty(mode))
            {
                MetroMessageBox.Show(this, "신규버튼을 누르고 데이터를 저장하십시오.", "경고",
                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //DB저장프로세스
            using (SqlConnection conn = new SqlConnection(Commons.CONNSTRING))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = conn;
                string strQuery = "";

                if (mode == "UPDATE")
                {
                    strQuery = "UPDATE dbo.membertbl " +
                               " SET Names = @Names, " +
                               " Levels = @Levels, " +
                               " Addr = @Addr, " +
                               " Mobile = @Mobile, " +
                               " Email = @Email " +
                               " WHERE Idx = @Idx ";
                }
                else if (mode == "INSERT")
                {
                    //throw new NotImplementedException(); // 아직 구현 안 됬을 때 에러 발생
                    strQuery = "INSERT INTO dbo.membertbl (Names, Levels, Addr, Mobile, Email) " +
                               " VALUES (@Names, @Levels, @Addr, @Mobile, @Email) ";
                }
                cmd.CommandText = strQuery;

                if (mode == "Update")
                {
                    // TxtIdx 설정
                    SqlParameter pramIdx = new SqlParameter("@Idx", System.Data.SqlDbType.Int);//Idx 속성 글자타입을 Int, 길이를 Null이 아님으로 지정했음
                    pramIdx.Value = TxtIdx.Text;
                    cmd.Parameters.Add(pramIdx);
                }

                // TxtNames 설정
                SqlParameter pramNames = new SqlParameter("@Names", System.Data.SqlDbType.NVarChar, 45);    //Names 속성 글자타입을 NVarChar, 길이를 45로 지정했음
                pramNames.Value = TxtNames.Text;
                cmd.Parameters.Add(pramNames);

                //CboLevels 설정
                SqlParameter parmLevels = new SqlParameter("@Levels", System.Data.SqlDbType.Char, 1);    //Levels 속성 글자타입을 Char, 길이를 1로 지정했음
                parmLevels.Value = CboLevels.SelectedItem;
                cmd.Parameters.Add(parmLevels);

                // TxtAddr 설정
                SqlParameter pramAddr = new SqlParameter("@Addr", System.Data.SqlDbType.VarChar, 100);    //Address 속성 글자타입을 VarChar, 길이를 100로 지정했음
                pramAddr.Value = TxtAddr.Text;
                cmd.Parameters.Add(pramAddr);

                // TxtMobile 설정
                SqlParameter pramMobile = new SqlParameter("@Mobile", System.Data.SqlDbType.VarChar, 13);    //Mobile 속성 글자타입을 VarChar, 길이를 13로 지정했음
                pramMobile.Value = TxtMobile.Text;
                cmd.Parameters.Add(pramMobile);

                // TxtEmail 설정
                SqlParameter pramEmail = new SqlParameter("@Email", System.Data.SqlDbType.VarChar, 50);    //Email 속성 글자타입을 VarChar, 길이를 50로 지정했음
                pramEmail.Value = TxtEmail.Text;
                cmd.Parameters.Add(pramEmail);



                cmd.ExecuteNonQuery();  //쿼리문을 실행 시켜주기 위해서, NonQuery를 사용하는것은 값을 돌려받지 않기 위해서
            }
        }
예제 #29
0
 private void metroButton11_Click(object sender, EventArgs e)
 {
     MetroMessageBox.Show(this, "This is a sample MetroMessagebox `Retry` and `Cancel` button.  With warning style.", "MetroMessagebox", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
 }
예제 #30
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            string   date1 = metroTextBox1.Text;
            String   dau   = date1.Replace('-', '/');
            DateTime dvs   = Convert.ToDateTime(dau);



            double result1 = 0;
            String tx      = metroTextBox2.PromptText;
            int    leo     = tx.IndexOf(".");
            double prnum   = Convert.ToDouble(tx.Substring(leo + 1));

            if (metroTextBox2.Text.ToString().Length > 0 && Double.TryParse(metroTextBox2.Text.ToString(), out result1) && Convert.ToDouble(metroTextBox2.Text) <= prnum)
            {
                double          re  = Convert.ToDouble(metroTextBox2.Text.ToString());
                MySqlConnection con = new MySqlConnection("SERVER=localhost;DATABASE=Sales;UID=root;PASSWORD=smhs;");
                con.Open();
                MySqlCommand    cmd = new MySqlCommand("Select bid from sell where specs='" + metroComboBox1.SelectedItem.ToString() + "';", con);
                MySqlDataReader dataReader1;
                dataReader1 = cmd.ExecuteReader();

                int bid = 0;

                while (dataReader1.Read())
                {
                    bid = Convert.ToInt32(dataReader1.GetValue(0));
                }
                dataReader1.Close();

                cmd.CommandText = "update Buyer set Deposited=Deposited+" + re + " where Buyid=" + bid + ";";

                int result = 0;
                result = cmd.ExecuteNonQuery();

                cmd.CommandText = "update Seller set Deposited=Deposited+" + re + " where Selid=10001;";
                result          = cmd.ExecuteNonQuery();

                if (result > 0)
                {
                    MySqlConnection con1 = new MySqlConnection("SERVER=localhost;DATABASE=Sales;UID=root;PASSWORD=smhs;");
                    String          q1   = "Insert into History(pid,dater,amt,bid) values(@a,@b,@c,@d);";
                    MySqlCommand    cmd1 = new MySqlCommand(q1, con1);
                    cmd1.Parameters.AddWithValue("@a", metroComboBox1.SelectedItem.ToString().Trim());
                    cmd1.Parameters.AddWithValue("@b", dvs);
                    cmd1.Parameters.AddWithValue("@c", re);
                    cmd1.Parameters.AddWithValue("@d", bid);

                    con1.Open();
                    cmd1.ExecuteNonQuery();


                    cmd1.CommandText = "update sell set date_clear=@davs where specs='" + metroComboBox1.SelectedItem.ToString() + "' and netAmt=(Select Sum(amt) from history where pid='" + metroComboBox1.SelectedItem.ToString() + "' group by pid);";
                    cmd1.Parameters.AddWithValue("@davs", dvs);
                    cmd1.ExecuteNonQuery();
                    MetroMessageBox.Show(this, ("\n\nData Updated successfully!"), "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MetroMessageBox.Show(this, "\n\nPlease Check All the Details and Try Again.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                con.Close();
                Close();
                Application.OpenForms["Home"].BringToFront();
            }
            else
            {
                MetroMessageBox.Show(this, "\n\nPlease Insert Proper info First to Proceed Further..", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.OpenForms["Home"].BringToFront();
                Application.OpenForms["Cash_Depo"].BringToFront();
                metroTextBox2.Text = "";
                metroTextBox2.Select();
            }
        }