Ejemplo n.º 1
0
 public static int ConvToStady(object oBject)
 {
     try
     {
         return(Convert.ToInt32(oBject) - 1);
     }
     catch
     {
         try
         {
             if (Convert.ToString(oBject).Trim() == "متخرج")
             {
                 return(6);
             }
             else
             {
                 return(-1);
             }
         }
         catch (Exception e)
         {
             ErrorClass.ErrorClassConvert(e);
             return(-1);
         }
     }
 }
        public static async Task <bool> SqlSaveVitl(SqlCommand Sqlcommand1)
        {
            if (await openConction())
            {
                try
                {
                    Sqlcommand1.Connection = Sqldatabasethrding.SqlConnection1;
                    await Sqlcommand1.ExecuteNonQueryAsync();

                    return(true);
                }

                catch (Exception e)
                {
                    ErrorClass.SaveErrorFile(e);
                    MessageBox.Show(e.ToString());
                    return(false);
                }
            }
            else
            {
                ErrorClass.SaveErrorFile(new Exception("لا يوجد إتصال"));
                MessageBox.Show("لا يوجد إتصال");
                return(false);
            }
        }
        /// <summary>
        ///
        /// </summary>
        public static async Task <List <object> > GetvitlByid(System.Data.SqlClient.SqlCommand SqlCommand1)
        {
            List <object> object1 = new List <object>();

            await openConction();

            SqlCommand1.Connection = Sqldatabasethrding.SqlConnection1;
            SqlDataReader SqlDataReader1 = SqlCommand1.ExecuteReader();

            try
            {
                if (SqlDataReader1.Read())
                {
                    for (int i = 0; i < SqlDataReader1.FieldCount; i++)
                    {
                        object1.Add(SqlDataReader1.GetValue(i));
                    }
                }
            }
            catch (Exception e)
            {
                ErrorClass.SaveErrorFile(e);
            }
            finally
            {
                SqlDataReader1.Close();
            }
            return(object1);
        }
Ejemplo n.º 4
0
        public static async System.Threading.Tasks.Task <int> Serch(string ByIdArchev)
        {
            ByIdArchev = ClassDataGridViewDo.Trimall(ByIdArchev);


            System.Data.SqlClient.SqlCommand Sqlcom = new System.Data.SqlClient.SqlCommand("");


            Sqlcom.CommandText = "SELECT [HR_SARC]. dbo.CV_Info.id , [HR_SARC].dbo.CV_Info.NmuberOfArchev , [HR_SARC]. dbo.CV_Study.Sampl FROM   [HR_SARC].dbo.CV_Info INNER JOIN  [HR_SARC].dbo.CV_Study on [HR_SARC].[dbo].CV_Info.Id_Study =  [HR_SARC].[dbo].CV_Study.id WHERE [HR_SARC].dbo.CV_Study.Sampl + CAST( [HR_SARC].dbo.CV_Info.NmuberOfArchev as nvarchar) like @ByIdArchev ";



            Sqlcom.Parameters.AddWithValue("@ByIdArchev", ByIdArchev);
            List <CV_Info> Ve = new List <CV_Info>();

            List <List <object> > Ob = await Sqldatabasethrding.GetSql(Sqlcom);

            for (int i = 0; i < Ob.Count; i++)
            {
                if (Ob[i].Count != 0)
                {
                    try
                    {
                        return(Convert.ToInt32(Ob[i][0]));
                    }
                    catch (Exception e)
                    {
                        ErrorClass.SaveErrorFile(e);
                    }
                }
            }

            return(-1);
        }
Ejemplo n.º 5
0
 public static int ConvSizeToint(object oBject)
 {
     try
     {
         if (Convert.ToString(oBject).Trim().ToUpper() == "S")
         {
             return(0);
         }
         else if (Convert.ToString(oBject).Trim().ToUpper() == "M")
         {
             return(1);
         }
         else if (Convert.ToString(oBject).Trim().ToUpper() == "L")
         {
             return(2);
         }
         else if (Convert.ToString(oBject).Trim().ToUpper() == "XL")
         {
             return(3);
         }
         else if (Convert.ToString(oBject).Trim().ToUpper() == "XXL")
         {
             return(4);
         }
         else
         {
             return(-1);
         }
     }
     catch (Exception e)
     { ErrorClass.ErrorClassConvert(e);
       return(-1); }
 }
