private void btn_Print_Click(object sender, EventArgs e) { DataTable DT_Information = new DataTable(); if (dtGrid.CurrentRow == null) { MessageBox.Show("لطفا یک کاربر را انتخاب کنید"); return; } using (DB_GymEntities dbGym = new DB_GymEntities()) { int num = int.Parse(dtGrid.CurrentRow.Cells[0].Value.ToString()); var tbl = dbGym.Tbl_Athlete.Where(c => c.Athlete_ID == num).ToList(); var query = tbl; DT_Information.Columns.Add("Athlete_ID"); DT_Information.Columns.Add("Athlete_FullName"); DT_Information.Columns.Add("Athlete_BirthDay"); DT_Information.Columns.Add("Athlete_ValidityDate"); DT_Information.Columns.Add("Athlete_Image"); DT_Information.Columns.Add("Athlete_Barcod"); DT_Information.Rows.Add(); DT_Information.Rows[0][0] = tbl[0].Athlete_ID; DT_Information.Rows[0][1] = tbl[0].Athlete_FullName; DT_Information.Rows[0][2] = tbl[0].Athlete_BirthDay; DT_Information.Rows[0][3] = tbl[0].Athlete_ValidityDate; DT_Information.Rows[0][4] = Application.StartupPath + "/Images/" + tbl[0].Athlete_Image; DT_Information.Rows[0][5] = Application.StartupPath + "/Images/" + tbl[0].Athlete_Barcod; stiReport1.RegData("DT_Information", DT_Information); stiReport1.Load(Application.StartupPath + "/Report.mrt"); stiReport1.Show(); } }
private void LoadInfo() { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Wardrops.Where(c => c.Wardrop_ID == _num).ToList(); txtWrdrobeNum.Text = tbl[0].Wardrop_Number; txtResrv.Text = tbl[0].Wardrop_AthleteName; string state = tbl[0].Wardrop_State; if (state == "پر") { cmdState.SelectedIndex = 0; } else { cmdState.SelectedIndex = 1; } } } catch { MessageBox.Show("مشکل رد نمایش اطلاعات"); } }
private void btnSubDelete_Click(object sender, EventArgs e) { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Wardrops.Where(c => c.Wardrop_ID == _num).ToList(); if (tbl[0].Wardrop_State == "پر") { MessageBox.Show("این کمد به دلیل پر بودن قابل حذف نمی باشد"); return; } } ActiveSubMenuBtn(sender); if (MessageBox.Show("آیا از حذف این کاربر مطمن هستید؟", "توجه", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (DB_GymEntities dbGym = new DB_GymEntities()) { dbGym.Tbl_Wardrops.Remove(dbGym.Tbl_Wardrops.Find(_num)); dbGym.SaveChanges(); dtGrid.DataSource = dbGym.Tbl_Wardrops.ToList(); } _timerflag = 0; _width = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); pnlSubMenu.Visible = false; } }
private void dtGridGoods_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dtGridGoods.CurrentRow != null) { _GoodsID = int.Parse(dtGridGoods.CurrentRow.Cells[0].Value.ToString()); using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Store.Where(c => c.Store_FoodID == _GoodsID).ToList(); lblGoodsName.Text = tbl[0].Store_FoodName; lblPrice.Text = tbl[0].Store_FoodPrice; lblTotalPrice.Text = tbl[0].Store_FoodPrice; txtNumber.Maximum = int.Parse(tbl[0].Store_FoodInventory); } if (_GoodsID >= 0) { txtNumber.Enabled = true; } if (_AthleteID > 0 && _GoodsID > 0) { btnEdit.Enabled = true; } } else { MessageBox.Show("لطفا یک کالا را انتخاب کنید"); } }
private void btn_Add_Click(object sender, EventArgs e) { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { bool any = dbGym.Tbl_Wardrops.Any(c => c.Wardrop_Number == txt.Text); if (any) { lblWarn.Text = "این شماره ی کمد وجود دارد"; lblWarn.ForeColor = Color.Red; dbGym.Dispose(); return; } Tbl_Wardrops tbl = new Tbl_Wardrops() { Wardrop_AthleteName = "بدون مشتری", Wardrop_Number = txt.Text, Wardrop_State = "خالی" }; dbGym.Tbl_Wardrops.Add(tbl); dbGym.SaveChanges(); lblWarn.Text = "کمد ثبت شد"; lblWarn.ForeColor = Color.Green; } } catch { MessageBox.Show("مشکل در ثبت کمد"); } }
private void btnLog_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text) || (String.IsNullOrEmpty(txtPassWord.Text))) { MessageBox.Show("لطفا همه ی فیلد ها را پر کنید "); return; } bool any; using (DB_GymEntities dbGym = new DB_GymEntities()) { any = dbGym.Tbl_AdminAccess.Any(c => c.AdminAccess_UserName == txtName.Text); if (!any) { MessageBox.Show("همچین نام کاربری وجود ندارد"); return; } var tbl = dbGym.Tbl_AdminAccess.Where(c => c.AdminAccess_UserName == txtName.Text).ToList(); Properties.Settings.Default.UserID = tbl[0].AdminAccess_ID; if (tbl[0].AdminAccess_PassWord == txtPassWord.Text) { FrmMain frm = new FrmMain(); Hide(); frm.ShowDialog(); Close(); } else { MessageBox.Show("رمز عبور اشتباه می باشد"); } } }
private void txtGoodsSearch_TextChanged(object sender, EventArgs e) { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Store.Where(c => c.Store_FoodName.Contains(txtGoodsSearch.Text)).ToList(); dtGridGoods.DataSource = tbl; } }
private void txtAthleteSearch_TextChanged(object sender, EventArgs e) { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Athlete.Where(c => c.Athlete_FullName.Contains(txtAthleteSearch.Text)).ToList(); dtGridAthlete.DataSource = tbl; } }
public FrmManageAdmin() { InitializeComponent(); dtGrid.AutoGenerateColumns = false; using (DB_GymEntities dbGym = new DB_GymEntities()) { dtGrid.DataSource = dbGym.Tbl_AdminAccess.ToList(); } }
public FrmCaseHistory() { InitializeComponent(); dtGrid.AutoGenerateColumns = false; using (DB_GymEntities dbGym = new DB_GymEntities()) { dtGrid.DataSource = dbGym.Vw_Factor.ToList(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (txtName.Text == String.Empty) { MessageBox.Show("قسمت نام را پر کنید"); return; } try { using (DB_GymEntities gymDB = new DB_GymEntities()) { if (_flag == 1) { _imageName = Guid.NewGuid().ToString() + Path.GetExtension(pctImage.ImageLocation); } else { _imageName = Guid.NewGuid().ToString() + ".png"; _flag = 0; } string path = Application.StartupPath + "/Images/"; if (Directory.Exists(path)) { Directory.CreateDirectory(path); } pctImage.Image.Save(path + _imageName); var tblr = gymDB.Tbl_Athlete.Where(c => c.Athlete_ID == _num).ToList(); File.Delete(Application.StartupPath + "/Images/" + tblr[0].Athlete_Image); var tbl = gymDB.Tbl_Athlete.Where(c => c.Athlete_ID == _num).ToList(); tbl[0].Athlete_ID = _num.Value; tbl[0].Athlete_Address = txtAddress.Text; tbl[0].Athlete_FullName = txtName.Text; tbl[0].Athlete_PhoneNumber = txtPhoneNumber.Text.ToString(); tbl[0].Athlete_WardropNum = null; tbl[0].Athlete_Image = _imageName; tbl[0].Athlete_BirthDay = txtBirthDay.Text.ToString(); tbl[0].Athlete_JoinDate = txtJoinDay.Text.ToString(); tbl[0].Athlete_ValidityDate = txtValidDay.Text.ToString(); gymDB.SaveChanges(); pctImage.Image.Save(path + _imageName); MessageBox.Show("عملیات موفقیت آمیز بود"); dtGrid.DataSource = gymDB.Tbl_Athlete.ToList(); pnlSubMenu.Visible = false; _width = 0; _timerflag = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); }; } catch (Exception es) { MessageBox.Show(es.ToString()); MessageBox.Show("عملیات موفقیت آمیز نبود"); } }
public FrmManageGoods() { InitializeComponent(); pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); using (DB_GymEntities dbGym = new DB_GymEntities()) { dtGrid.DataSource = dbGym.Tbl_Store.ToList(); } }
private void btnAdd_Click(object sender, EventArgs e) { if (txtName.Text == String.Empty) { MessageBox.Show("قسمت نام را پر کنید"); return; } try { using (DB_GymEntities gymDB = new DB_GymEntities()) { string guid = Guid.NewGuid().ToString(); if (_flag == 1) { _imageName = guid + Path.GetExtension(pctImage.ImageLocation); } else { _imageName = guid + ".png"; _flag = 0; } string path = Application.StartupPath + "/Images/"; if (Directory.Exists(path)) { Directory.CreateDirectory(path); } pctImage.Image.Save(path + _imageName); Tbl_Athlete tbl = new Tbl_Athlete() { Athlete_Address = txtAddress.Text, Athlete_FullName = txtName.Text, Athlete_PhoneNumber = txtPhoneNumber.Text.ToString(), Athlete_WardropNum = null, Athlete_Image = _imageName, Athlete_BirthDay = txtBirthDay.Text.ToString(), Athlete_JoinDate = txtJoinDay.Text.ToString(), Athlete_ValidityDate = txValidDay.Text.ToString(), Athlete_Barcod = "_Barcode_" + guid + ".png" }; gymDB.Tbl_Athlete.Add(tbl); gymDB.SaveChanges(); //Make Barcode barCodeCtrl.BarCode = tbl.Athlete_ID.ToString(); barCodeCtrl.SaveImage(path + "_Barcode_" + guid + ".png"); // pctImage.Image.Save(path + _imageName); MessageBox.Show("عملیات موفقیت آمیز بود"); Reset(); }; } catch (Exception es) { MessageBox.Show(es.ToString()); MessageBox.Show("عملیات موفقیت آمیز نبود"); } }
public FrmManageWardrobs() { InitializeComponent(); cmdState.SelectedIndex = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); using (DB_GymEntities dbGym = new DB_GymEntities()) { dtGrid.DataSource = dbGym.Tbl_Wardrops.ToList(); } }
public FrmSale() { InitializeComponent(); dtGridGoods.AutoGenerateColumns = false; dtGridAthlete.AutoGenerateColumns = false; using (DB_GymEntities dbGym = new DB_GymEntities()) { dtGridAthlete.DataSource = dbGym.Tbl_Athlete.ToList(); dtGridGoods.DataSource = dbGym.Tbl_Store.ToList(); } }
public FrmManageMember() { InitializeComponent(); pnlSubMenu.Size = new Size(0, pnlSubMenu.Height); pnlSubMenu.Visible = false; dtGrid.AutoGenerateColumns = false; pnlPayMent.Visible = false; using (DB_GymEntities gymDb = new DB_GymEntities()) { dtGrid.DataSource = gymDb.Tbl_Athlete.ToList(); } }
private void FrmMain_Load(object sender, EventArgs e) { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_AdminAccess.Where(c => c.AdminAccess_ID == Properties.Settings.Default.UserID).ToList(); btnAddMember.Enabled = tbl[0].AdminAccess_AddMember; btnManageMember.Enabled = tbl[0].AdminAccess_ManageMember; btnCaseHistory.Enabled = tbl[0].AdminAccess_CaseHistory; BtnAddGoods.Enabled = tbl[0].AdminAccess_AddGoods; btnManageMember.Enabled = tbl[0].AdminAccess_ManageGoods; btnSaleGoods.Enabled = tbl[0].AdminAccess_SaleGoods; btnManageWardrobe.Enabled = tbl[0].AdminAccess_ManageWardRobe; btnTakeSuport.Enabled = tbl[0].AdminAccess_BackUp; btnRecovery.Enabled = tbl[0].AdminAccess_Restore; } }
private void LoadInfo() { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Store.Where(c => c.Store_FoodID == _num).ToList(); txtGoodsName.Text = tbl[0].Store_FoodName; txtInventory.Value = int.Parse(tbl[0].Store_FoodInventory); txtPrice.Value = int.Parse(tbl[0].Store_FoodPrice); } } catch { MessageBox.Show("مشکل رد نمایش اطلاعات"); } }
private void btnEdit_Click(object sender, EventArgs e) { PersianCalendar pc = new PersianCalendar(); string date = pc.GetYear(DateTime.Today).ToString("0000") + "/" + pc.GetMonth(DateTime.Today).ToString("00") + "/" + pc.GetDayOfMonth(DateTime.Today).ToString("00"); try { using (TransactionScope ts = new TransactionScope()) { using (DB_GymEntities dbGym = new DB_GymEntities()) { Tbl_Factor tblfactor = new Tbl_Factor() { Facotr_Price = int.Parse(lblTotalPrice.Text), Athlete_ID = _AthleteID, Factor_Type = "خرید از فروشگاه", Factor_Date = date }; var tblstore = dbGym.Tbl_Store.Where(c => c.Store_FoodID == _GoodsID).ToList(); tblstore[0].Store_FoodID = _GoodsID; tblstore[0].Store_FoodInventory = (int.Parse(tblstore[0].Store_FoodInventory) - txtNumber.Value).ToString(); dbGym.Tbl_Factor.Add(tblfactor); dbGym.SaveChanges(); ts.Complete(); } MessageBox.Show("عملیات موفقیت آمیز بود"); } } catch { MessageBox.Show("عملیات موفقیت آمیز نبود"); } using (DB_GymEntities dbGym = new DB_GymEntities()) { dtGridGoods.DataSource = dbGym.Tbl_Store.ToList(); dtGridAthlete.DataSource = dbGym.Tbl_Athlete.ToList(); txtAthleteSearch.ResetText(); txtGoodsSearch.ResetText(); lblAthleteName.ResetText(); lblGoodsName.ResetText(); lblPrice.ResetText(); lblTotalPrice.ResetText(); btnEdit.Enabled = txtNumber.Enabled = false; } }
private void btnSubDelete_Click(object sender, EventArgs e) { ActiveSubMenuBtn(sender); if (MessageBox.Show("آیا از حذف این کاربر مطمن هستید؟", "توجه", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (DB_GymEntities dbGym = new DB_GymEntities()) { dbGym.Tbl_Store.Remove(dbGym.Tbl_Store.Find(_num)); dbGym.SaveChanges(); dtGrid.DataSource = dbGym.Tbl_Store.ToList(); } _timerflag = 0; _width = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); pnlSubMenu.Visible = false; } }
private void btn_Add_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtPass.Text) || String.IsNullOrEmpty(txtPass2.Text)) { MessageBox.Show("لطفا همه ی قسمت ها را پر کنید"); return; } if (txtPass2.Text != txtPass.Text) { MessageBox.Show("رمز های عبور طتابق ندارد"); return; } try { using (DB_GymEntities dbGym = new DB_GymEntities()) { Tbl_AdminAccess tbl = new Tbl_AdminAccess() { AdminAccess_UserName = txtName.Text, AdminAccess_PassWord = txtPass.Text, AdminAccess_AddMember = (cbAddMember.Checked == true) ? true : false, AdminAccess_AddGoods = (cbAddGoods.Checked == true) ? true : false, AdminAccess_BackUp = (cbBackUp.Checked == true) ? true : false, AdminAccess_CaseHistory = (cbCaseHistory.Checked == true) ? true : false, AdminAccess_ManageAdmin = (cbManageAccess.Checked == true) ? true : false, AdminAccess_ManageGoods = (cbManageGoods.Checked == true) ? true : false, AdminAccess_ManageMember = (cbManageMember.Checked == true) ? true : false, AdminAccess_ManageWardRobe = (cbManageWardrobe.Checked == true) ? true : false, AdminAccess_Restore = (cbReStore.Checked == true) ? true : false, AdminAccess_SaleGoods = (cbSaleGoods.Checked == true) ? true : false, }; dbGym.Tbl_AdminAccess.Add(tbl); dbGym.SaveChanges(); MessageBox.Show("عملیات موفقیت آمیز بود"); dtGrid.DataSource = dbGym.Tbl_AdminAccess.ToList(); } } catch { MessageBox.Show("عملیات موفقیت آمیز نبود"); } }
private void btnSubDelete_Click(object sender, EventArgs e) { ActiveSubMenuBtn(sender); if (MessageBox.Show("آیا از حذف این کاربر مطمن هستید؟", "توجه", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Athlete.Where(c => c.Athlete_ID == _num).ToList(); File.Delete(Application.StartupPath + "/Images/" + tbl[0].Athlete_Image); dbGym.Tbl_Athlete.Remove(dbGym.Tbl_Athlete.Find(_num)); dbGym.SaveChanges(); dtGrid.DataSource = dbGym.Tbl_Athlete.ToList(); } _timerflag = 0; _width = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); pnlSubMenu.Visible = false; } }
private void dtGridAthlete_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dtGridAthlete.CurrentRow != null) { _AthleteID = int.Parse(dtGridAthlete.CurrentRow.Cells[0].Value.ToString()); using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Athlete.Where(c => c.Athlete_ID == _AthleteID).ToList(); lblAthleteName.Text = tbl[0].Athlete_FullName; } if (_AthleteID > 0 && _GoodsID > 0) { btnEdit.Enabled = true; } } else { MessageBox.Show("لطفا یک کاربر را انتخاب کنید"); } }
private void btnEdit_Click(object sender, EventArgs e) { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Wardrops.Where(c => c.Wardrop_ID == _num).ToList(); tbl[0].Wardrop_State = cmdState.Text; tbl[0].Wardrop_AthleteName = txtResrv.Text; dbGym.SaveChanges(); dtGrid.DataSource = dbGym.Tbl_Wardrops.ToList(); } MessageBox.Show("عملیات موفقیت آمیز بود"); _timerflag = 0; _width = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); } catch { MessageBox.Show("عملیات موفقیت آمیز بود", "اخطار"); } }
private void btnAdd_Click(object sender, EventArgs e) { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { Tbl_Store tbl = new Tbl_Store() { Store_FoodName = txtName.Text, Store_FoodPrice = txtPrice.Value.ToString(), Store_FoodInventory = txtInventory.Value.ToString() }; dbGym.Tbl_Store.Add(tbl); dbGym.SaveChanges(); MessageBox.Show("عملیات با موفقیت انجام شد"); ResetFields(); } } catch { MessageBox.Show("عملیات با موفقیت انجام نشد"); } }
private void btnEdit_Click(object sender, EventArgs e) { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Store.Where(c => c.Store_FoodID == _num).ToList(); tbl[0].Store_FoodName = txtGoodsName.Text; tbl[0].Store_FoodPrice = txtPrice.Value.ToString(); tbl[0].Store_FoodInventory = txtInventory.Value.ToString(); dbGym.SaveChanges(); dtGrid.DataSource = dbGym.Tbl_Store.ToList(); } MessageBox.Show("عملیات موفقیت آمیز بود"); _timerflag = 0; _width = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); } catch { MessageBox.Show("عملیات موفقیت آمیز بود", "اخطار"); } }
private void LoadInfo() { try { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tbl = dbGym.Tbl_Athlete.Where(c => c.Athlete_ID == _num).ToList(); txtName.Text = tbl[0].Athlete_FullName; txtAddress.Text = tbl[0].Athlete_Address; txtBirthDay.Text = tbl[0].Athlete_BirthDay; txtJoinDay.Text = tbl[0].Athlete_JoinDate; txtValidDay.Text = tbl[0].Athlete_ValidityDate; txtPhoneNumber.Text = tbl[0].Athlete_PhoneNumber; pctImage.ImageLocation = Application.StartupPath + "/Images/" + tbl[0].Athlete_Image; _fullname = tbl[0].Athlete_FullName; _validay = tbl[0].Athlete_ValidityDate; } } catch { MessageBox.Show("مشکل رد نمایش اطلاعات"); } }
private void LoadInf() { dtGrid.AutoGenerateColumns = false; try { using (DB_GymEntities dbGym = new DB_GymEntities()) { var list = dbGym.Vw_Factor.ToList(); if (!String.IsNullOrEmpty(txtSearchName.Text)) { list = list.Where(c => c.Athlete_FullName.Contains(txtSearchName.Text)).ToList(); } if (!String.IsNullOrEmpty(txtSearchID.Text)) { list = list.Where(c => c.Factor_ID == int.Parse(txtSearchID.Text)).ToList(); } dtGrid.DataSource = list; } } catch { } }
private void btnPay_Click(object sender, EventArgs e) { try { using (TransactionScope ts = new TransactionScope()) { using (DB_GymEntities dbGym = new DB_GymEntities()) { var tblAthlete = dbGym.Tbl_Athlete.Where(c => c.Athlete_ID == _num).ToList(); tblAthlete[0].Athlete_ValidityDate = txtValidDayFee.Text; Tbl_Factor tblFactor = new Tbl_Factor() { Facotr_Price = int.Parse(txtFee.Value.ToString()), Factor_Date = txtValidDayFee.Text, Factor_Type = "شهریه", Athlete_ID = _num.Value }; dbGym.Tbl_Factor.Add(tblFactor); dbGym.SaveChanges(); } ts.Complete(); Properties.Settings.Default.Fee = txtFee.Value.ToString(); } _width = 0; pnlSubMenu.Size = new Size(_width, pnlSubMenu.Height); pnlSub.Visible = true; pnlPayMent.Visible = false; _timerflag = 0; Properties.Settings.Default.Fee = txtFee.Value.ToString(); } catch { MessageBox.Show("عملیات موفقیت آمیز نبود"); } }