public void LoadFilteredDRDetails(SqlDataSource DRDetailsDataSource, int DRID_S, int DRID_E, int CustomerNumber)
        {
            StringBuilder search_command = new StringBuilder();
            search_command.Append(" SELECT DR.DRNo, DRDtl.SKU, DRDtl.StyleNo, DR.ItemStatus, DRDtl.Quantity, DRDtl.UnitPrice FROM DR INNER JOIN DRDtl ON DR.ID = DRDtl.DRID ");
            search_command.Append(" where DR.ID between @ID_S and @ID_E and custno =@Customer_Number ");
            Parameter prmDRIDS = new Parameter
            {
                 DbType = System.Data.DbType.Int32 ,
                 Name = "ID_S",
                  DefaultValue = DRID_S.ToString(),
            };

            Parameter prmDRIDE = new Parameter
            {
                DbType = System.Data.DbType.Int32,
                Name = "ID_E",
                DefaultValue = DRID_E.ToString(),
            };
            Parameter prmCustomerNumber = new Parameter
            {
                DbType = System.Data.DbType.Int32,
                Name = "Customer_Number",
                DefaultValue = CustomerNumber.ToString(),
            };
            DRDetailsDataSource.SelectParameters.Add(prmDRIDS);
            DRDetailsDataSource.SelectParameters.Add(prmDRIDE);
            DRDetailsDataSource.SelectParameters.Add(prmCustomerNumber);
            DRDetailsDataSource.SelectCommand = search_command.ToString();
            DRDetailsDataSource.DataBind();
            //       SELECT DR.DRNo, DRDtl.SKU, DRDtl.StyleNo, DR.ItemStatus, DRDtl.Quantity, DRDtl.UnitPrice FROM DR
            //INNER JOIN DRDtl ON DR.ID = DRDtl.DRID
            //where DR.ID between @IDS and @IDE and custno =@CustomerNumber
        }
        void Page_Load(object sender, EventArgs e)
        {
            if (Page.User.IsInRole("ProjectAdministrator"))
            {
                ProjectData.SortParameterName = "sortParameter";
                ProjectData.SelectMethod = "GetAllProjects";
            }
            else
            {

                bool wasFound = false;
                foreach (Parameter parameter in ProjectData.SelectParameters)
                {
                    if (parameter.Name == "userName")
                        wasFound = true;
                }
                if (!wasFound)
                {
                    Parameter param = new Parameter("userName", TypeCode.String, Page.User.Identity.Name);
                    ProjectData.SelectParameters.Add(param);
                }
                ProjectData.SortParameterName = "sortParameter";
                ProjectData.SelectMethod = "GetProjectsByManagerUserName";
            }
        }
Beispiel #3
0
        //
        // GET: /SSQL/
        public ActionResult Index()
        {
            //REPORTEREntities1 db = new REPORTEREntities1();
            //db.Connection.ConnectionString.Select(db.jobs);
            //SqlDataSource ss = new SqlDataSource();
            ////SqlDataSource1

            //string connectionString = WebConfigurationManager.ConnectionStrings["jobs"].ConnectionString;
            //SqlConnection con = new SqlConnection(connectionString);
            //    //con.DataSource(SqlDataSource1);

            //string sql = "create table test3(id int identity(1,1) primary key, SecondField varchar(10))";
            //SqlCommand cmd = new SqlCommand(sql, con);
            //con.Open();
            //cmd.ExecuteNonQuery();
            //con.Close();

            //Data Source=.\sqlexpress;Initial Catalog=REPORTER;Integrated Security=True;Pooling=False

             //SELECT dbo.jobs.Date, dbo.jobtype.JTitle, dbo.UsersRP.Login, SUM(dbo.jobs.Jtimeh) AS SumTime1, dbo.jobs.Jname
             //FROM dbo.jobs
             //INNER JOIN dbo.jobtype ON dbo.jobs.Jtid = dbo.jobtype.Jid
             //INNER JOIN dbo.UsersRP ON dbo.jobs.Uid = dbo.UsersRP.Id
             //GROUP BY dbo.jobs.Date, dbo.jobtype.JTitle, dbo.UsersRP.Login, dbo.jobs.Jname)

               System.Web.UI.WebControls.Parameter pp = new System.Web.UI.WebControls.Parameter();
               //string sss;

               //pp.Name = "Login";
               //pp.DefaultValue = sss;
               //System.Web.UI.ControlsSqlDataSource3.SelectParameters.Add(pp);

            return View();
        }
