public static List <Team> GetByGetbyIdNameName(int id, bool Ative) { List <Team> Lista = new List <Team>(); string sqlCommand = "SELECT [Id],[date_Start] ,[Date_End],[ID_informtion],[id_NameTeam_Ta],[Id_Jop_Ta] ,[Setewation],[Delete] FROM [HR_SARC].[dbo].[Team_ta] where [Delete] = 0 and [id_NameTeam_Ta] = @id "; if (Ative) { sqlCommand += " And ( [Date_End] is null ) "; for (int i = 0; i < Team.ListNotAllAtive.Count; i++) { sqlCommand += " And [Setewation] !=" + Team.ListNotAllAtive[i].ToString(); } } System.Data.SqlClient.SqlCommand SqlComm = new System.Data.SqlClient.SqlCommand(sqlCommand); SqlComm.Parameters.AddWithValue("@id", id); Task <List <List <object> > > temp = Sqldatabasethrding.GetSql(SqlComm); while (!temp.IsCompleted) { } List <List <object> > Adw = temp.Result; for (int i = 0; i < Adw.Count; i++) { if (Adw[i].Count != 0) { Lista.Add(new Team(Convert.ToInt32(Adw[i][0]), ClassConvert.ConvDateTimeNull(Adw[i][1]), ClassConvert.ConvDateTimeNull(Adw[i][2]), Convert.ToInt32(Adw[i][3]), Convert.ToInt32(Adw[i][4]), Convert.ToInt32(Adw[i][5]), Convert.ToInt32(Adw[i][6]))); } } return(Lista); }
private void AdderNameForTeam_Load(object sender, EventArgs e) { ClassDataGridViewDo.DataGridAddVuleComBoxEx(comboBoxEx3, Jop.JopStatic); ClassDataGridViewDo.DataGridAddVuleComBoxEx(comboBoxEx2, Team.Setwation); intList = RibbonForm1.intList; textBoxX1.AutoCompleteCustomSource = RibbonForm1.Combox; textBoxX1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBoxX1.AutoCompleteSource = AutoCompleteSource.CustomSource; if (Team == null) { buttonX1.Text = "إضافة"; } else { textBoxX1.Text = RibbonForm1.Combox[intList.IndexOf(Team.ID_informtion)]; comboBoxEx2.SelectedIndex = Team.Setewation; comboBoxEx3.SelectedIndex = ClassDataGridViewDo.RetunIndexByIdSech(Team.Id_Jop_Ta, Jop.JopStatic); if (ClassConvert.ConvDateTimeNull(Team.date_Start) != null) { dateTimeInput1.Value = ClassConvert.ConvDateTime(Team.date_Start); } if (ClassConvert.ConvDateTimeNull(Team.Date_End) != null) { dateTimeInput2.Value = ClassConvert.ConvDateTime(Team.Date_End); } buttonX1.Text = "تعديل"; } }
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; }
private void buttonX1_Click(object sender, EventArgs e) { if (TeamEdit == null) { TeamEdit = new Team(CountOfNew, ClassConvert.ConvDateTimeNull(date_Start.Value), ClassConvert.ConvDateTimeNull(Date_End.Value), idVite, SerchByComBBox(id_NameTeam_Ta, NameTeam.NameTeamStatic), SerchByComBBox(Id_Jop_Ta, Jop.JopStatic), Setewation.SelectedIndex); CountOfNew--; this.DialogResult = System.Windows.Forms.DialogResult.Yes; } else { TeamEdit.Eidt(ClassConvert.ConvDateTimeNull(date_Start.Value), ClassConvert.ConvDateTimeNull(Date_End.Value), idVite, SerchByComBBox(id_NameTeam_Ta, NameTeam.NameTeamStatic), SerchByComBBox(Id_Jop_Ta, Jop.JopStatic), Setewation.SelectedIndex); this.DialogResult = System.Windows.Forms.DialogResult.OK; } this.Close(); }
private void buttonX1_Click(object sender, EventArgs e) { if (this.comboBoxEx2.SelectedIndex == -1) { MegBox.Show("عليك إختيار الوضع"); return; } if (this.comboBoxEx3.SelectedIndex == -1) { MegBox.Show("عليك إختيار المنصب"); return; } if (Team == null) { if (RibbonForm1.Combox.IndexOf(textBoxX1.Text) != -1) { Team = new Team(0, ClassConvert.ConvDateTimeNull(dateTimeInput1.Value), ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), intList[RibbonForm1.Combox.IndexOf(textBoxX1.Text)], NameTeam.id, EditTame.SerchByComBBox(comboBoxEx3, Jop.JopStatic), comboBoxEx2.SelectedIndex); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MegBox.Show("الأسم غير موجود"); } } else { if (RibbonForm1.Combox.IndexOf(textBoxX1.Text) != -1) { Team.Eidt(ClassConvert.ConvDateTimeNull(dateTimeInput1.Value), ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), intList[RibbonForm1.Combox.IndexOf(textBoxX1.Text)], NameTeam.id, EditTame.SerchByComBBox(comboBoxEx3, Jop.JopStatic), comboBoxEx2.SelectedIndex); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MegBox.Show("الأسم غير موجود"); } } }
public CV_Info(int id) { // System.Data.SqlClient.SqlCommand SqlCommand = new System.Data.SqlClient.SqlCommand("SELECT [id] ,[FullName] ,[Notes] ,[NmuberOfArchev] ,[Id_Study] ,[Year_sutr],[Numberphone] ,[Date],[ID_TemaNeed] ,[Bit] ,[ToOutTeam] ,[ToOutDate] ,[Notesout] FROM [HR_SARC].[dbo].[CV_Info] where [Delete] =0 and id = @id"); SqlCommand.Parameters.AddWithValue("id", id); List <List <object> > Adw = (Sqldatabasethrding.GetSql(SqlCommand)).Result; if (Adw[0].Count != 0) { this.id = Convert.ToInt32(Adw[0][0]); this.FullName = Convert.ToString(Adw[0][1]); this.Notes = Convert.ToString(Adw[0][2]); this.NmuberOfArchev = Convert.ToInt32(Adw[0][3]); this.Id_Study = Convert.ToInt32(Adw[0][4]); this.Year_sutr = Convert.ToInt32(Adw[0][5]); this.Numberphone = Convert.ToInt32(Adw[0][6]); this.Date = ClassConvert.ConvDateTimeNull(Adw[0][7]); this.ID_TemaNeed = Convert.ToInt32(Adw[0][8]); this.Bit = Convert.ToBoolean(Adw[0][9]); this.ToOutTeam = ClassConvert.Convint(Adw[0][10]); this.ToOutDate = ClassConvert.ConvDateTimeNull(Adw[0][11]); this.Notesout = Convert.ToString(Adw[0][12]); } }
public async static Task <List <Team> > GetByIdVil(int id, bool Activet = false) { List <Team> Lista = new List <Team>(); System.Data.SqlClient.SqlCommand SqlComm = new System.Data.SqlClient.SqlCommand("SELECT [Id],[date_Start] ,[Date_End],[ID_informtion],[id_NameTeam_Ta],[Id_Jop_Ta] ,[Setewation],[Delete] FROM [HR_SARC].[dbo].[Team_ta] where [Delete] = 0 and [ID_informtion] = @id "); if (Activet) { SqlComm.CommandText += " And ( [Date_End] is null ) "; } SqlComm.Parameters.AddWithValue("@id", id); List <List <object> > Adw = await Sqldatabasethrding.GetSql(SqlComm); for (int i = 0; i < Adw.Count; i++) { if (Adw[i].Count != 0) { Lista.Add(new Team(Convert.ToInt32(Adw[i][0]), ClassConvert.ConvDateTimeNull(Adw[i][1]), ClassConvert.ConvDateTimeNull(Adw[i][2]), Convert.ToInt32(Adw[i][3]), Convert.ToInt32(Adw[i][4]), Convert.ToInt32(Adw[i][5]), Convert.ToInt32(Adw[i][6]))); } } return(Lista); }
private void buttonX1_Click(object sender, EventArgs e) { if (comboBoxEx1.SelectedIndex == -1) { MegBox.Show("إختار أسم المادة"); return; } if (Waredelivare == null) { Waredelivare = new WereDelivery(0, WereType.WereTypeList[comboBoxEx1.SelectedIndex].id, ClassConvert.ConvDateTimeNull(dateTimeInput1.Value), this.idVite, ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), textBoxX2.Text); this.DialogResult = System.Windows.Forms.DialogResult.Yes; } else { Waredelivare = new WereDelivery(Waredelivare.id, WereType.WereTypeList[comboBoxEx1.SelectedIndex].id, ClassConvert.ConvDateTimeNull(dateTimeInput1.Value), this.idVite, ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), textBoxX2.Text); this.DialogResult = System.Windows.Forms.DialogResult.Yes; } }
public static async System.Threading.Tasks.Task <List <CV_Info> > Serch(string Fullname, string Notes, int Id_Study, int Year_sutr, int ID_TemaNeed, bool Chek, int NumberPhone, string CodeForCV, int SelectTeamOut, string NotesOut) { String Where = ""; List <CV_Info> Ve = new List <CV_Info>(); Fullname = ClassDataGridViewDo.LograthemChangEverAleffToAll(Fullname, true); System.Data.SqlClient.SqlCommand Sqlcom = new System.Data.SqlClient.SqlCommand("SELECT [id] ,[FullName] ,[Notes] ,[NmuberOfArchev] ,[Id_Study] ,[Year_sutr],[Numberphone] ,[Date],[ID_TemaNeed] ,[Bit] ,[ToOutTeam] , [ToOutDate] , [Notesout],[Delete] FROM [HR_SARC].[dbo].[CV_Info] where [Delete] =0 and [FullName] = @FullName " + Where); if (Notes.Trim() != "") { Where += " and [Notes] like @Notes"; Sqlcom.Parameters.AddWithValue("@Notes", "%" + ClassDataGridViewDo.LograthemChangEverAleffToAll(Notes) + "%"); } if (Id_Study != -1) { Where += " and [Id_Study] = @Id_Study"; Sqlcom.Parameters.AddWithValue("Id_Study", Id_Study); } if (Year_sutr != -1) { Where += " and [Year_sutr] = @Year_sutr"; Sqlcom.Parameters.AddWithValue("Year_sutr", Year_sutr); } if (ID_TemaNeed != -1) { Where += " and [ID_TemaNeed] = @ID_TemaNeed"; Sqlcom.Parameters.AddWithValue("ID_TemaNeed", ID_TemaNeed); } if (Chek) { Where += " and [Bit] = @Bit"; Sqlcom.Parameters.AddWithValue("Bit", !Chek); } if (NumberPhone != 0) { Where += " and [Numberphone] = @Numberphone"; Sqlcom.Parameters.AddWithValue("Numberphone", NumberPhone); } if (SelectTeamOut != -1) { Where += " and [ToOutTeam] = @ToOutTeam"; Sqlcom.Parameters.AddWithValue("ToOutTeam", SelectTeamOut); } if (NotesOut.Trim() != "") { Where += " and [Notesout] like @Notesout"; Sqlcom.Parameters.AddWithValue("Notesout", "%" + ClassDataGridViewDo.LograthemChangEverAleffToAll(NotesOut, true) + "%"); } Sqlcom.CommandText = "SELECT [id] ,[FullName] ,[Notes] ,[NmuberOfArchev] ,[Id_Study] ,[Year_sutr],[Numberphone] ,[Date],[ID_TemaNeed] ,[Bit] ,[ToOutTeam] , [ToOutDate] , [Notesout],[Delete] FROM [HR_SARC].[dbo].[CV_Info] where [Delete] =0 and [FullName] like @FullName " + Where; Sqlcom.Parameters.AddWithValue("@FullName", "%" + Fullname + "%"); if (CodeForCV != "") { Sqlcom.CommandText = "SELECT [id] ,[FullName] ,[Notes] ,[NmuberOfArchev] ,[Id_Study] ,[Year_sutr],[Numberphone] ,[Date],[ID_TemaNeed] ,[Bit] ,[ToOutTeam] , [ToOutDate] , [Notesout],[Delete] FROM [HR_SARC].[dbo].[CV_Info] where [Delete] =0 and [id] = @id "; Sqlcom.Parameters.AddWithValue("id", await CV_Info.Serch(CodeForCV)); } List <List <object> > Ob = await Sqldatabasethrding.GetSql(Sqlcom); for (int i = 0; i < Ob.Count; i++) { if (Ob[i].Count != 0) { try { Ve.Add(new CV_Info( Convert.ToInt32(Ob[i][0]), Convert.ToString(Ob[i][1]), Convert.ToString(Ob[i][2]), Convert.ToInt32(Ob[i][3]), Convert.ToInt32(Ob[i][4]), Convert.ToInt32(Ob[i][5]), Convert.ToInt32(Ob[i][6]), ClassConvert.ConvDateTimeNull(Ob[i][7]), Convert.ToInt32(Ob[i][8]), Convert.ToBoolean(Ob[i][9]), -1, null, null )); } catch (Exception e) { ErrorClass.SaveErrorFile(e); } } } return(Ve); }
private async void buttonX1_Click(object sender, EventArgs e) { DateTime?DateTimenull = ClassConvert.ConvDateTimeNull(dateTimeInput1.Value); if (CV_i == null) { if (comboBoxEx1.SelectedIndex == -1) { MegBox.Show("لا يمكن ترك حقل دراسه فارغ"); return; } else if (textBoxX1.Text.Trim() == "") { MegBox.Show("لا يمكن ترك حقل الأسم فارغ"); return; } else if (integerInput1.Value == 0) { MegBox.Show("لا يمكن ترك حقل رقم الهاتف فارغ"); return; } else if (!ClassConvert.IsNumberPhoneMobileOrGrund(integerInput1.Value)) { MegBox.Show("لا يمكن ترك حقل رقم الهاتف فارغ"); return; } int Idc = CV_Study.CV_StudyList[comboBoxEx1.SelectedIndex].id; int Idc1 = -1; int Idc2 = -1; if (comboBoxEx3.SelectedIndex != -1) { Idc1 = CvTeamNeed.CvTeamNeedList[comboBoxEx3.SelectedIndex].id; } if (comboBoxEx4.SelectedIndex != -1) { Idc2 = CvTeamNeed.CvTeamNeedList[comboBoxEx4.SelectedIndex].id; } CV_i = new CV_Info(0, textBoxX1.Text, textBoxX2.Text, await CV.GetTheNumberArchev(Idc), Idc, comboBoxEx2.SelectedIndex, integerInput1.Value, dateTimeInput1.Value, Idc1, checkBoxX1.Checked, comboBoxEx4.SelectedIndex, ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), textBoxX3.Text); int idc = await Sqldatabasethrding.SqlSaveAdderAndBack(CV_i.adder()); if (idc > 0) { MegBox.Show("تم التسجيل", this); labelX4.Text = CV_i.GetCodeArch(); CV_i = new CV_Info(idc, textBoxX1.Text, textBoxX2.Text, await CV.GetTheNumberArchev(Idc), Idc, comboBoxEx2.SelectedIndex, integerInput1.Value, dateTimeInput1.Value, Idc1, checkBoxX1.Checked, Idc2, ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), textBoxX3.Text); foreach (HaveScil item in listHavescil) { item.EditCV_Info_ID(CV_i.id); } Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(this.listHavescil), IntAddeHavescilr, InteditHavescil, IntDelHavescil); } else { MegBox.Show("هناك خطأ في الاتصال", this); } } else { CV_i = new CV_Info(CV_i.id, textBoxX1.Text, textBoxX2.Text, (CV_i.Id_Study == CV_Study.CV_StudyList[comboBoxEx1.SelectedIndex].id ? CV_i.NmuberOfArchev: await CV.GetTheNumberArchev(CV_Study.CV_StudyList[comboBoxEx1.SelectedIndex].id)), CV_Study.CV_StudyList[comboBoxEx1.SelectedIndex].id, comboBoxEx2.SelectedIndex, integerInput1.Value, DateTimenull, comboBoxEx3.SelectedIndex != -1 ? CvTeamNeed.CvTeamNeedList[comboBoxEx3.SelectedIndex].id : -1, checkBoxX1.Checked, comboBoxEx4.SelectedIndex != -1 ? CvTeamNeed.CvTeamNeedList[comboBoxEx4.SelectedIndex].id : -1, ClassConvert.ConvDateTimeNull(dateTimeInput2.Value), textBoxX3.Text ); if (await Sqldatabasethrding.SqlSaveVitl(CV_i.updata())) { labelX4.Text = CV_i.GetCodeArch(); MegBox.Show("تم التعديل", this); Sqldatabasethrding.SqlAddOrUpdateOrDelet(ClassConvert.ConvertListInterfaseToDataBase(this.listHavescil), IntAddeHavescilr, InteditHavescil, IntDelHavescil); } else { MegBox.Show("هناك خطأ في الاتصال", this); } } }
public static List <WereDelivery> GetByIdVil(int id) { List <WereDelivery> Lista = new List <WereDelivery>(); System.Data.SqlClient.SqlCommand SqlComm = new System.Data.SqlClient.SqlCommand("select [id],[Id_WereType] ,[dateDeliveryitem] ,[id_Information],[DateBackitem],[Notes] FROM [HR_SARC].[dbo].[WereDelivery_ta] where [id_Information] = @id and [Delete] = 0"); SqlComm.Parameters.AddWithValue("@id", id); Task <List <List <object> > > temp = Sqldatabasethrding.GetSql(SqlComm); while (!temp.IsCompleted) { } List <List <object> > Adw = temp.Result; for (int i = 0; i < Adw.Count; i++) { if (Adw[i].Count != 0) { Lista.Add(new WereDelivery(Convert.ToInt32(Adw[i][0]), Convert.ToInt32(Adw[i][1]), ClassConvert.ConvDateTimeNull(Adw[i][2]), Convert.ToInt32(Adw[i][3]), ClassConvert.ConvDateTimeNull(Adw[i][4]), Convert.ToString(Adw[i][5]))); } } return(Lista); }