Ejemplo n.º 1
0
        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()); }
        }