Beispiel #4
0
        protected void CreateCriteriaFromFindParameters(ActiveRecordDataSourceFindEventArgs args)
        {
            IOrderedDictionary values = FindParameters.GetValues(HttpContext.Current, Source);

            for (int i = 0; i < FindParameters.Count; i++)
            {
                Parameter parameter = FindParameters[i];

                if (parameter is NullParameter)
                {
                    NullParameter nullParameter = (NullParameter)parameter;

                    if (nullParameter.Expression == NullExpression.IsNull)
                    {
                        args.Criteria.Add(Expression.IsNull(parameter.Name));
                    }
                    else if (nullParameter.Expression == NullExpression.IsNotNull)
                    {
                        args.Criteria.Add(Expression.IsNotNull(parameter.Name));
                    }
                }
                else
                {
                    args.Criteria.Add(Expression.Eq(parameter.Name, values[i]));
                }
            }
        }
 internal static void Show(GridView ListTests, string UserName)
 {
     SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
     string str = "select d.Discipline_name, c.categories_name, t.name, ct.points, ct.dateComplite " +
         " from Complite_test as ct inner join test as t on ct.test_id = t.test_id " +
         " inner join Categories as c on c.cat_id = t.cat_id " +
         " inner join discipline as d on d.discipline_id = c.discipline_id " +
         " inner join users as u on u.user_id = ct.user_id where u.login = @login";
     SqlCommand cmd = new SqlCommand(str, con);
     cmd.Parameters.AddWithValue("login", UserName);
     try
     {
         con.Open();
         SqlDataSource ds = new SqlDataSource(con.ConnectionString, str);
         Parameter p = new Parameter("login", System.Data.DbType.String, UserName);
         ds.SelectParameters.Add(p);
         ListTests.DataSource = ds;
         ListTests.DataBind();
     }
     catch (Exception)
     {
         throw new ApplicationException("Не удается отобразить список завершенных тестов");
     }
     finally {
         con.Close();
     }
 }
 internal WebControlParameterProxy(Parameter parameter, ParameterCollection parameterCollection, EntityDataSource entityDataSource)
 {
     Debug.Assert(null != entityDataSource);
     _parameter = parameter;
     _collection = parameterCollection;
     _entityDataSource = entityDataSource;
     VerifyUniqueType(_parameter);
 }
		protected Parameter (Parameter original)
		{
			this.DefaultValue = original.DefaultValue;
			this.Direction = original.Direction;
			this.ConvertEmptyStringToNull = original.ConvertEmptyStringToNull;
			this.Type = original.Type;
			this.Name = original.Name;
		}
 private static Parameter CreateParameter(string name, string value, MetaColumn configurationColumn) {
     var param = new Parameter() {
         Name = name,
         DefaultValue = value
     };
     DataSourceUtil.SetParameterTypeCodeAndDbType(param, configurationColumn);
     return param;
 }
 internal static void SetParameterTypeCodeAndDbType(Parameter parameter, MetaColumn column) {
     // If it's a Guid, use a DbType, since TypeCode doesn't support it.  For everything else, use TypeCode
     if (column.ColumnType == typeof(Guid)) {
         parameter.DbType = DbType.Guid;
     }
     else {
         parameter.Type = column.TypeCode;
     }
 }
 public SqlDataSourceFilterClause(DesignerDataConnection designerDataConnection, DesignerDataTableBase designerDataTable, System.ComponentModel.Design.Data.DesignerDataColumn designerDataColumn, string operatorFormat, bool isBinary, string value, System.Web.UI.WebControls.Parameter parameter)
 {
     this._designerDataConnection = designerDataConnection;
     this._designerDataTable = designerDataTable;
     this._designerDataColumn = designerDataColumn;
     this._isBinary = isBinary;
     this._operatorFormat = operatorFormat;
     this._value = value;
     this._parameter = parameter;
 }
 public SqlDataSourceFilterClause(DesignerDataConnection designerDataConnection, DesignerDataTableBase designerDataTable, System.ComponentModel.Design.Data.DesignerDataColumn designerDataColumn, string operatorFormat, bool isBinary, string value, System.Web.UI.WebControls.Parameter parameter)
 {
     this._designerDataConnection = designerDataConnection;
     this._designerDataTable      = designerDataTable;
     this._designerDataColumn     = designerDataColumn;
     this._isBinary       = isBinary;
     this._operatorFormat = operatorFormat;
     this._value          = value;
     this._parameter      = parameter;
 }