Ejemplo n.º 6
0
        public static async Task <bool> RetHaveVitelACtiv(int ID_informtion)
        {
            System.Data.SqlClient.SqlCommand Sqlcom = new System.Data.SqlClient.SqlCommand("SELECT [Id] FROM [HR_SARC].[dbo].[Team_ta] where [ID_informtion] = @ID_informtion and [Delete] = 0  and Date_End is null");
            Sqlcom.Parameters.AddWithValue("ID_informtion", ID_informtion);

            await Sqldatabasethrding.openConction();

            Sqlcom.Connection = Sqldatabasethrding.SqlConnection1;
            System.Data.SqlClient.SqlDataReader Rader = await Sqlcom.ExecuteReaderAsync();

            try
            {
                while (await Rader.ReadAsync())
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                ErrorClass.SaveErrorFile(e);
            }
            finally
            {
                Rader.Close();
            }

            return(false);
        }
Ejemplo n.º 7
0
 public static int ConvintBoloed(object p)
 {
     try
     {
         return(Convert.ToInt32(p));
     }
     catch
     {
         try
         {
             if (((Convert.ToString(p)).Trim()).ToUpper() == "A+")
             {
                 return(0);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "A-")
             {
                 return(1);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "B-")
             {
                 return(2);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "B+")
             {
                 return(3);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "AB+")
             {
                 return(4);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "AB-")
             {
                 return(5);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "O+")
             {
                 return(6);
             }
             else if (((Convert.ToString(p)).Trim()).ToUpper() == "O-")
             {
                 return(7);
             }
             else
             {
                 return(-1);
             }
         }
         catch (Exception e)
         {
             ErrorClass.ErrorClassConvert(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 8
0
        private async void buttonX3_Click(object sender, EventArgs e)
        {
            try
            {
                dataGridViewX1.Enabled = false;

                ClassDataGridViewDo.ClumChekArray(NameCol, dataGridViewX1);


                int IdTheNameOfcoures = NameTeam.NameTeamStatic[comboBoxEx1.SelectedIndex].id;


                for (int i = 0; i < dataGridViewX1.Rows.Count; i++)
                {
                    int      id           = ClassConvert.Convint(dataGridViewX1.Rows[i].Cells["id"].Value);
                    DateTime?NuberOfDayes = ClassConvert.ConvDateTimeNull(dataGridViewX1.Rows[i].Cells["تاريخ تكليفه بالعمل"].Value);

                    //أختبار هل الدورة مسجل عند الشخص + أنه تأكد من وجود ID


                    if (id > 0)
                    {
                        Team CouresNew = new Team(0, NuberOfDayes, null, id, IdTheNameOfcoures, 1, 1);

                        if (await Sqldatabasethrding.SqlSaveVitl(CouresNew.adder()))
                        {
                            dataGridViewX1.Rows[i].DefaultCellStyle.BackColor = Color.Green;
                        }
                        else
                        {
                            dataGridViewX1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        dataGridViewX1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                    }
                }
            }
            catch (NoColumnsException ex)
            {
                ErrorClass.SaveErrorFile(ex);
                MessageBox.Show(string.Format(" لا يوجد عامود {0} ", ex.Message));
            }
            catch (Exception ex)
            {
                ErrorClass.SaveErrorFile(ex);
            }

            buttonX3.Enabled = true;

            dataGridViewX1.Enabled = true;
        }
 public AssingDateGetWebSite()
 {
     InitializeComponent();
     try
     {
         DownloadDataFromWebCliend.LoginSet("m5524512", "m5524512");
     }
     catch (Exception e)
     {
         ErrorClass.SaveErrorFile(e, true);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// تحويل إلى قمية صحيح
        /// </summary>
        /// <param name="oBject">متغير رقم صحيح</param>
        /// <returns>رقم بدون فواصل</returns>
        public static int?ConvintNull(object oBject)
        {
            int?Int1 = null;

            try
            {
                Int1 = Convert.ToInt32(oBject);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(Int1);
        }
Ejemplo n.º 11
0
        public static float ConvFloat(object oBject)
        {
            float Int1 = 0;

            try
            {
                Int1 = Convert.ToSingle(oBject);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(Int1);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// تحويل إلى bit
        /// </summary>
        /// <param name="oBject">قيمة 1 أو 0</param>
        /// <returns>منطقي</returns>
        public static bool ConvBool(object oBject)
        {
            bool bool1 = false;

            try
            {
                bool1 = Convert.ToBoolean(oBject);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(bool1);
        }
Ejemplo n.º 13
0
        public static string ConvertTostringDateOrNull(DateTime?oBject)
        {
            string SW = null;

            try
            {
                SW = oBject.Value.ToShortDateString();
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(SW);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// تحويل إلى قيمة رقمية طويلة
        /// </summary>
        /// <param name="oBject">متغير ذات قيمة طويلة</param>
        /// <returns>رقم طويل</returns>
        public static Int64 Convint64(object oBject)
        {
            Int64 Int1 = 0;

            try
            {
                Int1 = Convert.ToInt64(oBject);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(Int1);
        }
Ejemplo n.º 15
0
 public static bool?ConvBoolMelaFemalNUll(object p)
 {
     try
     {
         return(Convert.ToBoolean(p));
     }
     catch
     {
         try
         {
             if ((Convert.ToString(p)).Trim() == "ذكر")
             {
                 return(false);
             }
             else if ((Convert.ToString(p)).Trim() == "انثى")
             {
                 return(true);
             }
             else if ((Convert.ToString(p)).Trim() == "إنثى")
             {
                 return(true);
             }
             else if ((Convert.ToString(p)).Trim() == "أنثى")
             {
                 return(true);
             }
             else if ((Convert.ToString(p)).Trim() == "انثي")
             {
                 return(true);
             }
             else if ((Convert.ToString(p)).Trim() == "أنثي")
             {
                 return(true);
             }
             else if ((Convert.ToString(p)).Trim() == "إنثي")
             {
                 return(true);
             }
             else
             {
                 return(null);
             }
         }
         catch (Exception e)
         {
             ErrorClass.ErrorClassConvert(e);
             return(null);
         }
     }
 }
Ejemplo n.º 16
0
        public static string ConvNonullTostring(object oBject)
        {
            string string1 = "";

            try
            {
                string1 = Convert.ToString(oBject);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(string1);
        }
        private void UserAndNameAdderingToWebSite_Load(object sender, EventArgs e)
        {
            try
            {
                DownloadDataFromWebCliend.LoginSet("m5524512", "m5524512");
            }
            catch (Exception ex)
            {
                ErrorClass.SaveErrorFile(ex, true);

                this.Close();
            }
            UserNameGetWebSite1 = DownloadDataFromWebCliend.GetInfrmationofdateGet();
            ClassDataGridViewDo.DataGridAddVuleComBoxEx(comboBoxEx2, Valuationname.Valuationnamelist);
            ClassDataGridViewDo.DataGridAddVuleComBoxEx(comboBoxEx1, UserNameGetWebSite1);
        }
Ejemplo n.º 18
0
        public static System.Xml.XmlDataDocument ConvXml(object oBject)
        {
            ///يستوجب تعديل من أجل وضع صورة إفتراضية
            ///
            System.Xml.XmlDataDocument XmlDataDocument1 = new System.Xml.XmlDataDocument();

            try
            {
                System.Xml.XmlDataDocument XmlDataDocument = (System.Xml.XmlDataDocument)oBject;
                return(XmlDataDocument);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(XmlDataDocument1);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// تحويل من متحول عام إلى صورة
        /// </summary>
        /// <param name="oBject">متغير الصورة</param>
        /// <returns>صورة</returns>
        public static System.Drawing.Image ConvImage(object oBject)
        {
            ///يستوجب تعديل من أجل وضع صورة إفتراضية
            ///تغير إلى null
            ///
            if (oBject == null)
            {
                return(null);
            }
            Type ve = oBject.GetType();

            if (ve.Name == "Byte[]")
            {
                try
                {
                    byte[] e = (byte[])(oBject);
                    System.IO.MemoryStream fe = new MemoryStream(e);

                    return(System.Drawing.Image.FromStream(fe));
                }
                catch (Exception e)
                {
                    ErrorClass.ErrorClassConvert(e);
                    return(null);
                }
            }
            else
            {
                try
                {
                    System.Drawing.Image Image1 = (System.Drawing.Image)oBject;
                    if (Image1 == null)
                    {
                        Image1 = System.Drawing.Image.FromFile("C:\\do.jpg");
                    }
                    return(Image1);
                }

                catch (Exception e)
                {
                    ErrorClass.ErrorClassConvert(e);
                    return(null);
                }
            }
        }
Ejemplo n.º 20
0
        public static string ConvString(object oBject)
        {
            string string1 = null;

            try
            {
                string1 = Convert.ToString(oBject);
                if (string1 == "")
                {
                    string1 = null;
                }
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(string1);
        }
Ejemplo n.º 21
0
        public static string ConvIdNumberAdderZero4Digit(object p)
        {
            try
            {
                string Strin = Convert.ToString(p);

                while (Strin.Length < 4)
                {
                    Strin = "0" + Strin;
                }
                return(Strin);
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
                return(Convert.ToString(p));
            }
        }
Ejemplo n.º 22
0
 public static bool?ConvBoolnull(object oBject)
 {
     try
     {
         if (oBject.ToString() != "")
         {
             return(Convert.ToBoolean(oBject));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception e)
     {
         ErrorClass.ErrorClassConvert(e);
         return(null);
     }
 }
        /// <summary>
        /// إرسال أمر SQl
        /// وإرجعه على شكل مصفوفتين كائنات
        /// </summary>
        /// <param name="SqlCommand1">أمر SQL</param>
        /// <returns>ليست بداخل ليست Object</returns>
        public static async Task <List <List <object> > > GetSql(System.Data.SqlClient.SqlCommand SqlCommand1)
        {
            List <object>         object1 = new List <object>();
            List <List <object> > object2 = new List <List <object> >();

            if (await openConction())
            {
                SqlCommand1.Connection = Sqldatabasethrding.SqlConnection1;

                SqlDataReader SqlDataReader1 = null;

                try
                {
                    SqlDataReader1 = SqlCommand1.ExecuteReader();


                    while (await SqlDataReader1.ReadAsync())
                    {
                        for (int i = 0; i < SqlDataReader1.FieldCount; i++)
                        {
                            object1.Add(SqlDataReader1.GetValue(i));
                        }
                        object2.Add(object1);
                        object1 = new List <object>();
                    }
                }
                catch (Exception e)
                {
                    ErrorClass.SaveErrorFile(e);
                }
                finally
                {
                    SqlDataReader1.Close();
                    SqlDataReader1.Dispose();
                }
                return(object2);
            }
            else
            {
                return(object2);
            }
        }
 public static async Task <bool> openConction()
 {
     try {
         if (Sqldatabasethrding.SqlConnection1.State != System.Data.ConnectionState.Open)
         {
             SqlConnection1.Close();
             SqlConnection1.ConnectionString = sqlconction;
             await Sqldatabasethrding.SqlConnection1.OpenAsync();
         }
         else
         {
         }
     }
     catch (Exception e)
     {
         ErrorClass.SaveErrorFile(e);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 25
0
        public static DateTime?ConvDateTimeNull(object oBject)
        {
            DateTime?DateTime1 = null;



            try
            {
                DateTime1 = Convert.ToDateTime(oBject);
                if (DateTime1 == DateTime.MinValue)
                {
                    DateTime1 = null;
                }
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            return(DateTime1);
        }
Ejemplo n.º 26
0
        public static byte[] ConvImageTobyteArray(object oBject)
        {
            MemoryStream ace = new MemoryStream();

            byte[] byte1 = null;
            try
            {
                System.Drawing.Image Image1 = (System.Drawing.Image)oBject;
                Image1.Save(ace, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte1 = ace.ToArray();
            }
            catch (Exception e)
            {
                ErrorClass.ErrorClassConvert(e);
            }
            finally
            {
                ace.Dispose();
            }
            return(byte1);
        }
        public static async Task SqlupdataVitl(SqlCommand Sqlcommand1)
        {
            await openConction();

            try
            {
                //      IAsyncResult result = Sqlcommand1.BeginExecuteNonQuery();
                Sqlcommand1.Connection = Sqldatabasethrding.SqlConnection1;
                Sqlcommand1.ExecuteNonQuery();
            }

            catch (Exception e)
            {
                ErrorClass.SaveErrorFile(e);
                MessageBox.Show(e.ToString());
            }

            finally
            {
            }
        }
        public static async Task <bool> SaveOrUpdeataDataBase(SqlCommand Sqlcommand1)
        {
            await openConction();

            try
            {
                Sqlcommand1.Connection = Sqldatabasethrding.SqlConnection1;
                Sqlcommand1.ExecuteNonQuery();
            }

            catch (Exception e)
            {
                ErrorClass.SaveErrorFile(e);
                return(false);
            }

            finally
            {
            }

            return(true);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// تحويل إلى وقت
        /// </summary>
        /// <param name="oBject">متغير الوقت</param>
        /// <returns>وقت</returns>
        public static DateTime ConvDateTime(object oBject)
        {
            DateTime DateTime1 = new DateTime();



            try
            {
                DateTime1 = Convert.ToDateTime(oBject);
                if (DateTime1 == DateTime.MinValue)
                {
                    DateTime1 = Convert.ToDateTime("1753/2/1");
                }
            }
            catch (Exception e)

            {
                ErrorClass.ErrorClassConvert(e);
                DateTime1 = Convert.ToDateTime("1753/2/1");
            }
            return(DateTime1);
        }
        public static async Task <int> SqlSaveAdderAndBack(SqlCommand Vitl)
        {
            await openConction();

            try
            {
                //      IAsyncResult result = Sqlcommand1.BeginExecuteNonQuery();
                Vitl.Connection = Sqldatabasethrding.SqlConnection1;
                return((int)Vitl.ExecuteScalar());
            }

            catch (Exception e)
            {
                ErrorClass.SaveErrorFile(e);
                MessageBox.Show(e.ToString());
            }

            finally
            {
            }
            return(0);
        }