/// <summary> /// البحث في قاعدة البيانات عن طريق ID /// </summary> /// public static async void WaitSqlDowork(int idname, DevComponents.DotNetBar.Controls.ProgressBarX ProgressBarX1, List <Vitl> VitlList) { SqlConnection SqlConnection1 = new SqlConnection(); SqlConnection1.ConnectionString = sqlconction; await SqlConnection1.OpenAsync(); ProgressBarX1.Value = 50; SqlCommand sqlcom1 = new SqlCommand("select id, first_name + Last_name AS Fullname , natiol_id from Information_Ta", SqlConnection1); IAsyncResult result = sqlcom1.BeginExecuteReader(); SqlDataReader reader = sqlcom1.EndExecuteReader(result); try { while (await reader.ReadAsync()) { int id = Convert.ToInt32(reader.GetValue(0)); string Fullname = Convert.ToString(reader.GetValue(1)); Int64 idnationl = ClassConvert.Convint64(reader.GetValue(2)); } } catch { MessageBox.Show("Error"); } finally { reader.Close(); } }
private void buttonItem2_Click(object sender, EventArgs e) { for (int n = 0; dataGridViewX1.Rows.Count - 1 > 0; n++) { #region Adder int id = 0; string first_name = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[1].Value); string Last_name = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[2].Value); string Father_name = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[3].Value); string Mather_name = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[4].Value); Int64 natiol_id = ClassConvert.Convint64(dataGridViewX1.Rows[n].Cells[8].Value); bool Gender = ClassConvert.ConvBool(dataGridViewX1.Rows[n].Cells[5].Value); string where_birth = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[6].Value); DateTime data_barthday = ClassConvert.ConvDateTime(dataGridViewX1.Rows[n].Cells[7].Value); string e_mail = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[18].Value); int Phone_Ground = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[20].Value); int Phone_Mobile1 = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[19].Value); string study = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[9].Value); int yearstudy = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[10].Value); int Id_course = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[0].Value); string Id_course_Ware = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[21].Value); DateTime data_regs = ClassConvert.ConvDateTime(dataGridViewX1.Rows[n].Cells[17].Value); int bitd_id = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[11].Value); string nameEnglish = ClassConvert.ConvString(dataGridViewX1.Rows[n].Cells[12].Value); int Z1 = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[13].Value); int z2 = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[14].Value); int z3 = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[15].Value); string Hanei_whare = ""; string Hanei_whare1 = ""; string adderas = ""; int Stutes_Jtma3 = ClassConvert.Convint(dataGridViewX1.Rows[n].Cells[16].Value); int Phone_Mobile2 = 0; string Facebook = ""; int whatsApp = 0; int viper = 0; string Twiter = ""; System.Drawing.Image Image_id_nationl1 = null; System.Drawing.Image Image_id_nationl2 = null; System.Drawing.Image image = null; System.Drawing.Image Image_font = null; string Nkname = ""; System.Xml.XmlDataDocument XmlHobbies = null;; /* * string[] liststring = System.IO.Directory.GetFiles(".\\", "Hobbis1.xml", System.IO.SearchOption.AllDirectories); * XmlHobbies.Load(liststring[0]);*/ #endregion Vitl vitltemp = new Vitl(id, first_name, Last_name, Father_name, Mather_name, natiol_id, Gender, where_birth, data_barthday, Hanei_whare, Hanei_whare1, adderas, e_mail, Stutes_Jtma3, Phone_Ground, Phone_Mobile1, Phone_Mobile2, Facebook, Twiter, whatsApp, viper, study, yearstudy, Id_course, Id_course_Ware, data_regs, Image_id_nationl1, Image_id_nationl2, image, Image_font, bitd_id, Nkname, nameEnglish, Z1, z2, z3, XmlHobbies); Sqldatabasethrding.SqlSaveVitl(vitltemp.adder()); } }
private void buttonX3_Click_1(object sender, EventArgs e) { if (!dataGridViewX1.Columns.Contains("موجودأم لا")) { dataGridViewX1.Columns.Add("موجودأم لا", "موجودأم لا"); } for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) { progressBarX1.BeginInvoke(new Prosser(NewProsserVaul), i); if (ClassConvert.Convint64(dataGridViewX1.Rows[i].Cells[listStringNkname2[4]].Value) > 0) { if (Vitl.GetIf(ClassConvert.Convint64(dataGridViewX1.Rows[i].Cells[listStringNkname2[4]].Value))) { dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = "غير موجود رقم وطني"; goto end; } else { dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = "موجود رقم وطني"; goto end; } } if (Convert.ToString(dataGridViewX1.Rows[i].Cells[listStringNkname2[11]].Value) != "") { if (Vitl.GetIfEmail(Convert.ToString(dataGridViewX1.Rows[i].Cells[listStringNkname2[11]].Value))) { dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = "غير موجود Email"; goto end; } else { dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = " موجود Email"; goto end; } } if (ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname2[14]].Value) != 0) { if (Vitl.GetIfmobilephon(ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname2[11]].Value))) { dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = " غير موجود رقم هاتف"; goto end; } else { dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = "موجود رقم هاتف"; goto end; } } dataGridViewX1.Rows[i].Cells["موجودأم لا"].Value = "لا يوجد وسيلة تحقق أبدا"; end :; } }
private void SaveMyVitlNew(int i) { int j = 0; int id = 0; string first_name = dataGridViewX1.Rows[i].Cells[listStringNkname1[j]].Value.ToString(); string Last_name = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string Father_name = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string Mather_name = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); Int64 natiol_id = ClassConvert.Convint64(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); bool? Gender = ClassConvert.ConvBoolMelaFemalNUll(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); string where_birth = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); DateTime data_barthday = ClassConvert.ConvDateTime(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); string Hanei_whare = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string Hanei_whare1 = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string adderas = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string e_mail = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); int Stutes_Jtma3 = ClassConvert.ConvToStatesF(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); int Phone_Ground = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); int Phone_Mobile1 = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); int Phone_Mobile2 = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); string Facebook = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); int whatsApp = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); int viper = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); string Twiter = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string study = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); int yearstudy = ClassConvert.ConvToStady(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value);; int Id_course = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); string Id_course_Ware = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); DateTime data_regs = ClassConvert.ConvDateTime(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); System.Drawing.Image Image_id_nationl1 = null; System.Drawing.Image Image_id_nationl2 = null; System.Drawing.Image image = null; System.Drawing.Image Image_font = null; int bitd_id = ClassConvert.ConvintBoloed(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); string Nkname = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); string nameEnglish = dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value.ToString(); int Z1 = ClassConvert.ConvSizeToint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); int z2 = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); int z3 = ClassConvert.ConvSizeToint(dataGridViewX1.Rows[i].Cells[listStringNkname1[++j]].Value); System.Xml.XmlDataDocument XmlHobbies = null; Vitl vitl1 = new Vitl(id, first_name, Last_name, Father_name, Mather_name, natiol_id, Gender, where_birth, data_barthday, Hanei_whare, Hanei_whare1, adderas, e_mail, Stutes_Jtma3, Phone_Ground, Phone_Mobile1, Phone_Mobile2, Facebook, Twiter, whatsApp, viper, study, yearstudy, Id_course, Id_course_Ware, data_regs, Image_id_nationl1, Image_id_nationl2, image, Image_font, bitd_id, Nkname, nameEnglish, Z1, z2, z3, XmlHobbies); Sqldatabasethrding.SqlSaveAdderAndBack(vitl1); }
private async System.Threading.Tasks.Task SaveNewOrUpdate() { try { if (idvite == 0) { #region تسجيل متطوع جديد #region المتغيرات للكلاس المعلومات الأساسية int id = 0; string first_name = this.first_name.Text; string Last_name = this.Last_name.Text; string Father_name = this.Father_name.Text; string Mather_name = this.Mather_name.Text; Int64 natiol_id = ClassConvert.Convint64(this.natiol_id.Text); bool Gender = ClassConvert.ConvBool(this.Gender.SelectedIndex); string where_birth = this.where_birth.Text; DateTime data_barthday = ClassConvert.ConvDateTime(this.data_barthday.Value); string Hanei_whare = this.Hanei_whare.Text; string Hanei_whare1 = this.Hanei_whare1.Text; string adderas = this.adderas.Text; string e_mail = this.e_mail.Text; int Stutes_Jtma3 = this.Stutes_Jtma3.SelectedIndex; int Phone_Ground = ClassConvert.Convint(this.Phone_Ground.Text); int Phone_Mobile1 = ClassConvert.Convint(this.Phone_Mobile1.Text); int Phone_Mobile2 = ClassConvert.Convint(this.Phone_Mobile2.Text); string Facebook = this.Facebook.Text; int whatsApp = ClassConvert.Convint(this.whatsApp.Text); int viper = ClassConvert.Convint(this.viper.Text); string Twiter = (this.Twiter.Text); string study = this.study.Text; int yearstudy = this.yearstudy.SelectedIndex; int Id_course = ClassConvert.Convint(this.Id_course.Text); string Id_course_Ware = this.Id_course_Ware.Text; DateTime data_regs = ClassConvert.ConvDateTime(this.data_regs.Value); System.Drawing.Image Image_id_nationl1 = ClassConvert.ConvImage(this.Image_id_nationl1.Image); System.Drawing.Image Image_id_nationl2 = ClassConvert.ConvImage(this.Image_id_nationl2.Image); System.Drawing.Image image = ClassConvert.ConvImage(this.image.Image); System.Drawing.Image Image_font = ClassConvert.ConvImage(this.Image_font.Image); int bitd_id = this.bitd_id.SelectedIndex; string Nkname = this.Nkname.Text; string nameEnglish = this.nameEnglish.Text; int Z1 = this.Z1.SelectedIndex; int z2 = ClassConvert.Convint(this.z2.Text); int z3 = this.z3.SelectedIndex; System.Xml.XmlDataDocument XmlHobbies = null; vitl1 = new Vitl(id, first_name, Last_name, Father_name, Mather_name, natiol_id, Gender, where_birth, data_barthday, Hanei_whare, Hanei_whare1, adderas, e_mail, Stutes_Jtma3, Phone_Ground, Phone_Mobile1, Phone_Mobile2, Facebook, Twiter, whatsApp, viper, study, yearstudy, Id_course, Id_course_Ware, data_regs, Image_id_nationl1, Image_id_nationl2, image, Image_font, bitd_id, Nkname, nameEnglish, Z1, z2, z3, XmlHobbies); Sqldatabasethrding.SqlSaveAdderAndBack(vitl1); idvite = vitl1.id;//تاكد من عمل الصحيح للبرنامج #endregion #region إضافة وتعديل الفرق EditTame.CountOfNew = 0; foreach (Team IdInfoAdder in TeamList) { IdInfoAdder.EdidInfoId(idvite); } await Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(TeamList), IntAdderTeam, IntEditTeam, IntDeletTeam); #endregion #region إضافة وتعديل الدورات CoresEditAdder.CountOfNew = 0; foreach (Couress IdInfoAdder in CouressList) { IdInfoAdder.EdidInfoId(idvite); } await Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(CouressList), IntAdderCoress, IntEditCoress, IntDeletCoress); #endregion #endregion } else { #region تعديلات العلومات العامة #region المتغيرات string first_name = this.first_name.Text; string Last_name = this.Last_name.Text; string Father_name = this.Father_name.Text; string Mather_name = this.Mather_name.Text; Int64 natiol_id = ClassConvert.Convint64(this.natiol_id.Text); bool Gender = ClassConvert.ConvBool(this.Gender.SelectedIndex); string where_birth = this.where_birth.Text; DateTime data_barthday = ClassConvert.ConvDateTime(this.data_barthday.Value); string Hanei_whare = this.Hanei_whare.Text; string Hanei_whare1 = this.Hanei_whare1.Text; string adderas = this.adderas.Text; string e_mail = this.e_mail.Text; int Stutes_Jtma3 = this.Stutes_Jtma3.SelectedIndex; int Phone_Ground = ClassConvert.Convint(this.Phone_Ground.Text); int Phone_Mobile1 = ClassConvert.Convint(this.Phone_Mobile1.Text); int Phone_Mobile2 = ClassConvert.Convint(this.Phone_Mobile2.Text); string Facebook = this.Facebook.Text; int whatsApp = ClassConvert.Convint(this.whatsApp.Text); int viper = ClassConvert.Convint(this.viper.Text); string Twiter = (this.Twiter.Text); string study = this.study.Text; int yearstudy = this.yearstudy.SelectedIndex; int Id_course = ClassConvert.Convint(this.Id_course.Text); string Id_course_Ware = this.Id_course_Ware.Text; DateTime data_regs = ClassConvert.ConvDateTime(this.data_regs.Value); System.Drawing.Image Image_id_nationl1 = ClassConvert.ConvImage(this.Image_id_nationl1.Image); System.Drawing.Image Image_id_nationl2 = ClassConvert.ConvImage(this.Image_id_nationl2.Image); System.Drawing.Image image = ClassConvert.ConvImage(this.image.Image); System.Drawing.Image Image_font = ClassConvert.ConvImage(this.Image_font.Image); int bitd_id = this.bitd_id.SelectedIndex; string Nkname = this.Nkname.Text; string nameEnglish = this.nameEnglish.Text; int Z1 = this.Z1.SelectedIndex; int z2 = ClassConvert.Convint(this.z2.Text); int z3 = this.z3.SelectedIndex; System.Xml.XmlDataDocument XmlHobbies = null; #endregion vitl1.UpdateOUtid(first_name, Last_name, Father_name, Mather_name, natiol_id, Gender, where_birth, data_barthday, Hanei_whare, Hanei_whare1, adderas, e_mail, Stutes_Jtma3, Phone_Ground, Phone_Mobile1, Phone_Mobile2, Facebook, Twiter, whatsApp, viper, study, yearstudy, Id_course, Id_course_Ware, data_regs, Image_id_nationl1, Image_id_nationl2, image, Image_font, bitd_id, Nkname, nameEnglish, Z1, z2, z3, XmlHobbies); await Sqldatabasethrding.SqlupdataVitl(vitl1.updata()); #endregion #region إضافة وتعديل الفرق await Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(TeamList), IntAdderTeam, IntEditTeam, IntDeletTeam); #endregion #region إضافة وتعديل الدورات await Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(CouressList), IntAdderCoress, IntEditCoress, IntDeletCoress); #endregion #region إضافة وتعديل وحذف الأستلامات await Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(WereDeliveryList), IntAdderWere, IntEditWere, IntDeletWere); #endregion } /////Loed Team Grid EditTame.CountOfNew = 0; TeamList = await Team.GetByIdVil(idvite); ClassDataGridViewDo.DataGridEnterGridToWorkTeam(dataGridViewX1, TeamList); ////Loed Coures Grid CoresEditAdder.CountOfNew = 0; CouressList = Couress.GetByIdVil(idvite); ClassDataGridViewDo.DataGridEnterGridToWorkCorser(dataGridViewX2, CouressList); #region التقيم ValuationList = Valuation.GetByIdVil(idvite); ClassDataGridViewDo.DataGridEnterGridToWorkValuation(dataGridViewX4, ValuationList); #endregion MegBox.Show("تم التعديل", this); } catch (Exception xv) { MessageBox.Show(xv.ToString()); } }
public static void DataGridViewShow1Show(DevComponents.DotNetBar.Controls.DataGridViewX DataGridViewX1, List <object> objectlist1) { int i = 0; for (int c = 0; DataGridViewX1.Rows.Count > c; c++) { if (Convert.ToInt32(DataGridViewX1.Rows[c].Cells[0].Value) == Convert.ToInt32(objectlist1[0])) { goto end; } } DataGridViewX1.Rows.Add(objectlist1[i].ToString(), objectlist1[++i].ToString(), ClassConvert.Convint64(objectlist1[++i]), objectlist1[++i].ToString(), objectlist1[++i].ToString(), objectlist1[++i].ToString(), objectlist1[++i].ToString(), objectlist1[++i].ToString()); end :; }
private void buttonX2_Click(object sender, EventArgs e) { progressBarX1.Maximum = dataGridViewX1.Rows.Count - 1; buttonX2.Enabled = false; dataGridViewX1.Enabled = false; foreach (DataColumn Column in Dat.Tables[0].Columns) { if (listStringNkname2.IndexOf(Column.ColumnName) != -1) { listStringNkname1.Add(listStringNkname2[listStringNkname2.IndexOf(Column.ColumnName)]); } } MessageBoxEx.Show("الرجاء الإنتظار ...."); // Task.Run(() => { if (!checkBox2.Checked) { for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) { progressBarX1.BeginInvoke(new Prosser(NewProsserVaul), i); if (ClassConvert.Convint64(dataGridViewX1.Rows[i].Cells[listStringNkname2[4]].Value) > 0) { if (Vitl.GetIf(ClassConvert.Convint64(dataGridViewX1.Rows[i].Cells[listStringNkname2[4]].Value))) { SaveMyVitlNew(i); goto end; } else { goto end; } } if (Convert.ToString(dataGridViewX1.Rows[i].Cells[listStringNkname2[11]].Value) != "") { if (Vitl.GetIfEmail(Convert.ToString(dataGridViewX1.Rows[i].Cells[listStringNkname2[11]].Value))) { SaveMyVitlNew(i); goto end; } else { goto end; } } if (ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname2[14]].Value) != 0) { if (Vitl.GetIfmobilephon(ClassConvert.Convint(dataGridViewX1.Rows[i].Cells[listStringNkname2[11]].Value))) { SaveMyVitlNew(i); goto end; } else { goto end; } } SaveMyVitlNew(i); end :; } } else { for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) { SaveMyVitlNew(i); } } // dataGridViewX1.Enabled = true; buttonX2.BeginInvoke(new buttn(Endbuttonx2)); // }); }