Beispiel #12
0
        protected void CreateValuesFromCreateParameters(ActiveRecordDataSourceCreateEventArgs args)
        {
            IOrderedDictionary values = CreateParameters.GetValues(HttpContext.Current, Source);

            for (int i = 0; i < CreateParameters.Count; i++)
            {
                Parameter parameter = CreateParameters[i];
                args.CreateValues[parameter.Name] = values[i];
            }
        }
        Parameter _parameter; // Can be null, that's why this class doesn't subclass Parameter

        internal WebControlParameterProxy(string propertyName, ParameterCollection parameterCollection, EntityDataSource entityDataSource)
        {
            Debug.Assert(null != entityDataSource);
            Debug.Assert(!String.IsNullOrEmpty(propertyName));

            _parameter = EntityDataSourceUtil.GetParameter(propertyName, parameterCollection);
            _collection = parameterCollection;
            _entityDataSource = entityDataSource;
            VerifyUniqueType(_parameter);
        }
Beispiel #14
0
		protected Parameter (Parameter original)
		{
			if (original == null)
				throw new NullReferenceException (".NET emulation");
			
			this.DefaultValue = original.DefaultValue;
			this.Direction = original.Direction;
			this.ConvertEmptyStringToNull = original.ConvertEmptyStringToNull;
			this.Type = original.Type;
			this.Name = original.Name;
		}
 protected void GridView1_OnRowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     GridViewRow gr = this.GridView1.Rows[e.RowIndex] as GridViewRow;
     FileUpload MyFileUpload = gr.Cells[1].FindControl("FileUpload2") as FileUpload;
     TextBox MyTextBox1 = gr.Cells[1].FindControl("Textbox6") as TextBox;
     TextBox MyTextBox2 = gr.Cells[2].FindControl("Textbox5") as TextBox;
     TextBox MyTextBox3 = gr.Cells[1].FindControl("Textbox8") as TextBox;
     TextBox MyTextBox4 = gr.Cells[1].FindControl("Textbox7") as TextBox;
     if (MyFileUpload.HasFile)
     {
         string PicPath = HttpContext.Current.Server.MapPath("~/images/PictureGallery/Staff/Temp/" + MyFileUpload.FileName);
         MyFileUpload.SaveAs(PicPath);
         IconReSizeImage(PicPath, MyFileUpload.FileName);
         string OldImagePath = Session["ImageUrl"].ToString();
         try
         {
             System.IO.File.Delete(HttpContext.Current.Server.MapPath(OldImagePath));
         }
         catch
         {
         }
         string PhotoPath = "~/images/PictureGallery/Staff/" + MyFileUpload.FileName;
         AccessDataSource1.UpdateParameters.Add("MemberName", MyTextBox1.Text);
         AccessDataSource1.UpdateParameters.Add("MemberDescription", MyTextBox2.Text);
         AccessDataSource1.UpdateParameters.Add("Order", MyTextBox3.Text);
         AccessDataSource1.UpdateParameters.Add("MemberTitle", MyTextBox4.Text);
         AccessDataSource1.UpdateParameters.Add("MemberPhotoPath", PhotoPath);
         Parameter DataRowKey = new Parameter("ID");
         DataRowKey.DefaultValue = e.Keys[0].ToString();
         AccessDataSource1.UpdateParameters.Add(DataRowKey);
         AccessDataSource1.Update();
         GridView1.EditIndex = -1;
         GridView1.DataBind();
     }
     else
     {
         string PhotoPath = Session["ImageUrl"].ToString();
         AccessDataSource1.UpdateParameters.Add("MemberName", MyTextBox1.Text);
         AccessDataSource1.UpdateParameters.Add("MemberDescription", MyTextBox2.Text);
         AccessDataSource1.UpdateParameters.Add("Order", MyTextBox3.Text);
         AccessDataSource1.UpdateParameters.Add("MemberTitle", MyTextBox4.Text);
         Parameter MemberPhotoPath = new Parameter("MemberPhotoPath");
         MemberPhotoPath.DefaultValue = PhotoPath;
         AccessDataSource1.UpdateParameters.Add(MemberPhotoPath);
         Parameter DataRowKey = new Parameter("ID");
         DataRowKey.DefaultValue = e.Keys[0].ToString();
         AccessDataSource1.UpdateParameters.Add(DataRowKey);
         AccessDataSource1.Update();
         GridView1.EditIndex = -1;
         GridView1.DataBind();
     }
 }
 private void BuildCommand(IConfigurationElement parametersSection, ParameterCollection parameters)
 {
     parameters.Clear();
     foreach (IConfigurationElement parameterElement in parametersSection.Elements.Values)
     {
         Parameter commandParameter = new Parameter();
         foreach (IConfigurationElement propertyElement in parameterElement.Elements.Values)
         {
             ReflectionServices.SetValue(commandParameter, propertyElement.GetAttributeReference("name").Value.ToString(), propertyElement.GetAttributeReference("value").Value);
         }
         parameters.Add(commandParameter);
     }
 }
