Пример #1
0
        private void FATabStrip_TabStripItemClosing(TabStripItemClosingEventArgs e)
        {
            if (e.Item.Equals(defaulItem))
            {
                e.Cancel = true;
                return;
            }
            if (e.Item.Controls.Count == 0)
            {
                return;
            }

            frmBase frm = (frmBase)e.Item.Controls[0];

            if (frm != null && dicShows.ContainsKey(frm.Name))
            {
                dicShows.Remove(frm.Name);
                frm.Close();
                GC.Collect();
            }
            if (dicShows.Count == 0)
            {
                defaulItem.Visible = true;
            }
        }
Пример #2
0
        public void RunMethodFormBase()
        {
            if (this.NarMain.SelectedLink == null)
            {
                return;
            }

            if (this.NarMain.SelectedLink.Item.Tag == "")
            {
                return;
            }

            int iID = int.Parse(this.NarMain.SelectedLink.ItemName);

            NarvarItemControl tbCtrl = (NarvarItemControl)this.NarMain.SelectedLink.Item;

            frmMain frmM = (frmMain)this.FindForm();



            tsmiControl  tsmi      = Common.FindTsmi(frmM.msMainSys, iID);
            tbTabControl tbTabMain = frmM.tbTabMain;

            if (tsmi != null)
            {
                tbTabPageControl tbTabPage = new tbTabPageControl();
                tbTabPage.Name = "tabPage" + iID.ToString();

                for (int i = 0; i < tbTabMain.TabPages.Count; i++)
                {
                    if (tbTabPage.Name == tbTabMain.TabPages[i].Name)
                    {
                        tbTabMain.SelectedTabPage = tbTabMain.TabPages[i];
                        return;
                    }
                }

                frmBase obj = (frmBase)Common.RunMethodTabFormBase(tsmi);

                if (Common.InlistLike(obj.Text, "frm"))
                {
                    frmView fv = new frmView();
                    try
                    {
                        fv           = (frmView)obj;
                        fv.Object_ID = tbCtrl.strObject_ID;
                    }
                    catch { }

                    if (!fv.isView)
                    {
                        return;
                    }
                }       //obj.Visible = false;
                Common.AddFormOnTab(obj, "tabPage" + iID.ToString(), tbCtrl.strVietNamese, tbCtrl.strEnglish, tbCtrl.strOtherLanguage, tbCtrl.strImageFileName, tbCtrl.strObject_ID);
            }
        }
Пример #3
0
        public frmMain()
        {
            InitializeComponent();
            frmBase fb = new frmBase();

            fb.panel_DERECHO   = this.splitContainer1.Panel2;
            fb.panel_IZQUIERDO = this.splitContainer1.Panel1;
            fb.CargarBotones();
            fb.Show();
        }
Пример #4
0
        public void ShowForm(Form frm, bool autoSelect)
        {
            FATabStripItem item = null;

            if (dicShows.ContainsKey(frm.Name))
            {
                try
                {
                    FATabStrip.SelectedItem = dicShows[frm.Name];
                    item = FATabStrip.SelectedItem;
                    item.Controls.RemoveAt(0);
                    frmBase opennedForm = (frmBase)Application.OpenForms[frm.Name];
                    opennedForm.Close();
                }
                catch { }
                //return;
            }
            else
            {
                item = new FATabStripItem(frm.Text, null);
                FATabStrip.AddTab(item);
                dicShows.Add(frm.Name, item);
            }
            FATabStrip.Dock = DockStyle.Fill;
            item.Dock       = DockStyle.Fill;
            frm.Dock        = DockStyle.Fill;

            frm.TopLevel        = false;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.AutoScroll      = true;
            frm.WindowState     = FormWindowState.Maximized;

            item.Controls.Add(frm);

            //frm.Dock = DockStyle.Fill;
            if (autoSelect || FATabStrip.Items.DrawnCount == 1)
            {
                FATabStrip.SelectedItem = item;
                item.Selected           = true;
            }
            frm.Show();

            defaulItem.Visible = false;
            GC.Collect();
        }
Пример #5
0
        private DialogResult showForm(DataRow row, frmBase frm)
        {
            DialogResult rs = DialogResult.Cancel;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.DataReturn != null)
                {
                    row[LinhMucConst.MaLinhMuc] = frm.DataReturn[LinhMucConst.MaLinhMuc];
                    row[LinhMucConst.TenThanh]  = frm.DataReturn[LinhMucConst.TenThanh];
                    row[LinhMucConst.HoTen]     = frm.DataReturn[LinhMucConst.HoTen];
                    row[LinhMucConst.ChucVu]    = frm.DataReturn[LinhMucConst.ChucVu];
                    row[LinhMucConst.NgaySinh]  = frm.DataReturn[LinhMucConst.NgaySinh];
                    row[LinhMucConst.TuNgay]    = frm.DataReturn[LinhMucConst.TuNgay];
                    row[LinhMucConst.DenNgay]   = frm.DataReturn[LinhMucConst.DenNgay];
                    row[LinhMucConst.GhiChu]    = frm.DataReturn[LinhMucConst.GhiChu];
                    rs = DialogResult.OK;
                }
            }
            return(rs);
        }
