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; } }
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; // } //} }
private void SetConnection(DbCommand cmd, OpenReason reason) { DbConnection conn = this.Connection; if (conn.State == ConnectionState.Closed) { try { conn.Open(); } catch (OracleDataStoreException ex) { //OracleExceptionEx oex = new OracleExceptionEx(string.Empty, ex); if (ex.OracleErrorNumber == 28150) { DbConnectionStringBuilder builder = new DbConnectionStringBuilder(); builder.ConnectionString = conn.ConnectionString; string msg = string.Format("User {0} is not authorized to connect on behalf of {1}", builder["Proxy User ID"], builder["User ID"]); throw new Exception(msg, ex); } else { throw; } } } if (string.IsNullOrEmpty(_owner.SysContext.ModuleName)) { if (_owner.Page == null) { throw new HttpException("When OracleDataSource is used outside a page, ModuleName must be specified"); } _owner.SysContext.ModuleName = string.IsNullOrEmpty(_owner.Page.Title) ? _context.Request.AppRelativeCurrentExecutionFilePath : _owner.Page.Title; } if (string.IsNullOrEmpty(_owner.SysContext.Action)) { _owner.SysContext.Action = string.Format("OracleDataSource ID: {0}; {1}", _owner.ID, reason); } if (this._context != null) { // _context is null when background thread are firing query such as FireAndForget in ProfileHelperBase // We set the user's IP address in client info. The info set by the page developer is being deliberately // ignored. The philosophy of this control is that we always want the IP address. if (this._context.Request.UserHostName == _context.Request.UserHostAddress) { _owner.SysContext.ClientInfo = string.Format("{0}@{1}", this._context.User.Identity.Name, this._context.Request.UserHostName); } else { _owner.SysContext.ClientInfo = string.Format("{0}:{1}", this._context.Request.UserHostName, _context.Request.UserHostAddress); } } if (_needTransaction) { _transaction = conn.BeginTransaction(); _needTransaction = false; } using (DbCommand cmdContext = conn.CreateCommand()) { cmdContext.Transaction = _transaction; _owner.SysContext.SetDatabaseContext(cmdContext, _context, _owner); } cmd.Connection = conn; cmd.Transaction = _transaction; // Special handling for ODP.NET. Force bind by name. Default is stupidly bind by position if (cmd.GetType().FullName == "Oracle.DataAccess.Client.OracleCommand") { dynamic odp = cmd; odp.BindByName = true; odp.InitialLONGFetchSize = 1024; // Retrieve first 1K chars from a long column } }