Beispiel #17
0
        protected Dictionary <string, object> CreateMethodParametersFromFindParameters()
        {
            Dictionary <string, object> methodParameters = new Dictionary <string, object>();
            IOrderedDictionary          values           = FindParameters.GetValues(HttpContext.Current, Source);

            for (int i = 0; i < FindParameters.Count; i++)
            {
                Parameter parameter = FindParameters[i];

                methodParameters[parameter.Name] = values[i];
            }

            return(methodParameters);
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            start = new Parameter("start", DbType.Date);
            end = new Parameter("end", DbType.Date);

            if (!IsPostBack)
            {
                dsVehicles.SelectParameters.Add(start);
                dsVehicles.SelectParameters.Add(end);

                startDate.SelectedDate = DateTime.Today;
                endDate.SelectedDate = DateTime.Today.AddDays(1);
            }
        }
        public ObjectDataSourceEx()
        {
            this.EnablePaging = true;
            this.SelectMethod = "SelectAll";
            this.SelectCountMethod = "SelectAllCount";
            this.SortParameterName = "sortExpression";

            this.UpdateMethod = "Update";
            this.DeleteMethod = "Delete";

            var filterParameter = new Parameter {Name = "filterExpression", DefaultValue = string.Empty};
            this.SelectParameters.Add(filterParameter);

            this.Selecting += this.ObjectDataSourceEx_Selecting;
            this.Selected += this.ObjectDataSourceEx_Selected;
        }
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			this.Selecting += new ObjectDataSourceSelectingEventHandler(DeluxeObjectDataSource_Selecting);
			this.Selected += new ObjectDataSourceStatusEventHandler(DeluxeObjectDataSource_Selected);

			if (this.SelectParameters["where"] == null)
			{
				Parameter whereParameter = new Parameter("where", DbType.String, string.Empty);

				whereParameter.Direction = ParameterDirection.Input;

				this.SelectParameters.Add(new Parameter("where", DbType.String, string.Empty));
			}
		}
        protected void ReportViewerDataBind(string schoolName, string className, string term, string classID)
        {
            SqlDataSource1.SelectParameters.Clear();
            SqlDataSource1.SelectParameters.Add("ClassID", classID);
            SqlDataSource1.SelectParameters.Add("Term", term);
            System.Web.UI.WebControls.Parameter paraSchoolCount = new System.Web.UI.WebControls.Parameter("StudentCount", System.Data.DbType.Int32);
            paraSchoolCount.Direction = System.Data.ParameterDirection.Output;
            SqlDataSource1.SelectParameters.Add(paraSchoolCount);

            int StudentCount = _studentCount.Fn_GetStudentCount(term, classID);

            ReportViewer1.LocalReport.SetParameters(new Parameter("SchoolName", schoolName));
            ReportViewer1.LocalReport.SetParameters(new Parameter("ClassName", className));
            ReportViewer1.LocalReport.SetParameters(new Parameter("Term", term));
            ReportViewer1.LocalReport.SetParameters(new Parameter("StudentCount", StudentCount.ToString()));
            ReportViewer1.LocalReport.Refresh();
        }
 private static Parameter CreateMergedParameter(Parameter parameter, List<Parameter> unusedOldParameters)
 {
     Parameter item = null;
     foreach (Parameter parameter3 in unusedOldParameters)
     {
         if (ParametersMatch(parameter, parameter3))
         {
             item = parameter3;
             break;
         }
     }
     if (item != null)
     {
         unusedOldParameters.Remove(item);
         return item;
     }
     return parameter;
 }
        protected void AssignedTicketEvents(int aid)
        {
            SqlDataSource gridsource = new SqlDataSource();
            string connStr = ConfigurationManager.ConnectionStrings["HelpDeskConnString"].ToString();

            gridsource.ConnectionString = connStr;

            gridsource.SelectCommand = @"SELECT TicketId ,Subject, DateAndTime,UserId,
                                        (select u.FirstName from tblUser as u where u.UserId = tblTicket.Requester) as Requester
                                        FROM tblTicket , tblUser
                                        where tblTicket.Assignee = tblUser.UserId and tblUser.UserId = " + aid;
            gridsource.DeleteCommand = "DELETE FROM [tblTicket] WHERE [TicketId] = @TicketId";

            //delete parameters
            Parameter Deletepm = new Parameter();
            Deletepm.Name = "TicketId";
            Deletepm.DbType = DbType.Int32;
            gridsource.DeleteParameters.Add(Deletepm);

            rg_AssignedTickets.DataSource = gridsource;
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _start = new Parameter("_start", DbType.Date);
                _end = new Parameter("_end", DbType.Date);

                sqlHotels.SelectParameters.Add(_start);
                sqlHotels.SelectParameters.Add(_end);
            }

            FixNavbarLoginView();

            _checkInDate = Request.QueryString["checkIn"];
            _checkOutDate = Request.QueryString["checkOut"];

            _adults = Request.QueryString["adults"];
            _children = Request.QueryString["children"];
            _roomType = Request.QueryString["roomType"];

            ManualDatabind();
        }