Пример #6
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtUsuario.Text) || string.IsNullOrWhiteSpace(txtSenha.Text))
            {
                MessageBox.Show("Informe o login e a senha.");
            }
            else
            {
                try
                {
                    Funcionario  funcionario  = new Funcionario();
                    Criptografia criptografia = new Criptografia();
                    funcionario.Email = txtUsuario.Text;
                    string cifra = criptografia.Cifrar(txtSenha.Text);
                    funcionario.Senha = criptografia.Cifrar(txtSenha.Text);

                    if (new BLL.FuncionarioBLL().isNull(funcionario))
                    {
                        MessageBox.Show("O login foi realizado com sucesso.");

                        this.Name = "form";
                        Form form = this;
                        form.Hide();
                        frmBase frm = new frmBase();
                        frm.ShowDialog();
                        this.Visible = true;
                    }
                    else
                    {
                        MessageBox.Show("Erro! Verifique o seu email e senha.");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Erro. " + ex.Message);
                }
            }
        }
Пример #7
0
        //public int DesignerInstanceID;

        public void LoadForm(Type FormToLoad)
        {
            //If the requested class is neither frmBase or a subclass, then don't load it.
            //TODO: Work out this logic

            /*
             * if (FormToLoad.GetType() != typeof (frmBase) |  FormToLoad.IsSubclassOf(typeof (frmBase)) == false)
             * {
             *  //TODO: Error out
             *  return;
             * }
             */


            this.PropertyPanel.Canvas = this;
            this.CurrentContainer     = (IWidgetContainer)this;

            //Load the Designer class
            this.DesignerType  = FormToLoad;
            this.DesignerClass = (frmBase)ScriptableObject.CreateInstance(FormToLoad);
            this.DesignerClass.EventsEnabled = false;
            this.DesignerClass.hideFlags     = HideFlags.HideAndDontSave;
            //this.DesignerInstanceID = this.DesignerClass.GetInstanceID();

            //Cross connect the Canvas componnts to the desinger class
            this.Children       = this.DesignerClass.Children;
            this.ToolBox.Canvas = this;
            this.ToolBox.HierarchyContainer.ObjectID = this.ObjectID;

            //Hacky way of tricking the property panel to switch to the form settings views.
            //TODO: Work out how to do this properly
            //this.PropertyPanel.Canvas_CanvasActiveControlChanged(new UEditorWidgetBase(eWidgetType.Generic) { Name = "__widgetDesignerRoot" });
            this.PropertyPanel.CanvasBindings();

            this.ToolBox.Show();
            this.PropertyPanel.Show();
        }
Пример #8
0
        private void addGiaoDan(frmBase frm)
        {
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.DataReturn != null)
                {
                    DataTable tbl = (DataTable)gxBiTichChiTiet1.DataSource;
                    if (tbl != null)
                    {
                        DataRow newRow = null;
                        if (frm is frmGiaoDan)
                        {
                            DataTable tblTmp = Memory.GetData(SqlConstants.SELECT_GIAODAN_LIST_CO_GIAOHO + " AND DaXoa=0 AND DaChuyenXu=0 AND MaGiaoDan = " + frm.DataReturn[GiaoDanConst.MaGiaoDan].ToString());
                            if (!Memory.ShowError() && tblTmp != null)
                            {
                                newRow = tblTmp.Rows[0];
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            newRow = frm.DataReturn;
                        }
                        //Check existance start
                        //Check in current list
                        DataRow[] rowsCheck = tbl.Select(string.Format("MaGiaoDan={0}", newRow[GiaoDanConst.MaGiaoDan]));
                        if (rowsCheck != null && rowsCheck.Length > 0)
                        {
                            MessageBox.Show("Đã tồn tại giáo dân này trong danh sách. Vui lòng nhập giáo dân khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        //check in database in other DotBiTich
                        DataTable tblCheck = Memory.GetData(string.Format(SqlConstants.SELECT_BITICH_CHITIET_THEOLOAI + " AND MaGiaoDan={0} AND LoaiBiTich={1}", newRow[GiaoDanConst.MaGiaoDan], (int)loaiBiTich));
                        if (Memory.ShowError())
                        {
                            return;
                        }
                        if (tblCheck != null && tblCheck.Rows.Count > 0)
                        {
                            MessageBox.Show("Đã tồn tại giáo dân này trong đợt bí tích " + gxBiTichChiTiet1.TenBiTich + " khác. Vui lòng nhập giáo dân khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        //Check existance end

                        newRow.Table.Columns.Add(GiaDinhConst.MaGiaDinh, typeof(int));
                        newRow.Table.Columns.Add(GiaDinhConst.MaGiaDinhCo, typeof(int));
                        newRow.Table.Columns.Add(GiaDinhConst.TenGiaDinh, typeof(string));
                        DataTable tblConCai = Memory.GetData(SqlConstants.SELECT_THANHVIEN_GIADINH_LIST + " AND MaGiaoDan=? AND VaiTro = ?", new object[] { newRow[GiaoDanConst.MaGiaoDan], GxConstants.VAITRO_CON });
                        if (!Memory.ShowError() && tblConCai != null)
                        {
                            if (tblConCai.Rows.Count > 0)
                            {
                                newRow[GiaDinhConst.MaGiaDinh]  = newRow[GiaDinhConst.MaGiaDinhCo] = tblConCai.Rows[0][ThanhVienGiaDinhConst.MaGiaDinh];
                                newRow[GiaDinhConst.TenGiaDinh] = tblConCai.Rows[0][GiaDinhConst.TenGiaDinh];
                            }
                            tbl.ImportRow(newRow);
                        }
                    }
                }
            }
        }
Пример #9
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmLoadDicHq)child;
 }
Пример #10
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmSbFirstPageUp)child;
 }
