private void btn_Xoa_Click(object sender, EventArgs e) { try { if (ExpressionMethod.CheckAuth(this.auth)) { DialogResult result = MessageBox.Show("Xác nhận xóa khách hàng", "Xóa khách hàng", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { if (db.DeleteCustomer(Int32.Parse(pictureBox1.Tag.ToString()))) { MessageBox.Show("Xóa thành công", "Xóa khách hàng", MessageBoxButtons.OK, MessageBoxIcon.Information); binding.DataSource = db.GetCustomers(); } else { MessageBox.Show("Xóa khách hàng thất bại", "Xóa khách hàng", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddInfoToAccessForm() { tablePnl.Rows[4].Height = 450; ExpressionMethod.EditGridView(grv_ThueDia); ExpressionMethod.ConfigListView(lsvOnHold); AddColumnToList(); }
private void ConfigToSuccessForm() { tablePanel1.Rows[0].Height = tablePanel1.Rows[1].Height; ExpressionMethod.EditGridView(grvDSTieuDe); ExpressionMethod.EditGridView(grvDSGanDia); bindingDSTilte.DataSource = null; ExpressionMethod.LoadGridControl(grcDSTieuDe, grvDSTieuDe, bindingDSTilte); ExpressionMethod.LoadGridControl(grc_DSGanDia, grvDSGanDia, bindingDSDatTruoc); }
private void AddInfoToSuccessForm() { ExpressionMethod.AddOptionToReportCustomer(cbx_ThongKeKH); ExpressionMethod.EditGridView(grvDuDoan); ExpressionMethod.EditGridView(grvKH); ExpressionMethod.EditGridView(grvTieuDe); ExpressionMethod.EditGridView(grvTreHan); tablePanel7.Rows[0].Height = tablePanel7.Rows[1].Height = 270; }
public FormThueDia(string auth) { InitializeComponent(); dbCus = new CustomerBUL(); dbRented = new ListRentedBUL(); db = ExpressionMethod.DBDiskRent(); this.binding = new BindingSource(); this.auth = auth; }
public FormTraDia(string auth) { InitializeComponent(); dbListRented = new ListRentedBUL(); db = ExpressionMethod.DBDiskReturn(); binding = new BindingSource(); binding.DataSource = new List <DiskInfoReturn>(); this.auth = auth; }
public static ExpressionMethod GetByID(Guid ID) { Init(); ExpressionMethod expressionMethod = null; if (methodsByIds.TryGetValue(ID, out expressionMethod)) { return(expressionMethod); } return(null); }
private void btnHuyKhoanTre_Click(object sender, EventArgs e) { if (ExpressionMethod.CheckAuth(this.auth)) { DialogResult result = MessageBox.Show("Xác nhận xóa khoản trễ này", "Xóa khoản trễ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { ThucHienXoaKhoanTre(); } } }
private void LoadView() { try { binding.DataSource = db.GetTitles(); ExpressionMethod.LoadGridControl(grd_TieuDe, grv_TieuDe, binding); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ThucHienTraDia() { foreach (var item in binding.DataSource as List <DiskInfoReturn> ) { if (dbListRented.ReturnDisk(item.IdListRented) == false) { MessageBox.Show("Trả đĩa thất bại", "Trả đĩa", MessageBoxButtons.OK, MessageBoxIcon.Error); } } MessageBox.Show("Trả đĩa thành công", "Trả đĩa", MessageBoxButtons.OK, MessageBoxIcon.Information); db = ExpressionMethod.DBDiskReturn(); binding.DataSource = new List <DiskInfoReturn>(); }
public static void Add(ExpressionMethod Method) { Init(); lock (lck) { if (!methodsByIds.ContainsKey(Method.ID)) { foreach (String name in Method.OperationNames) { methodsByNames[name.ToUpper()] = Method; } methodsByIds[Method.ID] = Method; } } }
//////////////////////////////////////////////////////////////////// public static ExpressionMethodInfo FindByName(String Name) { Init(); ExpressionMethod expressionMethod = null; if (methodsByNames.TryGetValue(Name, out expressionMethod)) { return new ExpressionMethodInfo() { ID = expressionMethod.ID } } ; return(null); }
private void btn_ThemTieuDe_Click(object sender, EventArgs e) { try { if (ExpressionMethod.CheckAuth(this.auth)) { FormThemTD frm = new FormThemTD(); frm.Show(); frm.FormClosing += Frm_FormClosing; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_ThemDia_Click(object sender, EventArgs e) { try { if (ExpressionMethod.CheckAuth(this.auth)) { FormThemDiaBS frm = new FormThemDiaBS(Int32.Parse(pictureBox1.Tag.ToString())); frm.Show(); frm.FormClosing += Frm_FormClosing; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Handler for 1 or more construct /// </summary> /// <param name="separator">the separator token between items</param> /// <param name="terminal">the ending token</param> /// <param name="meth">the method to call to parse an item</param> /// <param name="result">the parsed expression</param> /// <returns>true if match parsed, false otherwise</returns> private bool ReadAhead(Token separator, Token terminal, ExpressionMethod meth, out Expression result) { Token tok = PeekToken(); result = null; if (tok == terminal) { ReadToken(); return(false); } else if (tok == separator) { ReadToken(); } result = meth(); return(true); }
public static void Add(ExpressionMethod Method) { Init(); lock (lck) { if (!methodsByIds.ContainsKey(Method.ID)) { foreach (String name in Method.OperationNames) #if CASE_INSENSITIVE { methodsByNames[name.ToUpper()] = Method; } #else { methodsByNames[name] = Method; } #endif methodsByIds[Method.ID] = Method; } } }
private void btn_Xoa_Click(object sender, EventArgs e) { if (ExpressionMethod.CheckAuth(this.auth)) { DialogResult result = MessageBox.Show("Xác nhận xóa đĩa bản sao này", "Xóa đĩa bản sao", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { if (db.Delete(Int32.Parse(pictureBox1.Tag.ToString()))) { MessageBox.Show("Xóa thành công", "Xóa đĩa bản sao", MessageBoxButtons.OK, MessageBoxIcon.Information); binding.DataSource = db.GetDisks(); } else { MessageBox.Show("Xóa thất bại", "Xóa đĩa bản sao", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btn_CapNhat_Click(object sender, EventArgs e) { if (ExpressionMethod.CheckAuth(this.auth)) { if (btn_CapNhat.Text == "Cập nhật") { btn_XacNhan.Enabled = true; txt_GiaThue.ReadOnly = false; txt_SoNgayThue.ReadOnly = false; btn_CapNhat.Text = "Hủy"; } else { btn_XacNhan.Enabled = false; txt_GiaThue.ReadOnly = true; txt_SoNgayThue.ReadOnly = true; btn_CapNhat.Text = "Cập nhật"; } } }
private void btn_CapNhat_Click(object sender, EventArgs e) { if (ExpressionMethod.CheckAuth(auth) == true) { if (btn_CapNhat.Text == "Cập nhật") { cbx_TrangThaiDia.Enabled = true; txt_TenTieuDe.ReadOnly = false; btn_CapNhat.Text = "Hủy"; btn_XacNhan.Enabled = true; } else { cbx_TrangThaiDia.Enabled = false; btn_XacNhan.Enabled = false; txt_TenTieuDe.ReadOnly = true; btn_CapNhat.Text = "Cập nhật"; } } }
private void LoadDuDoanGridView(int idCustomer) { var dbAllRented = dbRented.GetListRenteds(); var lstDuDoan = dbAllRented.Where(x => x.IdCustomer == idCustomer && x.StatusOnBill == null && x.ExpectedReturnDate < DateTime.Today).Select(x => new { IdDisk = x.IdDisk, ExpectedReturnDate = x.ExpectedReturnDate }) .Join(dbDisk.GetDisks(), dd => dd.IdDisk, d => d.IdDisk, (dd, d) => new { dd, d }) .Join(dbTitle.GetTitles(), ddd => ddd.d.IdTitle, t => t.IdTitle, (ddd, t) => new{ IdDisk = ddd.dd.IdDisk, ExpectedReturnDate = ddd.dd.ExpectedReturnDate, Title = t.NameTitle }); var bindingDuDoan = new BindingSource(); bindingDuDoan.DataSource = lstDuDoan; ExpressionMethod.LoadGridControl(grcDuDoan, grvDuDoan, bindingDuDoan); var lstTreHan = dbAllRented.Where(x => x.IdCustomer == idCustomer && x.StatusOnBill != null && x.StatusOnBill.Equals(STATUS_UNPAID)).Select(x => new{ IdDisk = x.IdDisk, ExpectedReturnDate = x.ExpectedReturnDate, ActualReturnDate = x.ActualReturnDate, LateFee = x.LateFee }); var bindingTreHan = new BindingSource(); bindingTreHan.DataSource = lstTreHan; ExpressionMethod.LoadGridControl(grcTreHan, grvTreHan, bindingTreHan); double?phitrehan = 0; foreach (var item in lstTreHan) { phitrehan += item.LateFee; } txtTongPhiNo.Text = phitrehan.ToString(); }
private void ReportTitle() { var dbBSThueCuaTitle = (from d in dbDisk.GetDisks() group d by d.IdTitle into titleGroup select new { Title = titleGroup.Key, SoLuongThue = titleGroup.Where(x => x.DiskRentalStatus.Equals(STATUS_RENTED)).Count(), SoLuongBSDatTruoc = titleGroup.Where(x => x.DiskRentalStatus.Equals(STATUS_ONHOLD)).Count(), }) .Join(dbTitle.GetTitles(), bs => bs.Title, t => t.IdTitle, (bs, t) => new { idTitle = t.IdTitle, TitleName = t.NameTitle, SoLuongTrenKe = t.TotalDiskOnShelf, SoLuongThue = bs.SoLuongThue, SoLuongBSDatTruoc = bs.SoLuongBSDatTruoc }); var dbDSDatTruoc = from pre in dbListPre.GetListTitlePreOrders().Where(x => x.StatusProcess.Equals(STATUS_INCOMPLETE)) group pre by pre.IdTitle into preListGroup select new { idTitle = preListGroup.Key, TongDatTruoc = preListGroup.Sum(x => x.NumberOfDisk) }; var db = dbBSThueCuaTitle .GroupJoin(dbDSDatTruoc, bss => bss.idTitle, dt => dt.idTitle, (bss, dt) => new { bss, dt }) .SelectMany(temp => temp.dt.DefaultIfEmpty(), (bs, temp) => new { bs = bs, dt = temp }); List <ReportTitle> lst = new List <ReportTitle>(); foreach (var item in db) { int?tongsodattruoc = 0; if (item.dt != null) { tongsodattruoc = item.dt.TongDatTruoc; } lst.Add(new ReportTitle { TitleName = item.bs.bss.TitleName, TongSoBanSao = item.bs.bss.SoLuongThue + item.bs.bss.SoLuongTrenKe + item.bs.bss.SoLuongBSDatTruoc, TongSoBanSaoDuocDatTruoc = tongsodattruoc, TongSoBanSaoDuocThue = item.bs.bss.SoLuongThue, TongSoBanSaoTrongKho = item.bs.bss.SoLuongTrenKe, TongSoDatTruocDangXuLi = item.bs.bss.SoLuongBSDatTruoc }); } bindingTitle.DataSource = lst; ExpressionMethod.LoadGridControl(grcTieuDe, grvTieuDe, bindingTitle); }
private void ThucHienThueDia() { if (txtMaKH.CheckMa() == false) { return; } ThucHienLayDiaDatTruoc(); int idCustomer = Int32.Parse(txtMaKH.Text.ToString()); foreach (var item in binding.DataSource as List <DiskInfoRent> ) { ListRented rented = new ListRented { IdDisk = item.IdDisk, IdCustomer = idCustomer, LateFee = item.LateFee, RentalDate = DateTime.Today, ExpectedReturnDate = DateTime.Today.AddDays(item.TimeRented), ActualReturnDate = null, StatusOnBill = null }; if (dbRented.AddListRented(rented) == false) { MessageBox.Show("Thuê đĩa thất bại", "Thuê đĩa", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } MessageBox.Show("Thuê đĩa thành công", "Thuê đĩa", MessageBoxButtons.OK, MessageBoxIcon.Error); db = ExpressionMethod.DBDiskRent(); binding.DataSource = new List <DiskInfoRent>(); }
//public SPPermissionCollection GetUserPermissions(string userId) //{ // if (this.CanSetPermissions) // { // var user = new SPUser(userId, true); // if (this.Permissions == null) // this.GetPermissions(); // if (this.Permissions) // } // else // return null; //} #endregion #region GET PERMISSIONS public SPPermissionCollection GetPermissions() { if (!SecObj.IsPropertyReady(x => x.RoleAssignments)) { CTX.Lae(SecObj, true, s => s.RoleAssignments); } Type secType = SecObj.GetType(); var genMeth = ExpressionMethod.MakeGenericMethod(secType); var expressions = genMeth.Invoke(this, new object[1] { new string[2] { NameProperty, IdProperty } }); var specLae = typeof(CTX).GetMethod("SpecialLae", BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(SecObj.GetType()); specLae.Invoke(null, new object[3] { SecObj, true, expressions }); Permissions = SPPermissionCollection.ResolvePermissions(this); return(Permissions); }
/// <summary> /// Handler for 1 or more construct /// </summary> /// <param name="separator">the separator token between items</param> /// <param name="terminal">the ending token</param> /// <param name="meth">the method to call to parse an item</param> /// <param name="result">the parsed expression</param> /// <param name="first">flag indicating whether this is the first item</param> /// <returns>true if match parsed, false otherwise</returns> private bool ReadAhead(Token separator, Token terminal, ExpressionMethod meth, out Expression result, ref bool first) { Token tok = PeekToken(); result = null; if (tok == terminal) { ReadToken(); return(false); } if (!first) { RequireToken(separator, tok, "Items should be separated by {0}", separator); ReadToken(); } else if (first && tok == separator) { throw new ParseException(string.Format("Error: unexpected token {0} at Line: {1}, Position: {2}", tok, tok.linenumber, tok.position)); } result = meth(); first = false; return(true); }
private void LoadView() { binding.DataSource = db.GetCustomers(); ExpressionMethod.LoadGridControl(grd_KhachHang, grv_KhachHang, binding); }
/// <summary> /// Handler for 1 or more construct /// </summary> /// <param name="separator">the separator token between items</param> /// <param name="terminal">the ending token</param> /// <param name="meth">the method to call to parse an item</param> /// <param name="result">the parsed expression</param> /// <returns>true if match parsed, false otherwise</returns> private bool ReadAhead(Token separator, Token terminal, ExpressionMethod meth, out Expression result) { Token tok = PeekToken(); result = null; if (tok == terminal) { ReadToken(); return false; } else if (tok == separator) { ReadToken(); } result = meth(); return true; }
private void ConfigToSuccessView() { ExpressionMethod.EditGridView(grv_KhachHang); }
private void FormDatTruoc_Load(object sender, EventArgs e) { FormLienHeDatTruoc frm = new FormLienHeDatTruoc(); ExpressionMethod.AddFormToPanel(pnl, frm); }
private void btn_DanhSachDatTruoc_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e) { FormDanhSachDatTruoc frm = new FormDanhSachDatTruoc(); ExpressionMethod.AddFormToPanel(pnl, frm); }
private void LoadView() { binding.DataSource = new List <DiskInfoRent>(); ExpressionMethod.LoadGridControl(grdc_DSThueDia, grv_ThueDia, binding); }
/// <summary> /// Handler for 1 or more construct /// </summary> /// <param name="separator">the separator token between items</param> /// <param name="terminal">the ending token</param> /// <param name="meth">the method to call to parse an item</param> /// <param name="result">the parsed expression</param> /// <param name="first">flag indicating whether this is the first item</param> /// <returns>true if match parsed, false otherwise</returns> private bool ReadAhead(Token separator, Token terminal, ExpressionMethod meth, out Expression result, ref bool first) { Token tok = PeekToken(); result = null; if (tok == terminal) { ReadToken(); return false; } if (!first) { RequireToken(separator, tok, "Items should be separated by {0}", separator); ReadToken(); } else if (first && tok == separator) throw new ParseException(string.Format("Error: unexpected token {0} at Line: {1}, Position: {2}", tok, tok.linenumber, tok.position)); result = meth(); first = false; return true; }
/// <summary> /// Handler for 1 or more construct /// </summary> /// <param name="separator">the separator token between items</param> /// <param name="terminal">the ending token</param> /// <param name="meth">the method to call to parse an item</param> /// <param name="result">the parsed expression</param> /// <param name="first">flag indicating whether this is the first item</param> /// <returns>true if match parsed, false otherwise</returns> private bool ReadAhead(Token separator, Token terminal, ExpressionMethod meth, out Expression result, ref bool first) { Token tok = PeekToken(); result = null; if (tok == terminal) { ReadToken(); return false; } if (!first) { RequireToken(separator, tok, "Items should be separated by {0}", separator); ReadToken(); } else if (first && tok == separator) throw new ParseException("Error unexpected token " + tok); result = meth(); first = false; return true; }
private void LoadView() { ReportTitle(); ExpressionMethod.LoadGridControl(grcKH, grvKH, bindingCustomer); }