protected void AuditHeaderDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (Session["CurrVendorAuditProcessId"] == null)
         e.Cancel = true;
     else
         e.Command.Parameters["@ProcessId"].Value = Session["CurrVendorAuditProcessId"].ToString();
 }
Exemplo n.º 2
0
 protected void GridView1_OnSelecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     int id;
     int.TryParse(Request["id"], out id);
     if (id < 1) id=0;
     e.Command.Parameters["@contestId"].Value = id.ToString(CultureInfo.InvariantCulture);
 }
 protected void AuditHeaderDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (Pid.Text == string.Empty)
         e.Cancel = true;
     else
         e.Command.Parameters["@ProcessId"].Value = Pid.Text;
 }
 protected void AuditTrailDetailDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (Session["CurrOrgAuditNumber"] == null)
         e.Cancel = true;
     else
         e.Command.Parameters["@ProcessId"].Value = Session["CurrOrgAuditNumber"].ToString();
 }
Exemplo n.º 5
0
		protected internal override IEnumerable ExecuteSelect (
						DataSourceSelectArguments arguments)
		{
			oleCommand = new OleDbCommand (this.SelectCommand, oleConnection);
			SqlDataSourceSelectingEventArgs cmdEventArgs = new SqlDataSourceSelectingEventArgs (oleCommand, arguments);
			OnSelecting (cmdEventArgs);
			IEnumerable enums = null; 
			Exception exception = null;
			OleDbDataReader reader = null;
			try {
				System.IO.File.OpenRead (dataSource.DataFile).Close ();
				oleConnection.Open ();
				reader = (OleDbDataReader)oleCommand.ExecuteReader ();
			
				//enums = reader.GetEnumerator ();
				throw new NotImplementedException("OleDbDataReader doesnt implements GetEnumerator method yet");
			} catch (Exception e) {
				exception = e;
			}
			SqlDataSourceStatusEventArgs statusEventArgs = 
				new SqlDataSourceStatusEventArgs (oleCommand, reader.RecordsAffected, exception);
			OnSelected (statusEventArgs);
			if (exception !=null)
				throw exception;
			return enums;			
		}						
 protected void AuditMasterDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (AuditTrailType.Text == "")
         e.Cancel = true;
     else
         e.Command.Parameters["@Type"].Value = Convert.ToInt32(AuditTrailType.Text);
 }
 protected void SysGrpDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (UserGroupId.Text == "")
         e.Command.Parameters["@UserGroupId"].Value = DBNull.Value;
     else
         e.Command.Parameters["@UserGroupId"].Value = Convert.ToInt32(UserGroupId.Text);
 }
 protected void WorkFlowDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (AliranKerja_ProcessId.Text == "")
         e.Cancel = true;
     else
         e.Command.Parameters["@LKH_ProcessId"].Value = AliranKerja_ProcessId.Text;
 }
 protected void WorkFlowDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     //if (Wf_ProcessId.Text == "")
     //    e.Cancel = true;
     //else
     //    e.Command.Parameters["@PRH_ProcessId_ProcessId"].Value = Wf_ProcessId.Text;
 }
Exemplo n.º 10
0
 protected void WorkFlowDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (PEM_WFD_PEMH_RowId.Text == "")
         e.Cancel = true;
     else
         e.Command.Parameters["@PEM_WFD_PEMH_RowId"].Value = Convert.ToInt32(PEM_WFD_PEMH_RowId.Text);
 }
 protected void CatDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (PRI_PurchaseType.SelectedIndex == -1)
         e.Command.Parameters["@PurchaseType"].Value = DBNull.Value;
     else
         e.Command.Parameters["@PurchaseType"].Value = Convert.ToInt32(PRI_PurchaseType.Value);
 }
Exemplo n.º 12
0
        protected void dbWorkers_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            //get user id
            MembershipUser usr = Membership.GetUser();
            Guid uid = (Guid)usr.ProviderUserKey;

            e.Command.Parameters["@UserId"].Value = uid;
        }
 protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (!((BasePage)this.Page).UserRole.Equals("Administrator"))
     {
         e.Cancel = true;
         this.GridView1.Visible = false;
     }
 }
