private void btnApply_Click_1(object sender, EventArgs e)
 {
     try
     {
         //if (txtAlarm.Text == "" || txtName.Text == "" || txtPartId.Text == "" || txtPrice.Text == "")
         //    MessageBox.Show("لطفا موارد خواسته شده را پر نمایید");
         //else
         //{
         var db = new linqDataContext();
         db.EditPart(Convert.ToInt32(txtPartId.Text), txtPartName.Text, Convert.ToInt32(txtPartPrice.Text), Convert.ToInt32(txtPartAlert.Text));
         var gvobj = new MainFrm();
         gvobj.GVTablePart.DataSource = db.ShowParts();
         this.Close();
     }
     catch (System.Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
     }
     //}
 }
Exemple #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'common_DataSet.ownertbl' table. You can move, or remove it, as needed.
            this.ownertblTableAdapter.Fill(this.common_DataSet.ownertbl);
            try
            {
                // TODO: This line of code loads data into the 'common_DataSet.MaxOrderId' table. You can move, or remove it, as needed.
                this.maxOrderIdTableAdapter.Fill(this.common_DataSet.MaxOrderId);
                // TODO: This line of code loads data into the 'common_DataSet.ShowDefectType' table. You can move, or remove it, as needed.
                this.showDefectTypeTableAdapter.Fill(this.common_DataSet.ShowDefectType);



                while (true)
                {
                    LoginFrm obj = new LoginFrm();
                    System.Windows.Forms.DialogResult dr = obj.ShowDialog();
                    if (dr == System.Windows.Forms.DialogResult.Abort)
                    {
                        MessageBox.Show("کاربر مورد نظر معتبر نمیباشد ", "وارد شدن کاربر نامعتبر"
                                        , MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                    }
                    else if (dr == System.Windows.Forms.DialogResult.OK)
                    {
                        obj.Dispose();
                        break;
                    }
                    else if (dr == System.Windows.Forms.DialogResult.Cancel)
                    {
                        Application.Exit();
                        break;
                    }
                    obj.Dispose();
                }
                // TODO: This line of code loads data into the 'common_DataSet.ShowDeviceManufacturer' table. You can move, or remove it, as needed.
                this.showDeviceManufacturerTableAdapter.Fill(this.common_DataSet.ShowDeviceManufacturer);
                // TODO: This line of code loads data into the 'common_DataSet.ShowSrvman' table. You can move, or remove it, as needed.
                this.showSrvmanTableAdapter.Fill(this.common_DataSet.ShowSrvman);


                // TODO: This line of code loads data into the 'common_DataSet.ShowDefectSolution' table. You can move, or remove it, as needed.
                this.showDefectSolutionTableAdapter.Fill(this.common_DataSet.ShowDefectSolution, CBoxDeviceName_for_ShowDefect.Text, CBoxDefectType_for_ShowDefect.Text
                                                         , txtSearchDefect.Text);

                // TODO: This line of code loads data into the 'common_DataSet.ShowOrderMenu' table. You can move, or remove it, as needed.
                this.showOrderMenuTableAdapter.Fill(this.common_DataSet.ShowOrderMenu
                                                    , txtSearchOrderId.Text
                                                    , txtSearchDeviceName.Text
                                                    , txtSearchOwner.Text);

                // TODO: This line of code loads data into the 'common_DataSet.ShowDeviceNames' table. You can move, or remove it, as needed.
                this.showDeviceNamesTableAdapter.Fill(this.common_DataSet.ShowDeviceNames);
                // TODO: This line of code loads data into the 'common_DataSet.ShowDefectType' table. You can move, or remove it, as needed.
                this.showDefectTypeTableAdapter.Fill(this.common_DataSet.ShowDefectType);
                // TODO: This line of code loads data into the 'common_DataSet.ShowSrvman' table. You can move, or remove it, as needed.
                this.showSrvmanTableAdapter.Fill(this.common_DataSet.ShowSrvman);
                # region DataGridview
                //foreach (DataRow row in GVTable)//???????????????????????
                //{
                //    GVTable.Rows[0].Cells[0].
                //}
                //this.txtSelectSrvman.Text="1";
                // DataGridViewCheckBoxColumn GVchekedbox = new DataGridViewCheckBoxColumn();



                //this.رمDataGridViewCheckBoxColumn.DataPropertyName = "رم";
                //this.رمDataGridViewCheckBoxColumn.HeaderText = "رم";
                //this.رمDataGridViewCheckBoxColumn.Name = "رمDataGridViewCheckBoxColumn";
                //this.رمDataGridViewCheckBoxColumn.ReadOnly = true;
                ////
                //// شارژرDataGridViewCheckBoxColumn
                ////
                //this.شارژرDataGridViewCheckBoxColumn.DataPropertyName = "شارژر";
                //this.شارژرDataGridViewCheckBoxColumn.HeaderText = "شارژر";
                //this.شارژرDataGridViewCheckBoxColumn.Name = "شارژرDataGridViewCheckBoxColumn";
                //this.شارژرDataGridViewCheckBoxColumn.ReadOnly = true;
                ////
                //// باطریDataGridViewCheckBoxColumn
                ////
                //this.باطریDataGridViewCheckBoxColumn.DataPropertyName = "باطری";
                //this.باطریDataGridViewCheckBoxColumn.HeaderText = "باطری";
                //this.باطریDataGridViewCheckBoxColumn.Name = "باطریDataGridViewCheckBoxColumn";
                //this.باطریDataGridViewCheckBoxColumn.ReadOnly = true;

                //this.GVTable.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                //                    this.شمارهسفارشDataGridViewTextBoxColumn,
                //                    this.نامگوشیDataGridViewTextBoxColumn,
                //                    this.ناممشتریDataGridViewTextBoxColumn,
                //                    this.رمDataGridViewCheckBoxColumn,
                //                    this.شارژرDataGridViewCheckBoxColumn,
                //                    this.باطریDataGridViewCheckBoxColumn,
                //                    this.تاریخدریافتDataGridViewTextBoxColumn,
                //                    this.تاریختعمیرDataGridViewTextBoxColumn,
                //                    this.پیشپرداختDataGridViewTextBoxColumn,
                //                    this.توضیحاتDataGridViewTextBoxColumn,
                //                    this.نامقطعهDataGridViewTextBoxColumn,
                //                    this.نامتعمیرکارDataGridViewTextBoxColumn,
                //                    this.نختعمیرکارDataGridViewTextBoxColumn});
                #endregion
                var db = new linqDataContext();
                //GVTable.DataSource = db.ShowOrderMenu();///?????????????????

                GVTableSrv1.DataSource = db.ShowDeviceReapairing(Convert.ToInt32(txtSelectSrvman.SelectedValue));
                GVTableSrv2.DataSource = db.ShowDeviceRepaired(Convert.ToInt32(txtSelectSrvman.SelectedValue));
                GVTablePart.DataSource = db.ShowParts();
                this.FormBorderStyle   = FormBorderStyle.FixedDialog;
            }