Пример #11
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmContagionEdit)child;
 }
Пример #12
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmOutpatientInterview)child;
 }
Пример #13
0
        private bool addGiaoDan(frmBase frm, bool isAdd)
        {
cont:
            if (frm is frmGiaoDan)
            {
                ((frmGiaoDan)frm).FromGiaDinhForm = true;
            }
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.DataReturn != null)
                {
                    DataTable tbl = (DataTable)gxHocSinhList1.DataSource;
                    if (tbl != null)
                    {
                        int maGiaoDan = (int)frm.DataReturn[GiaoDanConst.MaGiaoDan];


                        //check ton tai trong danh sac
                        DataRow[] rows = tbl.Select("MaGiaoDan=" + maGiaoDan.ToString());
                        if (rows != null && rows.Length > 0)
                        {
                            MessageBox.Show("Giáo dân này đã tồn tại trong danh sách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }

                        //check da thuoc ve lop giao ly nao chua
                        DataTable tblCheck = Memory.GetData("select * from ChiTietLopGiaoLy where MaGiaoDan = ? and MaLop in (select MaLop from LopGiaoLy where MaKhoi = ?)", new object[] { maGiaoDan, idKhoi });
                        if (Memory.ShowError())
                        {
                            return(false);
                        }
                        if (tblCheck != null && tblCheck.Rows.Count > 0)
                        {
                            //string tenGiaDinh = tblCheck.Rows[0][GiaDinhConst.TenGiaDinh].ToString();
                            MessageBox.Show("Giáo dân này đã thuộc về lớp khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }

                        frm.DataReturn.AcceptChanges();
                        frm.DataReturn.SetAdded();
                        frm.DataReturn.Table.Columns.Add("HoanThanh", System.Type.GetType("System.Boolean"));
                        frm.DataReturn.Table.Columns.Add("GhiChuGLy", System.Type.GetType("System.String"));
                        frm.DataReturn.Table.Columns.Add("SoThuTu", System.Type.GetType("System.Int32"));
                        frm.DataReturn["HoanThanh"] = false;
                        frm.DataReturn["GhiChuGLy"] = "";
                        frm.DataReturn["SoThuTu"]   = getNextSoThuTu();
                        tbl.ImportRow(frm.DataReturn);
                        //DataRow drHS = tblHocSinh.NewRow();
                        //drHS["MaLop"] = id;
                        //drHS["MaGiaoDan"] = maGiaoDan;
                        //drHS["SoThuTu"] = frm.DataReturn["SoThuTu"];
                        //drHS["HoanThanh"] = false;
                        //drHS["GhiChuGLy"] = "";
                        //tblHocSinh.Rows.Add(drHS);
                        gxHocSinhList1.Row = gxHocSinhList1.RowCount - 1;

                        if (isAdd)
                        {
                            frm = new frmGiaoDan();
                            goto cont;
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Пример #14
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmZrbbgAdvers)child;
 }
Пример #15
0
        private bool addGiaoDan(frmBase frm, bool isAdd)
        {
cont:
            if (frm is frmGiaoDan)
            {
                ((frmGiaoDan)frm).MaGiaoHo        = MaGiaoHo;
                ((frmGiaoDan)frm).FromGiaDinhForm = true;
            }
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.DataReturn != null)
                {
                    DataTable tbl = (DataTable)gxGiaoDanList1.DataSource;
                    if (tbl != null)
                    {
                        int maGiaoDan = (int)frm.DataReturn[GiaoDanConst.MaGiaoDan];
                        if (maGiaoDan == txtNguoiChong.MaGiaoDan || maGiaoDan == txtNguoiVo.MaGiaoDan)
                        {
                            MessageBox.Show("Giáo dân này đã có trong gia đình", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }

                        //check ton tai trong danh sac
                        DataRow[] rows = tbl.Select("MaGiaoDan=" + maGiaoDan.ToString());
                        if (rows != null && rows.Length > 0)
                        {
                            MessageBox.Show("Giáo dân này đã tồn tại trong danh sách thành viên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }

                        //check da thuoc gia dinh nao chua
                        DataTable tblCheck = Memory.GetData(SqlConstants.SELECT_THANHVIEN_GIADINH_LIST + " AND MaGiaoDan = ? AND VaiTro>1", new object[] { maGiaoDan });
                        if (Memory.ShowError())
                        {
                            return(false);
                        }
                        if (tblCheck != null && tblCheck.Rows.Count > 0)
                        {
                            string tenGiaDinh = tblCheck.Rows[0][GiaDinhConst.TenGiaDinh].ToString();
                            MessageBox.Show("Giáo dân này đã thuộc về gia đình [" + tenGiaDinh + "].\r\nBạn có thể sử dụng chức năng [tìm gia đình của giáo dân] để biết giáo dân này đã thuộc về những gia đình nào.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }

                        frm.DataReturn.Table.Columns.Add(GiaDinhConst.MaGiaDinh, typeof(int));
                        frm.DataReturn.Table.Columns.Add(ThanhVienGiaDinhConst.VaiTro, typeof(int));
                        frm.DataReturn[ThanhVienGiaDinhConst.VaiTro] = 2;
                        frm.DataReturn.AcceptChanges();
                        frm.DataReturn.SetAdded();
                        tbl.ImportRow(frm.DataReturn);

                        gxGiaoDanList1.Row = gxGiaoDanList1.RowCount - 1;
                        if (Memory.IsRedGiaoDan(frm.DataReturn))
                        {
                            gxGiaoDanList1.CurrentRow.RowStyle = new GridEXFormatStyle();
                            gxGiaoDanList1.CurrentRow.RowStyle.FontStrikeout = TriState.True;
                            gxGiaoDanList1.CurrentRow.RowStyle.ForeColor     = Color.Red;
                        }

                        if (isAdd)
                        {
                            frm = new frmGiaoDan();
                            goto cont;
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Пример #16
0
        private void frmBaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var f = new frmBase();

            f.Show();
        }
Пример #17
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmInterviewEdit)child;
 }
Пример #18
0
        private bool addGiaoLyVien(frmBase frm, bool isAdd)
        {
cont:
            if (frm is frmGiaoDan)
            {
                ((frmGiaoDan)frm).FromGiaDinhForm = true;
            }
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.DataReturn != null)
                {
                    DataTable tbl = (DataTable)gxGiaoLyVien1.DataSource;
                    if (tbl != null)
                    {
                        int maGiaoDan = (int)frm.DataReturn[GiaoDanConst.MaGiaoDan];


                        //check ton tai trong danh sac
                        DataRow[] rows = tbl.Select("MaGiaoDan=" + maGiaoDan.ToString());
                        if (rows != null && rows.Length > 0)
                        {
                            MessageBox.Show("Giáo lý viên này đã tồn tại trong danh sách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }

                        //frm.DataReturn.AcceptChanges();
                        //frm.DataReturn.SetAdded();
                        tbl.ImportRow(frm.DataReturn);
                        DataRow drGLV = tblGiaoLyVien.NewRow();
                        if (operation == GxOperation.ADD)
                        {
                            drGLV["MaLop"] = Memory.Instance.GetNextId("LopGiaoLy", "malop", true);
                        }
                        else
                        {
                            drGLV["MaLop"] = id;
                        }

                        drGLV["MaGiaoDan"] = maGiaoDan;
                        tblGiaoLyVien.Rows.Add(drGLV);
                        gxGiaoLyVien1.Row = gxGiaoLyVien1.RowCount - 1;

                        if (isAdd)
                        {
                            frm = new frmGiaoDan();
                            goto cont;
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Пример #19
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmPatient)child;
 }
Пример #20
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmSbMzcfxmdr)child;
 }
Пример #21
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmZyrbgkEdit)child;
 }
Пример #22
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmRole)child;
 }
Пример #23
0
 //Public constuctor
 public UFormCodeGen(frmBase Form)
 {
     _form = Form;
 }
Пример #24
0
 /// <summary>
 /// SetUI
 /// </summary>
 /// <param name="child"></param>
 public override void SetUI(frmBase child)
 {
     base.SetUI(child);
     Viewer = (frmAdverseEvent)child;
 }