Exemplo n.º 14
0
        protected void SliderDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            string UploadLocation = ConfigurationManager.AppSettings["ImageUploadFolder"].ToString();
            string FileFullPath = Path.Combine(Server.MapPath(UploadLocation), string.Empty);

            e.Command.Parameters["@ProcessId"].Value = AK_ProcessId.Text;
            e.Command.Parameters["@PhysicalPath"].Value = ConfigurationManager.AppSettings["ImageUploadFolder"].ToString();
        }
Exemplo n.º 15
0
        protected void uxJobSql_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            //get user id
            MembershipUser usr = Membership.GetUser();
            Guid uid = (Guid)usr.ProviderUserKey;

            //uxWorkerSql.SelectParameters.Add("@UserId", uid.ToString());
            e.Command.Parameters["@UserId"].Value = uid;
        }
Exemplo n.º 16
0
        protected void WithdrawListDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            e.Command.Parameters["@PPD_ProcessId"].Value = txtWithdrawProcessId.Text;

            if (txtWithdrawRev.Text != "")
                e.Command.Parameters["@PPD_Revision"].Value = Convert.ToInt32(txtWithdrawRev.Text);
            else
                e.Command.Parameters["@PPD_Revision"].Value = 0;
        }
Exemplo n.º 17
0
        protected void dbScheduleSelect_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            //get logged in user id
            MembershipUser usr = Membership.GetUser();
            Guid uid = (Guid)usr.ProviderUserKey;

            //set the UserId parameter to current user for DB select
            e.Command.Parameters["@UserId"].Value = uid;
        }
Exemplo n.º 18
0
        protected void ReturnDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            e.Command.Parameters["@PPD_ProcessId"].Value = RetProcessId.Text;

            if (RetRevision.Text != "")
                e.Command.Parameters["@PPD_Revision"].Value = Convert.ToInt32(RetRevision.Text);
            else
                e.Command.Parameters["@PPD_Revision"].Value = 0;
        }
        protected void sdsCreditSalesDateRange_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            //DateTime ukBeginDateTime = DateTime.Parse(txtBeginDate.Text, System.Globalization.CultureInfo.GetCultureInfo("en-gb"));
            //DateTime ukEndDateTime = DateTime.Parse(txtEndDate.Text, System.Globalization.CultureInfo.GetCultureInfo("en-gb"));

            //txtBeginDate.Text = (ukBeginDateTime).ToString("YYYY-MM-DD");

            //txtEndDate.Text = (ukEndDateTime).ToString("YYYY-MM-DD");
        }
Exemplo n.º 20
0
 protected void MarksSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (cbxTerms.SelectedIndex == -1 || cbxTerms.SelectedValue == "0")
     {
         e.Command.Parameters["@TermMin"].Value = byte.MinValue;
         e.Command.Parameters["@TermMax"].Value = byte.MaxValue;
     }
     else e.Command.Parameters["@TermMin"].Value = e.Command.Parameters["@TermMax"].Value = byte.Parse(cbxTerms.SelectedValue);
 }
Exemplo n.º 21
0
 protected void PenempatanDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (PenempatanParentType.Text == "" || PenempatanParentUniqueId.Text == "")
         e.Cancel = true;
     else
     {
         e.Command.Parameters["@ParentType"].Value = PenempatanParentType.Text;
         e.Command.Parameters["@ParentId"].Value = PenempatanParentUniqueId.Text;
     }
 }
Exemplo n.º 22
0
        protected void SearchDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
            FormsAuthenticationTicket ticket = id.Ticket;

            if (!ticket.Expired)
            { e.Command.Parameters["@CurrUser"].Value = Convert.ToInt32(ticket.Name); }
            else
                e.Cancel = true;
        }
 protected void AuditTrailDetailDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (AuditTrailType.Text == "")
         e.Cancel = true;
     else
     {
         e.Command.Parameters["@Type"].Value = Convert.ToInt32(AuditTrailType.Text);
         e.Command.Parameters["@ProcessId"].Value = AuditTrailProcessId.Text;
     }
 }
