private void Button1_Click(object sender, EventArgs e) { if (updateGiaDinh()) { GxGiaDinhList.InSoGiaDinh(Id); } }
public bool GetDataRaoHonPhoi(DataRow row1, DataRow row2) { try { DataObj = new DataSet(); //Get Giaoxu info //Get Giaoxu info DataTable tblGiaoXu = Memory.GetData(SqlConstants.SELECT_GIAOXU); if (Memory.ShowError()) { return(false); } if (tblGiaoXu.Rows.Count == 0) { MessageBox.Show("Không tìm thấy thông tin giáo xứ. Vui lòng nhập thông tin giáo xứ trước khi sử dụng chức năng này."); return(false); } tblGiaoXu.TableName = GiaoXuConst.TableName; DataObj.Tables.Add(tblGiaoXu); //get main report data DataTable tblReportRaoHonPhoi = new DataTable(ReportRaoHonPhoiConst.TableName); //Add columns tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.HoTen1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.HoTen2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.NgaySinh1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.NgaySinh2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.NgayThangNam); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.NoiSinh1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.NoiSinh2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenCha1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenCha2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoPhan1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoPhan2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoPhanTruoc1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoPhanTruoc2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoXu1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoXu2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoXuTruoc1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenGiaoXuTruoc2); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenLinhMucGui); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenLinhMucNhan); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.GiaoXuNhan); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenMe1); tblReportRaoHonPhoi.Columns.Add(ReportRaoHonPhoiConst.TenMe2); //Assign value DataRow newRow = tblReportRaoHonPhoi.NewRow(); newRow[ReportRaoHonPhoiConst.HoTen1] = string.Format("{0} {1}", row1[GiaoDanConst.TenThanh], row1[GiaoDanConst.HoTen]); newRow[ReportRaoHonPhoiConst.HoTen2] = string.Format("{0} {1}", row2[GiaoDanConst.TenThanh], row2[GiaoDanConst.HoTen]); newRow[ReportRaoHonPhoiConst.NgaySinh1] = row1[GiaoDanConst.NgaySinh]; newRow[ReportRaoHonPhoiConst.NgaySinh2] = row2[GiaoDanConst.NgaySinh]; if (Memory.GetConfig(GxConstants.CF_LANGUAGE).ToString() == GxConstants.LANG_EN) { newRow[ReportRaoHonPhoiConst.NgayThangNam] = Memory.GetReportNgayThangNamEn(); } else { newRow[ReportRaoHonPhoiConst.NgayThangNam] = Memory.GetReportNgayThangNamVn(); } newRow[ReportRaoHonPhoiConst.NoiSinh1] = row1[GiaoDanConst.NoiSinh]; newRow[ReportRaoHonPhoiConst.NoiSinh2] = row2[GiaoDanConst.NoiSinh]; newRow[ReportRaoHonPhoiConst.TenGiaoPhan1] = txtGiaoPhan1.Text; newRow[ReportRaoHonPhoiConst.TenGiaoPhan2] = txtGiaoPhan2.Text; newRow[ReportRaoHonPhoiConst.TenGiaoPhanTruoc1] = txtGiaoPhanTruoc1.Text; newRow[ReportRaoHonPhoiConst.TenGiaoPhanTruoc2] = txtGiaoPhanTruoc2.Text; newRow[ReportRaoHonPhoiConst.TenGiaoXu1] = txtGiaoXu1.Text; newRow[ReportRaoHonPhoiConst.TenGiaoXu2] = txtGiaoXu2.Text; newRow[ReportRaoHonPhoiConst.TenGiaoXuTruoc1] = txtGiaoXuTruoc1.Text; newRow[ReportRaoHonPhoiConst.TenGiaoXuTruoc2] = txtGiaoXuTruoc2.Text; newRow[ReportRaoHonPhoiConst.TenLinhMucGui] = cbChaGui.Text; newRow[ReportRaoHonPhoiConst.TenLinhMucNhan] = txtChaNhan.Text; newRow[ReportRaoHonPhoiConst.GiaoXuNhan] = txtGiaoXuNhan.Text; Dictionary <object, object> dicChaMe = GxGiaDinhList.GetTenChaMe((int)row1[GiaoDanConst.MaGiaoDan], row1[GiaoDanConst.HoTenCha], row1[GiaoDanConst.HoTenMe]); newRow[ReportRaoHonPhoiConst.TenCha1] = dicChaMe[GxConstants.VAITRO_CHONG]; newRow[ReportRaoHonPhoiConst.TenMe1] = dicChaMe[GxConstants.VAITRO_VO]; dicChaMe = GxGiaDinhList.GetTenChaMe((int)row2[GiaoDanConst.MaGiaoDan], row2[GiaoDanConst.HoTenCha], row2[GiaoDanConst.HoTenMe]); newRow[ReportRaoHonPhoiConst.TenCha2] = dicChaMe[GxConstants.VAITRO_CHONG]; newRow[ReportRaoHonPhoiConst.TenMe2] = dicChaMe[GxConstants.VAITRO_VO]; tblReportRaoHonPhoi.Rows.Add(newRow); DataObj.Tables.Add(tblReportRaoHonPhoi); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void frmGiaDinh_Load(object sender, EventArgs e) { choNhapMaRieng = (Memory.GetConfig(GxConstants.CF_TUNHAP_MAGIADINH) == GxConstants.CF_TRUE); //handle events this.txtNguoiChong.OnSelected += new System.EventHandler(this.txtNguoiChong_OnSelected); this.txtNguoiVo.OnSelected += new System.EventHandler(this.txtNguoiVo_OnSelected); #region format grid start gxGiaoDanList1.FormatGrid(); gxGiaoDanList1.AllowEdit = InheritableBoolean.True; foreach (GridEXColumn col in gxGiaoDanList1.RootTable.Columns) { col.EditType = EditType.NoEdit; } GridEXColumn colQuanHe = new GridEXColumn(); colQuanHe.HasValueList = true; colQuanHe.Width = 80; colQuanHe.EditType = EditType.DropDownList; colQuanHe.FilterEditType = FilterEditType.Combo; colQuanHe.BoundMode = ColumnBoundMode.Bound; colQuanHe.DataMember = ThanhVienGiaDinhConst.VaiTro; colQuanHe.Key = ThanhVienGiaDinhConst.VaiTro; colQuanHe.Caption = "Quan hệ GĐ"; GridEXValueListItemCollection vl = colQuanHe.ValueList; GxGiaDinhList.LoadQuanHeGDText(vl); gxGiaoDanList1.RootTable.Columns.Insert(0, colQuanHe); gxGiaoDanList1.RootTable.Columns[GiaoDanConst.DienThoai].Visible = false; #endregion format grid end if (this.operation == GxOperation.ADD) { id = Memory.Instance.GetNextId(GiaDinhConst.TableName, GiaDinhConst.MaGiaDinh, true); gxCommand1.Button1.Visible = false; } else { gxCommand1.Button1.Visible = true; if (this.Operation == GxOperation.VIEW) { gxCommand1.OKButton.Visible = false; gxCommand1.Button1.Visible = false; gxGiaoDanList1.AllowEditGiaoDan = false; } } string sql = string.Format(SqlConstants.SELECT_THANHVIEN_GIADINH, SqlConstants.SELECT_GIAODAN_LIST_CO_GIAOHO); gxGiaoDanList1.LoadData(sql + " AND ThanhVienGiaDinh.MaGiaDinh = ? AND ThanhVienGiaDinh.VaiTro <> 0 AND ThanhVienGiaDinh.VaiTro <> 1 ORDER BY ThanhVienGiaDinh.VaiTro, GiaoDan.NamSinh", new object[] { id }); tblChaMe = Memory.GetData(sql + " AND ThanhVienGiaDinh.MaGiaDinh = ? AND ThanhVienGiaDinh.VaiTro <= 1", new object[] { id }); if (!Memory.ShowError()) { tblChaMe.TableName = ThanhVienGiaDinhConst.TableName; } txtMaGiaDinh.Text = id.ToString(); if (choNhapMaRieng) { txtMaGiaDinh.Visible = false; txtMaGiaDinhRieng.Location = txtMaGiaDinh.Location; txtMaGiaDinhRieng.Visible = true; } else { txtMaGiaDinh.Visible = true; txtMaGiaDinhRieng.Visible = false; } isLoaded = true; }