Beispiel #25
0
    protected void submitButton_Click(object sender, EventArgs e)
    {
        // create a date parameter to store the current date
        System.Web.UI.WebControls.Parameter date =
            new System.Web.UI.WebControls.Parameter(
                "Date", TypeCode.String, DateTime.Now.ToShortDateString());

        // set the @Date parameter to the date parameter
        messagesSQLDataSource.InsertParameters.RemoveAt(0);
        messagesSQLDataSource.InsertParameters.Add(date);

        // execute an INSERT SQL statement to add a new row to the
        // Messages table in the Guestbook database that contains the
        // current date and the user's name, e-mail address and message
        messagesSQLDataSource.Insert();

        // clear the TextBoxes
        nameTextBox.Text    = "";
        emailTextBox.Text   = "";
        messageTextBox.Text = "";

        // update the GridView with the new database table contents
        messagesGridView.DataBind();
    }
 public ParameterItem(System.Web.UI.WebControls.Parameter parameter)
 {
     this._parameter = parameter;
 }
 private void InitExistingList()
 {
     MessageItem message = UIFactory.Instance.GetSpeakContext().Message;
     this.RecipientListSource.ID = "RecipientListSource";
     if (Sitecore.Context.User.IsAdministrator)
     {
     this.RecipientListSource.SelectCommand = "fast:@recipientContainerPath[@@id = '@recipientContainerId']//*[(@@templateid='@recipientListTemplate') and @filterExpression]";
     }
     else
     {
     this.RecipientListSource.SelectCommand = "fast:@recipientContainerPath[@@id = '@recipientContainerId']//*[(@__Created by='@ownerName') and (@@templateid='@recipientListTemplate') and @filterExpression]";
     }
     Parameter parameter = new Parameter("@recipientContainerPath") {
     DefaultValue = ItemUtilExt.GetRecipientListsContainerItem(message.InnerItem).Paths.FullPath
     };
     this.RecipientListSource.SelectParameters.Add(parameter);
     Parameter parameter2 = new Parameter("@recipientContainerId") {
     DefaultValue = ItemUtilExt.GetRecipientListsContainerItem(message.InnerItem).ID.ToString()
     };
     this.RecipientListSource.SelectParameters.Add(parameter2);
     Parameter parameter3 = new Parameter("@recipientListTemplate") {
     DefaultValue = "{B95EB9EA-8F86-44FE-B619-4B29C1343F95}"
     };
     this.RecipientListSource.SelectParameters.Add(parameter3);
     if (!Sitecore.Context.User.IsAdministrator)
     {
     Parameter parameter5 = new Parameter("@ownerName")
     {
         DefaultValue = Sitecore.Context.User.Name.Replace(@"\\", @"\")
     };
     this.RecipientListSource.SelectParameters.Add(parameter5);
     }
     ControlParameter parameter4 = new ControlParameter("@filterExpression", this.FilterDropList.ID, "FilterExpression") {
     DefaultValue = "true"
     };
     this.RecipientListSource.SelectParameters.Add(parameter4);
     this.FilterDropList.DataSourceId = this.RecipientListSource.ID;
     this.FilterDropList.Command = typeof(AddRecipientListCommand).FullName;
     this.FilterDropList.Width = new Unit("120px");
     this.FilterDropList.CssClass = "sc-recipient-menu-button";
     if (!string.IsNullOrEmpty(this.DataSourceItem["Use Existing List Button"]))
     {
     this.FilterDropList.Title = this.DataSourceItem["Use Existing List Button"];
     }
 }
        private static void VerifyUniqueType(Parameter parameter)
        {
            if (parameter != null && parameter.Type == TypeCode.Empty && parameter.DbType == DbType.Object)
            {
                throw new InvalidOperationException(Strings.WebControlParameterProxy_TypeDbTypeMutuallyExclusive);
            }

            if (parameter != null && parameter.DbType != DbType.Object && parameter.Type != TypeCode.Empty)
            {
                throw new InvalidOperationException(Strings.WebControlParameterProxy_TypeDbTypeMutuallyExclusive);
            }
        }
		public void ViewStateSupport () 
		{
			SqlDataSource ds = new SqlDataSource ();
			SqlViewPoker view = new SqlViewPoker (ds, "DefaultView", null);

			ds.ID = "SqlDataSource1";
			ds.SelectCommand = "Select";

			Parameter p1 = new Parameter ("test", TypeCode.String);

			Assert.IsTrue (((IStateManager) view).IsTrackingViewState, "IsTrackingViewState");
			Assert.IsTrue (((IStateManager) view.FilterParameters).IsTrackingViewState, "FilterParameters.IsTrackingViewState");
			Assert.IsTrue (((IStateManager) view.SelectParameters).IsTrackingViewState, "SelecteParameters.IsTrackingViewState");
			Assert.IsFalse (((IStateManager) view.DeleteParameters).IsTrackingViewState, "DeleteParameters.IsTrackingViewState");
			Assert.IsFalse (((IStateManager) view.InsertParameters).IsTrackingViewState, "InsertParameters.IsTrackingViewState");
			Assert.IsFalse (((IStateManager) view.UpdateParameters).IsTrackingViewState, "UpdateParameters.IsTrackingViewState");

			object state = ((IStateManager) view).SaveViewState ();
			Assert.IsNull (state, "view ViewState not null");

			view.DeleteParameters.Add (p1);
			view.InsertParameters.Add (p1);
			//view.UpdateParameters.Add (p1);

			state = ((IStateManager) view).SaveViewState ();
			Assert.IsNull (state, "view ViewState not null");

			view.FilterParameters.Add (p1);
			//view.SelectParameters.Add (p1);

			state = ((IStateManager) view).SaveViewState ();
			Assert.IsNotNull (state, "view ViewState not null");

			state = ((IStateManager) view.FilterParameters).SaveViewState ();
			Assert.IsNotNull (state, "FilterParamenters ViewState not null");
			state = ((IStateManager) view.SelectParameters).SaveViewState ();
			Assert.IsNull (state, "SelectParameters ViewState not null");

			state = ((IStateManager) view.DeleteParameters).SaveViewState ();
			Assert.IsNotNull (state, "DeleteParameters ViewState not null");
			state = ((IStateManager) view.InsertParameters).SaveViewState ();
			Assert.IsNotNull (state, "InsertParameters ViewState not null");
			state = ((IStateManager) view.UpdateParameters).SaveViewState ();
			Assert.IsNull (state, "UpdateParameters ViewState not null");
		}
		public static void DetailsView_DeleteItem (Page p)
		{
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			PokerDetailsView dv = new PokerDetailsView ();
			ObjectDataSource ds = new ObjectDataSource ();
			ds.ID = "ObjectDataSource1";
			ds.TypeName = "MonoTests.System.Web.UI.WebControls.TableObject";
			ds.SelectMethod = "GetMyData";
			ds.DeleteMethod = "Delete";
			ds.InsertMethod = "Insert";
			ds.UpdateMethod = "Update";
			Parameter p1 = new Parameter ("ID", TypeCode.String);
			Parameter p2 = new Parameter ("FName", TypeCode.String);
			Parameter p3 = new Parameter ("LName", TypeCode.String);
			ds.DeleteParameters.Add (p1);
			ds.DeleteParameters.Add (p2);
			ds.DeleteParameters.Add (p3);
			dv.Page = p;
			ds.Page = p;
			p.Form.Controls.Add (lcb);
			p.Form.Controls.Add (dv);
			p.Form.Controls.Add (ds);
			p.Form.Controls.Add (lce);
			dv.AllowPaging = true;
			dv.DataKeyNames = new string[] { "ID", "FName", "LName" };
			dv.DataSourceID = "ObjectDataSource1";
			dv.DataBind ();
			dv.DeleteItem ();
		}
 public void CopyTo(Parameter[] parameterArray, int index)
 {
     base.CopyTo(parameterArray, index);
 }
        public void GenerateColumns()
        {
            if (this.AutoGenerateColumns)
            {
                throw new Exception("GridViewEx: AutoGenerateColumns must be set to false.");
            }

            var dataSource = this.GetDataSource() as ObjectDataSource;
            if (null == dataSource)
            {
                return;
            }

            Type dataObjectType = BuildManager.GetType(dataSource.DataObjectTypeName, false);

            if (null != dataObjectType)
            {
                IOrderedEnumerable<PropertyInfo> allProperties =
                    dataObjectType.GetProperties().Where(
                        x =>
                            x.PropertyType.IsPrimitive || x.PropertyType == typeof (string)
                            || x.PropertyType == typeof(DateTime) || x.PropertyType == typeof(DateTime?)).OrderBy(x => x.DeclaringType == dataObjectType);

                foreach (PropertyInfo property in allProperties)
                {
                    bool readOnly = this.ReadOnlyPropertiesList.Contains(property.Name);
                    bool visibility = !this.HiddenPropertiesList.Contains(property.Name);

                    if (property.PropertyType == typeof (bool))
                    {
                        var checkBoxField = new CheckBoxField
                        {
                            DataField = property.Name,
                            HeaderText = property.Name,
                            SortExpression = property.Name,
                            ReadOnly = readOnly,
                            Visible = visibility
                        };

                        this.Columns.Add(checkBoxField);
                    }
                    else
                    {
                        var field = new BoundField
                        {
                            DataField = property.Name,
                            HeaderText = property.Name,
                            SortExpression = property.Name,
                            ReadOnly = readOnly,
                            Visible = visibility
                        };

                        if (this.EditModeDropDownFields.ContainsKey(property.Name))
                        {
                            // TODO: set drop down as edit mode control
                        }

                        this.Columns.Add(field);
                    }

                    if (property.PropertyType == typeof(DateTime) || property.PropertyType == typeof(DateTime?))
                    {
                        var parameter = new Parameter
                        {
                            Type = TypeCode.DateTime,
                            DbType = DbType.Object,
                            Name = property.Name,
                            Direction = ParameterDirection.Input,
                            DefaultValue = null
                        };

                        dataSource.UpdateParameters.Add(parameter);
                    }
                }
            }

            if (this.EnableEdit || this.EnableDelete)
            {
                var cf = new CommandField
                {
                    ShowEditButton = this.EnableEdit,
                    ShowDeleteButton = this.EnableDelete,
                    HeaderText = "Commands"
                };

                this.Columns.Add(cf);
            }

            this.RowEditing += GridViewExRowEditing;
        }
 public bool Contains(Parameter parameter)
 {
     return ((IList) this).Contains(parameter);
 }
 public int Add(Parameter parameter)
 {
     return ((IList) this).Add(parameter);
 }
 public void Remove(Parameter parameter)
 {
     ((IList) this).Remove(parameter);
 }
 public void Insert(int index, Parameter parameter)
 {
     ((IList) this).Insert(index, parameter);
 }
 public int IndexOf(Parameter parameter)
 {
     return ((IList) this).IndexOf(parameter);
 }