Exemplo n.º 24
0
 protected void dsrcFormalReport1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     try
     {
         e.Command.CommandTimeout = 5000;
     }
     catch (Exception ex)
     {
         MarafonHelper.HandleError(this, ex);
     }
 }
 protected void GrnItemsDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (Senarai_ProcessId.Text == "" || Senarai_Revision.Text == "" || Senarai_PrNumber.Text == "")
         e.Cancel = true;
     else
     {
         e.Command.Parameters["@ProcessId"].Value = Senarai_ProcessId.Text;
         e.Command.Parameters["@Revision"].Value = Convert.ToInt32(Senarai_Revision.Text);
         e.Command.Parameters["@PrNumber"].Value = Senarai_PrNumber.Text;
     }
 }
        protected void UserProfileDataSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            // Get a reference to the currently logged on user
            System.Web.Security.MembershipUser currentUser = System.Web.Security.Membership.GetUser();

            // Determine the currently logged on user's UserId value
            Guid currentUserId = (Guid)currentUser.ProviderUserKey;

            // Assign the currently logged on user's UserId to the @UserId parameter
            e.Command.Parameters["@UserId"].Value = currentUserId;
        }
Exemplo n.º 27
0
        protected void Appointments_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            if (Calendar1.SelectedDate.Date.Year != 1)
                                    {
                                                DateTime StartTime = Calendar1.SelectedDate.Date.Add(new TimeSpan(0, 0, 0));
                                                DateTime EndTime = Calendar1.SelectedDate.Date.Add(new TimeSpan(23, 59, 59));

                                                e.Command.Parameters["@StartDate"].Value = StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                                                e.Command.Parameters["@EndDate"].Value = EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                                    }
        }
 protected void ParentDs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if (PRI_PurchaseType.SelectedIndex == -1)
         e.Cancel = true;
     else
     {
         if (Convert.ToInt32(PRI_PurchaseType.Value) == 1)
             e.Cancel = true;
         else if(Convert.ToInt32(PRI_PurchaseType.Value) == 2 || Convert.ToInt32(PRI_PurchaseType.Value) == 3 || Convert.ToInt32(PRI_PurchaseType.Value) == 4 || Convert.ToInt32(PRI_PurchaseType.Value) == 5)
             e.Command.Parameters["@PurchaseType"].Value = Convert.ToInt32(PRI_PurchaseType.Value);
     }
 }
 protected void userAddedOptions_sourceEmployees_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
 {
     if ((string)e.Command.Parameters["@City"].Value == "(Choose a City)")
       {
     // don't do any thing
     e.Cancel = true;
       }
       else if ((string)e.Command.Parameters["@City"].Value == "(All Cities)")
       {
     e.Command.CommandText = "SELECT * FROM Employees";
       }
 }
Exemplo n.º 30
0
        protected void SqlDSTranslations_OnSelecting(object sender, System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs e)
        {
            e.Command.Connection.ConnectionString = Generic.cGeneric.GetConnectionString();

            if (!string.IsNullOrWhiteSpace(hfRequestsID.Value))
            {
                e.Command.Parameters["@RequestsID"].Value = int.Parse(hfRequestsID.Value);
            }
            else
            {
                e.Command.Parameters["@RequestsID"].Value = 81;
            }
        }
Exemplo n.º 31
0
        protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            User user = Session["UserObj"] == null ? new User() : (User)Session["UserObj"];

            if ((user.Rol.ID) != (int)Role.TipoRoles.Excavador)
            {
                e.Command.CommandText = e.Command.CommandText.Replace("@Where", string.Empty);
            }

            else
            {
                e.Command.CommandText = e.Command.CommandText.Replace("@Where", string.Format("WHERE UsuarioID = '{0}' ", user.Email));
            }
        }
Exemplo n.º 32
0
 protected void SqlDataSource3_Selecting(object sender, System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs e)
 {
     e.Command.Parameters[0].Value = RadComboBox1.SelectedValue.ToString();
 }
