private void btn_UcShowMemberMemberInfoDeleteMember_Click(object sender, EventArgs e) { try { rayan_sportDataSetTableAdapters.memberTableAdapter memberTableAdapter = new rayan_sportDataSetTableAdapters.memberTableAdapter(); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); memberTableAdapter.DeleteQuery(int.Parse(txb_UcShowMemberMemberInfoMemberId.Text)); logTableAdapter.Insert("حذف ورزشکار با نام " + member.member_name + "", "member", "admin", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()); string path; path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\member_image\"; if (File.Exists(path + txb_UcShowMemberMemberInfoMemberId.Text + ".Jpeg")) { File.GetAccessControl(path + txb_UcShowMemberMemberInfoMemberId.Text + ".Jpeg"); File.Delete(path + txb_UcShowMemberMemberInfoMemberId.Text + ".Jpeg"); } Alert alert = new Alert("اطلاعات ورزشکار با کد عضویت " + txb_UcShowMemberMemberInfoMemberId.Text + "حذف شد", "green"); btn_UcShowMemberMemberInfoClear.PerformClick(); } catch (Exception ee) { MessageBox.Show(ee.Message); Alert alert = new Alert("خطا در افزودن ورزشکار", "darkred"); } }
private void enterMember() { if (txb_UcCheckInInfoMemberId.Text.Equals("")) { //MessageBox.Show("کد عضویت ورزشکار را وارد نمایید"); Alert alert = new Alert("کد عضویت ورزشکار را وارد نمایید", "red"); txb_UcCheckInInfoMemberId.Focus(); } else { int?commode; if (txb_UcCheckInInfoCommodeNum.Text.Equals("")) { commode = null; } else { commode = Convert.ToInt32(txb_UcCheckInInfoCommodeNum.Text); } try { rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); rayan_sportDataSet.memberCheckInDataTable memberCheckInDataTable = new rayan_sportDataSet.memberCheckInDataTable(); rayan_sportDataSetTableAdapters.memberCheckInTableAdapter memberCheckInTableAdapter = new rayan_sportDataSetTableAdapters.memberCheckInTableAdapter(); DateTime d = DateTime.Now; PersianCalendar pc = new PersianCalendar(); String date = String.Format("{0}/{1:00}/{2:00} - {3:00}:{4:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d), pc.GetHour(d), pc.GetMinute(d)); string date1 = string.Format("{0}/{1:00}/{2:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d)); string time1 = string.Format("{0:00}:{1:00}", pc.GetHour(d), pc.GetMinute(d)); memberCheckInTableAdapter.Insert(membershipId, date, commode); //MessageBox.Show(memberGender + " " + memberName + " " + "وارد شد."); Alert alert = new Alert(memberGender + " " + memberName + " " + "وارد شد.", "green"); txb_UcCheckInInfoMemberId.Clear(); ClearTexts(); llb_UcCheckInInfoShowMemberDetail.Enabled = false; pcb_UcCheckInInfoMemberRemainingSession.BackgroundImage = null; pcb_UcCheckInInfoMembershipEndDate.BackgroundImage = null; pcb_UcCheckInInfoMemberShipType.BackgroundImage = null; pbx_UcCheckInInfoMemberPicture.Image = Properties.Resources.no_image; rayan_sportDataSet.membershipDataTable membershipDataTable = new rayan_sportDataSet.membershipDataTable(); rayan_sportDataSetTableAdapters.membershipTableAdapter tableAdapter = new rayan_sportDataSetTableAdapters.membershipTableAdapter(); tableAdapter.IncreaseRemainingSession(remainingSession - 1, member_id, membershipId); logTableAdapter.Insert("checked in member : " + memberName, "memberCheckIn", user_name, date1, time1); } catch (Exception ex) { Alert alert = new Alert(ex.Message, "red"); //throw; } } }
private void btn_UcCheckInCheck_Click(object sender, EventArgs e) { int?commode; if (txb_UcCheckInPrice.Text.Equals("")) { //MessageBox.Show("لطفا قیمت جلسه را وارد نمایید"); Alert alert = new Alert("لطفا قیمت جلسه را وارد نمایید", "red"); txb_UcCheckInPrice.Focus(); } else { if (txb_UcCheckInPrice.Text.Equals("")) { commode = null; } else { commode = Convert.ToInt32(txb_UcCheckInPrice.Text); DateTime d = DateTime.Now; PersianCalendar pc = new PersianCalendar(); String date = String.Format("{0}/{1:00}/{2:00} - {3:00}:{4:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d), pc.GetHour(d), pc.GetMinute(d)); string date1 = string.Format("{0}/{1:00}/{2:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d)); string time1 = string.Format("{0:00}:{1:00}", pc.GetHour(d), pc.GetMinute(d)); //rayan_sportDataSet.logDataTable logeDataTable = new rayan_sportDataSet.logDataTable(); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); rayan_sportDataSet.checkInDataTable checkInDataTabele = new rayan_sportDataSet.checkInDataTable(); rayan_sportDataSetTableAdapters.checkInTableAdapter checkInTableAdapter = new rayan_sportDataSetTableAdapters.checkInTableAdapter(); try { checkInTableAdapter.Insert(Convert.ToInt64(txb_UcCheckInPrice.Text), date, commode); logTableAdapter.Insert("checked in one person", "checkIn", user_name, date1, time1); //MessageBox.Show("ورود با موفقیت انجام شد"); Alert alert = new Alert("ورود با موفقیت انجام شد", "green"); ClearTexts(); } catch (Exception ex) { //MessageBox.Show(ex.Message); Alert alert = new Alert(ex.Message, "red"); } } } }
private void btn_UcShowMemberContractInfoDeleteContract_Click(object sender, EventArgs e) { rayan_sportDataSetTableAdapters.membershipTableAdapter membershipTableAdapter = new rayan_sportDataSetTableAdapters.membershipTableAdapter(); int sucsses = membershipTableAdapter.DeleteById(currnet_membership_id); if (sucsses == 1) { DateTime d = DateTime.Now; PersianCalendar pc = new PersianCalendar(); string date1 = string.Format("{0}/{1:00}/{2:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d)); string time1 = string.Format("{0:00}:{1:00}", pc.GetHour(d), pc.GetMinute(d)); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); logTableAdapter.Insert("deleted membership num : " + currnet_membership_id, "membership", getUser_name(), date1, time1); //MessageBox.Show("حذف با موفقیت انجام شد"); Alert alert = new Alert("حذف با موفقیت انجام شد", "green"); FillData(); } }
private void btn_UcShowMemberMemberInfoChangeMember_Click(object sender, EventArgs e) { if (txb_UcShowMemberMemberInfoMemberName.Text == "") { Alert alert = new Alert("نام و نام خانوادگی ورزشکار را وارد کنید", "darkred"); txb_UcShowMemberMemberInfoMemberName.BackColor = Color.MistyRose; } else if (cmb_UcShowMemberMemberInfoMemberGender.Text == "") { Alert alert = new Alert("جنسیت ورزشکار را وارد کنید", "darkred"); cmb_UcShowMemberMemberInfoMemberGender.BackColor = Color.MistyRose; } else { try { rayan_sportDataSetTableAdapters.memberTableAdapter memberTableAdapter = new rayan_sportDataSetTableAdapters.memberTableAdapter(); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); rayan_sportDataSetTableAdapters.membershipTableAdapter membershipTableAdapter = new rayan_sportDataSetTableAdapters.membershipTableAdapter(); memberTableAdapter.UpdateMember(txb_UcShowMemberMemberInfoMemberName.Text, txb_UcShowMemberMemberInfoMemberNationalCode.Text, txb_UcShowMemberMemberInfoMemberTel.Text, cmb_UcShowMemberMemberInfoMemberGender.Text, cmb_UcShowMemberMemberInfoMemberBlood.Text, txb_UcShowMemberMemberInfoMemberSick.Text, txb_UcShowMemberMemberInfoMemberAddress.Text, int.Parse(txb_UcShowMemberMemberInfoMemberId.Text)); membershipTableAdapter.UpdateMemberNameByMemberIdInMembership(txb_UcShowMemberMemberInfoMemberName.Text, int.Parse(txb_UcShowMemberMemberInfoMemberId.Text)); logTableAdapter.Insert("تغییر ورزشکار با نام " + txb_UcShowMemberMemberInfoMemberName.Text + "", "member", "admin", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()); string path; path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\member_image\"; if (btn_UcShowMemberMemberInfoMemberAddPicture.Text != "افزودن عکس") { pbx_UcShowMemberMemberInfoMemberPicture.Image.Save(path + txb_UcShowMemberMemberInfoMemberId.Text + ".Jpeg", ImageFormat.Jpeg); } Alert alert = new Alert("اطلاعات ورزشکار با کد عضویت " + txb_UcShowMemberMemberInfoMemberId.Text + " تغییر یافت", "green"); } catch (Exception) { Alert alert = new Alert("خطا در تغییر اطلاعات ورزشکار", "darkred"); } } }
private void btn_UcShowMemberContractInfoExpireContract_Click(object sender, EventArgs e) { try { DateTime d = DateTime.Now; PersianCalendar pc = new PersianCalendar(); string date1 = string.Format("{0}/{1:00}/{2:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d)); string time1 = string.Format("{0:00}:{1:00}", pc.GetHour(d), pc.GetMinute(d)); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); rayan_sportDataSetTableAdapters.membershipTableAdapter membershipTableAdapter = new rayan_sportDataSetTableAdapters.membershipTableAdapter(); membershipTableAdapter.UpdateStatusById("غیر فعال", currnet_membership_id, currnet_membership_id); //MessageBox.Show("قرارداد با موفقیت غیرفعال شد"); logTableAdapter.Insert("deactived membership number" + currnet_membership_id, "membership", getUser_name(), date1, time1); Alert alert = new Alert("قرارداد با موفقیت غیرفعال شد ", "green"); FillData(); } catch (Exception ex) { //MessageBox.Show(ex.Message); Alert alert = new Alert(ex.Message, "red"); } }
private void btn_UcShowMemberMemberInfoAddMember_Click(object sender, EventArgs e) { if (txb_UcShowMemberMemberInfoMemberName.Text == "") { Alert alert = new Alert("نام و نام خانوادگی ورزشکار را وارد کنید", "darkred"); txb_UcShowMemberMemberInfoMemberName.BackColor = Color.MistyRose; } else if (cmb_UcShowMemberMemberInfoMemberGender.Text == "") { Alert alert = new Alert("جنسیت ورزشکار را وارد کنید", "darkred"); cmb_UcShowMemberMemberInfoMemberGender.BackColor = Color.MistyRose; } else { try { rayan_sportDataSetTableAdapters.memberTableAdapter memberTableAdapter = new rayan_sportDataSetTableAdapters.memberTableAdapter(); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); int addMemberWorks = memberTableAdapter.Insert(txb_UcShowMemberMemberInfoMemberName.Text, txb_UcShowMemberMemberInfoMemberNationalCode.Text, txb_UcShowMemberMemberInfoMemberTel.Text, null, cmb_UcShowMemberMemberInfoMemberGender.Text, cmb_UcShowMemberMemberInfoMemberBlood.Text, txb_UcShowMemberMemberInfoMemberSick.Text, txb_UcShowMemberMemberInfoMemberAddress.Text, null); if (addMemberWorks == 1) { logTableAdapter.Insert("افزودن ورزشکار با نام " + txb_UcShowMemberMemberInfoMemberName.Text + "", "member", "admin", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()); txb_UcShowMemberMemberInfoMemberId.Text = Convert.ToString(memberTableAdapter.getMemberIdQuery(txb_UcShowMemberMemberInfoMemberName.Text, txb_UcShowMemberMemberInfoMemberNationalCode.Text, txb_UcShowMemberMemberInfoMemberTel.Text, cmb_UcShowMemberMemberInfoMemberGender.Text, cmb_UcShowMemberMemberInfoMemberBlood.Text, txb_UcShowMemberMemberInfoMemberSick.Text, txb_UcShowMemberMemberInfoMemberAddress.Text)); string path; path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\member_image\"; if (btn_UcShowMemberMemberInfoMemberAddPicture.Text != "افزودن عکس") { pbx_UcShowMemberMemberInfoMemberPicture.Image.Save(path + txb_UcShowMemberMemberInfoMemberId.Text + ".Jpeg", ImageFormat.Jpeg); } member = new Member(); member.member_id = int.Parse(txb_UcShowMemberMemberInfoMemberId.Text); member.member_name = txb_UcShowMemberMemberInfoMemberName.Text; member.member_nationalCode = txb_UcShowMemberMemberInfoMemberNationalCode.Text; member.member_address = txb_UcShowMemberMemberInfoMemberAddress.Text; member.member_sick = txb_UcShowMemberMemberInfoMemberSick.Text; member.member_tel = txb_UcShowMemberMemberInfoMemberTel.Text; member.member_gender = cmb_UcShowMemberMemberInfoMemberGender.Text; member.member_blood = cmb_UcShowMemberMemberInfoMemberBlood.Text; btn_UcShowMemberMemberInfoAddMember.Enabled = false; btn_UcShowMemberMemberInfoChangeMember.Enabled = true; btn_UcShowMemberMemberInfoDeleteMember.Enabled = true; FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm is Form_ShowMember) { (frm as Form_ShowMember).changeContractEnabled(true, member); } } Alert alert = new Alert("ورزشکار جدید با کد عضویت " + txb_UcShowMemberMemberInfoMemberId.Text + " افزوده شد", "green"); } } catch (Exception) { Alert alert = new Alert("خطا در افزودن ورزشکار", "darkred"); } } }
private void btn_UcShowMemberContractInfoSave_Click(object sender, EventArgs e) { long?reciptnum; if (cmb_UcShowMemberContractInfoExpireContractPaymentType.Text.Equals("")) { //MessageBox.Show("نوع پرداخت را وارد نمایید"); Alert alert = new Alert("نوع پرداخت را وارد نمایید ", "green"); cmb_UcShowMemberContractInfoExpireContractPaymentType.Focus(); } else { try { string startDate = dts_UcShowMemberContractInfoStartDate.Value.Value.ToString("M/d/yyyy"); startDate = getDateHijri(startDate); if (cmb_UcShowMemberContractInfoExpireContractPaymentType.Text.Equals("نقد")) { reciptnum = null; } else { reciptnum = Convert.ToInt64(txb_UcShowMemberContractInfoReciptNum.Text); } rayan_sportDataSet.membershipDataTable memberShipDataTable = new rayan_sportDataSet.membershipDataTable(); rayan_sportDataSetTableAdapters.membershipTableAdapter membershipTableAdapter = new rayan_sportDataSetTableAdapters.membershipTableAdapter(); int sucsses = membershipTableAdapter.Insert(member.member_id, member.member_name, startDate, txb_UcShowMemberContractInfoEndDate.Text, cmb_UcShowMemberContractInfoContractType.Text, Convert.ToInt32(txb_UcShowMemberContractInfoRemainingSession.Text), reciptnum, cmb_UcShowMemberContractInfoExpireContractPaymentType.Text, Convert.ToInt64(txb_UcShowMemberContractInfoExpireContractPrice.Text), Convert.ToInt64(txb_UcShowMemberContractInfoPayment.Text), txb_UcShowMemberContractInfoDes.Text, "فعال" ); if (sucsses == 1) { DateTime d = DateTime.Now; PersianCalendar pc = new PersianCalendar(); string date1 = string.Format("{0}/{1:00}/{2:00}", pc.GetYear(d), pc.GetMonth(d), pc.GetDayOfMonth(d)); string time1 = string.Format("{0:00}:{1:00}", pc.GetHour(d), pc.GetMinute(d)); rayan_sportDataSetTableAdapters.logTableAdapter logTableAdapter = new rayan_sportDataSetTableAdapters.logTableAdapter(); logTableAdapter.Insert("added membership for : " + member.member_name, "membership", getUser_name(), date1, time1); //MessageBox.Show("قرارداد با موفقیت اضافه شد"); Alert alert = new Alert("قرارداد با موفقیت اضافه شد", "green"); FillData(); btn_UcShowMemberContractInfoDeleteContract.Enabled = false; btn_UcShowMemberContractInfoDeleteContract.BackColor = Properties.Settings.Default.MediumGrey; btn_UcShowMemberContractInfoExpireContract.Enabled = false; btn_UcShowMemberContractInfoExpireContract.BackColor = Properties.Settings.Default.MediumGrey; btn_UcShowMemberContractInfoAddContract.Enabled = true; btn_UcShowMemberContractInfoAddContract.BackColor = Properties.Settings.Default.Blue; foreach (var txb in tableLayoutPanel3.Controls) { if (txb is TextBox) { (txb as TextBox).Clear(); } if (txb is ComboBox) { (txb as ComboBox).Text = ""; } } dts_UcShowMemberContractInfoStartDate.ResetText(); tableLayoutPanel3.Enabled = false; btn_UcShowMemberContractInfoClear.BackColor = Properties.Settings.Default.MediumGrey; btn_UcShowMemberContractInfoSave.BackColor = Properties.Settings.Default.MediumGrey; } } catch (Exception ex) { //MessageBox.Show(ex.Message); Alert alert = new Alert("قرارداد با موفقیت اضافه شد", "green"); return; } } }