public TBLWarasaDlg(DataSources.dsRetirementCenter.TBLWarasaDataTable TBLWarasa, DataSources.dsRetirementCenter.TBLNoSarfWarsaDataTable TBLNoSarfWarsa
            , DataSources.dsRetirementCenter.tblvisawarsaactiveDataTable tblvisawarsaactive, 
            DataSources.dsRetirementCenter.TBLEdafatWarsaDataTable TBLEdafatWarsa, OpenReason openReason)
        {
            InitializeComponent();

            LSMSCDWarasaType.QueryableSource = new DataSources.Linq.dsTeachersUnionViewsDataContext().CDWarasaTypes;
            LSMSCDMashHala.QueryableSource = dsLinq.CDMashHalas;
            LSMSTBLDofatSarf.QueryableSource = dsLinq.TBLDofatSarfs;
            LSMSTBLDofatSarf2.QueryableSource = from q in dsLinq.TBLDofatSarfs where q.resarfd == true select q;
            LSMSCdDofaatAmanat.QueryableSource = dsLinq.CdDofaatAmanats;
            LSMSCDSyndicate.QueryableSource = dsLinq.CDSyndicates;
            LSMSCDSubCommitte.QueryableSource = dsLinq.CDSubCommittes;
            LSMSCDnationalty.QueryableSource = dsLinq.CDnationalties;
            LSMSsarfresonid.QueryableSource = dsLinq.cd_sarfresons;
            LSMSUsers.QueryableSource = dsLinq.Users;
            LSMSTBLWarasa.QueryableSource =

            LSMSTBLWarasa.QueryableSource = from q in dsLinq.vTBLWarasas where q.MMashatId == TBLWarasa[0].MMashatId select q;
            _TBLWarasa = TBLWarasa;
            _TBLNoSarfWarsa = TBLNoSarfWarsa;
            _tblvisawarsaactive = tblvisawarsaactive;
            _TBLEdafatWarsa = TBLEdafatWarsa;

            switch (openReason)
            {
                case  OpenReason.Remark:
                    gcCommands.Visible = false;
                    tabMain.PageVisible = false;
                    tabExtra.PageVisible = false;
                    tabSarfExpetion.PageVisible = false;
                    tabResarf.PageVisible = false;

                    ReloadRemark();
                    return;
                case OpenReason.Edit:
                    tabRemark.PageVisible = false;
                    break;
            }
            if (TBLWarasa[0].PersonId == -1)
            {
                xtraTabPageTBLWarasaMadunea.PageVisible = false;
            }

            tbpersonName.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personName", true));
            lueWarasaTypeId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "WarasaTypeId", true));
            luenationaltyId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "nationaltyId", true));
            tbpersonNID.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personNID", true));
            depersonbirth.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personbirth", true));
            tbpersonmobile.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personmobile", true));
            tbpersonAddres.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personAddres", true));
            ceyasref.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "yasref", true));
            LUESyndicateId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "SyndicateId", true));
            LUESubCommitteId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "SubCommitteId", true));
            ceresponsiblesarf.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "responsiblesarf", true));
            LUEresponsiblesarfId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "responsiblesarfId", true));
            tbvisa.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "visa", true));
            ceActivate.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "Activate", true));
            luesarfresonid.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "sarfresonid", true));
            tbCode60.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "code60", true));

            cewcompletesarf.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "wcompletesarf", true));
            tbwmony.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "wmony", true));
            tbwestktaat.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "westktaat", true));
            tbwelrasm.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "welrasm", true));

            luesarfTypeId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "sarfTypeId", true));
            tbestktaa.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "estktaa", true));
            lueDofatSarfId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "DofatSarfId", true));
            dedatesarf.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "datesarf", true));

            //edit visa for admin only
            tbvisa.Visible = lblvisa .Visible = Program.UserInfo.IsAdmin;
            ceActivate.Visible = lblActivate.Visible = Program.UserInfo.IsAdmin;
            tbCode60.Visible = tbCode60.Visible = Program.UserInfo.IsAdmin;

            if (_TBLEdafatWarsa.Count > 0)
                ceEnableEdafat.Checked = true;

            if (_TBLWarasa[0].RowState == DataRowState.Added)
            {
                tabResarf.PageVisible = false;
                tabSarfExpetion.PageVisible = false;
            }
            else
            {
                this.tBLReSarfWarasaTableAdapter.FillBy(this.dsRetirementCenter.TBLReSarfWarasa, _TBLWarasa[0].PersonId);
                if ((bool)SQLProvider.adpQry.TBLMashat_GetSarfExpetion(_TBLWarasa[0].MMashatId))
                    this.tBLSarfExpetionTableAdapter.FillByPersonId(this.dsRetirementCenter.TBLSarfExpetion, _TBLWarasa[0].PersonId);
                else
                    tabSarfExpetion.PageVisible = false;
            }

            if (TBLWarasa[0].yasref == false && (TBLWarasa[0].IspersonNIDNull() || TBLWarasa[0].personNID.ToString() == string.Empty))
            {
                ceyasref.Enabled = false;
            }

            //if (ceyasref.Checked)
            //{
            //    DataSources.dsQueriesTableAdapters.QueriesTableAdapter adpQ = new DataSources.dsQueriesTableAdapters.QueriesTableAdapter();
            //    if (adpQ.ResponsibleCount(_TBLWarasa[0].PersonId) > 0)
            //    {
            //        ceyasref.Enabled = false;
            //        ceyasref.Text = "تم منع التعديل نظرا لان هذا الوريث مسئول عن ورثة اخرين";
            //        ceyasref.ForeColor = Color.Red;
            //    }
            //}
        }