Exemplo n.º 33
0
        protected internal override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            if (SortParameterName.Length > 0 && SelectCommandType == SqlDataSourceCommandType.Text)
            {
                throw new NotSupportedException("The SortParameterName property is only supported with stored procedure commands in SqlDataSource");
            }

            if (arguments.SortExpression.Length > 0 && owner.DataSourceMode == SqlDataSourceMode.DataReader)
            {
                throw new NotSupportedException("SqlDataSource cannot sort. Set DataSourceMode to DataSet to enable sorting.");
            }

            if (arguments.StartRowIndex > 0 || arguments.MaximumRows > 0)
            {
                throw new NotSupportedException("SqlDataSource does not have paging enabled. Set the DataSourceMode to DataSet to enable paging.");
            }

            if (FilterExpression.Length > 0 && owner.DataSourceMode == SqlDataSourceMode.DataReader)
            {
                throw new NotSupportedException("SqlDataSource only supports filtering when the data source's DataSourceMode is set to DataSet.");
            }

            InitConnection();

            DbCommand command = factory.CreateCommand();

            command.CommandText = SelectCommand;
            command.Connection  = connection;
            if (SelectCommandType == SqlDataSourceCommandType.Text)
            {
                command.CommandType = CommandType.Text;
            }
            else
            {
                command.CommandType = CommandType.StoredProcedure;
                if (SortParameterName.Length > 0 && arguments.SortExpression.Length > 0)
                {
                    command.Parameters.Add(CreateDbParameter(SortParameterName, arguments.SortExpression));
                }
            }

            if (SelectParameters.Count > 0)
            {
                InitializeParameters(command, SelectParameters, null, null, false);
            }

            Exception exception = null;

            if (owner.DataSourceMode == SqlDataSourceMode.DataSet)
            {
                DataView dataView = null;

                if (owner.EnableCaching)
                {
                    dataView = (DataView)owner.Cache.GetCachedObject(SelectCommand, SelectParameters);
                }

                if (dataView == null)
                {
                    SqlDataSourceSelectingEventArgs selectingArgs = new SqlDataSourceSelectingEventArgs(command, arguments);
                    OnSelecting(selectingArgs);
                    if (selectingArgs.Cancel || !PrepareNullParameters(command, CancelSelectOnNullParameter))
                    {
                        return(null);
                    }
                    try {
                        DbDataAdapter adapter = factory.CreateDataAdapter();
                        DataSet       dataset = new DataSet();

                        adapter.SelectCommand = command;
                        adapter.Fill(dataset, name);

                        dataView = dataset.Tables [0].DefaultView;
                        if (dataView == null)
                        {
                            throw new InvalidOperationException();
                        }
                    }
                    catch (Exception e) {
                        exception = e;
                    }
                    int rowsAffected = (dataView == null) ? 0 : dataView.Count;
                    SqlDataSourceStatusEventArgs selectedArgs = new SqlDataSourceStatusEventArgs(command, rowsAffected, exception);
                    OnSelected(selectedArgs);

                    if (exception != null && !selectedArgs.ExceptionHandled)
                    {
                        throw exception;
                    }

                    if (owner.EnableCaching)
                    {
                        owner.Cache.SetCachedObject(SelectCommand, selectParameters, dataView);
                    }
                }

                if (SortParameterName.Length == 0 || SelectCommandType == SqlDataSourceCommandType.Text)
                {
                    dataView.Sort = arguments.SortExpression;
                }

                if (FilterExpression.Length > 0)
                {
                    IOrderedDictionary fparams            = FilterParameters.GetValues(context, owner);
                    SqlDataSourceFilteringEventArgs fargs = new SqlDataSourceFilteringEventArgs(fparams);
                    OnFiltering(fargs);
                    if (!fargs.Cancel)
                    {
                        object [] formatValues = new object [fparams.Count];
                        for (int n = 0; n < formatValues.Length; n++)
                        {
                            formatValues [n] = fparams [n];
                            if (formatValues [n] == null)
                            {
                                return(dataView);
                            }
                        }
                        dataView.RowFilter = string.Format(FilterExpression, formatValues);
                    }
                }

                return(dataView);
            }
            else
            {
                SqlDataSourceSelectingEventArgs selectingArgs = new SqlDataSourceSelectingEventArgs(command, arguments);
                OnSelecting(selectingArgs);
                if (selectingArgs.Cancel || !PrepareNullParameters(command, CancelSelectOnNullParameter))
                {
                    return(null);
                }

                DbDataReader reader = null;
                bool         closed = connection.State == ConnectionState.Closed;

                if (closed)
                {
                    connection.Open();
                }
                try {
                    reader = command.ExecuteReader(closed ? CommandBehavior.CloseConnection : CommandBehavior.Default);
                }
                catch (Exception e) {
                    exception = e;
                }
                SqlDataSourceStatusEventArgs selectedArgs =
                    new SqlDataSourceStatusEventArgs(command, reader.RecordsAffected, exception);
                OnSelected(selectedArgs);
                if (exception != null && !selectedArgs.ExceptionHandled)
                {
                    throw exception;
                }

                return(reader);
            }
        }
Exemplo n.º 34
0
 public void SqlDataSource1_Selecting(object sender, System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs e)
 {
 }