Ejemplo n.º 2
0
        public TBLWarasaDlg(DataSources.dsRetirementCenter.TBLWarasaDataTable TBLWarasa, DataSources.dsRetirementCenter.TBLNoSarfWarsaDataTable TBLNoSarfWarsa,
            DataSources.dsRetirementCenter.TBLEdafatWarsaDataTable TBLEdafatWarsa, OpenReason openReason)
        {
            InitializeComponent();

            LSMSCDWarasaType.QueryableSource = new DataSources.Linq.dsTeachersUnionViewsDataContext().CDWarasaTypes;
            LSMSCDMashHala.QueryableSource = dsLinq.CDMashHalas;
            LSMSTBLDofatSarf.QueryableSource = dsLinq.TBLDofatSarfs;
            LSMSCDSyndicate.QueryableSource = dsLinq.CDSyndicates;
            LSMSCDSubCommitte.QueryableSource = dsLinq.CDSubCommittes;
            LSMSTBLWarasa.QueryableSource =

            LSMSTBLWarasa.QueryableSource = from q in dsLinq.vTBLWarasas where q.MMashatId == TBLWarasa[0].MMashatId select q;
            _TBLWarasa = TBLWarasa;
            _TBLNoSarfWarsa = TBLNoSarfWarsa;
            _TBLEdafatWarsa = TBLEdafatWarsa;

            switch (openReason)
            {
                case  OpenReason.Remark:
                    gcCommands.Visible = false;
                    tabMain.PageVisible = false;
                    tabExtra.PageVisible = false;
                    tabSarfExpetion.PageVisible = false;
                    tabResarf.PageVisible = false;
                    LSMSUsers.QueryableSource = dsLinq.Users;
                    ReloadRemark();
                    return;
                case OpenReason.Edit:
                    tabRemark.PageVisible = false;
                    break;
            }

            tbpersonName.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personName", true));
            lueWarasaTypeId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "WarasaTypeId", true));
            tbpersonNID.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personNID", true));
            depersonbirth.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personbirth", true));
            tbpersonmobile.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personmobile", true));
            tbpersonAddres.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "personAddres", true));
            ceyasref.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "yasref", true));
            LUESyndicateId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "SyndicateId", true));
            LUESubCommitteId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "SubCommitteId", true));
            ceresponsiblesarf.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "responsiblesarf", true));
            LUEresponsiblesarfId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "responsiblesarfId", true));

            cewcompletesarf.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "wcompletesarf", true));
            tbwmony.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "wmony", true));
            tbwestktaat.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "westktaat", true));
            tbwelrasm.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLWarasa, "welrasm", true));


            luesarfTypeId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "sarfTypeId", true));
            tbestktaa.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "estktaa", true));
            lueDofatSarfId.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "DofatSarfId", true));
            dedatesarf.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", _TBLEdafatWarsa, "datesarf", true));

            if (_TBLEdafatWarsa.Count > 0)
                ceEnableEdafat.Checked = true;

            if (_TBLWarasa[0].RowState == DataRowState.Added)
            {
                tabResarf.PageVisible = false;
                tabSarfExpetion.PageVisible = false;
            }
            else
            {
                this.tBLReSarfWarasaTableAdapter.FillBy(this.dsRetirementCenter.TBLReSarfWarasa, _TBLWarasa[0].PersonId);
                if ((bool)SQLProvider.adpQry.TBLMashat_GetSarfExpetion(_TBLWarasa[0].MMashatId))
                    this.tBLSarfExpetionTableAdapter.FillByPersonId(this.dsRetirementCenter.TBLSarfExpetion, _TBLWarasa[0].PersonId);
                else
                    tabSarfExpetion.PageVisible = false;
            }

        }