October 2008 - Posts

Just a Simple CRUD WPF

image

Here is the code

   1:  namespace SimpleCRUD
   2:  {
   3:      /// <summary>
   4:      /// Interaction logic for Window1.xaml
   5:      /// </summary>
   6:      /// 
   7:      public partial class Window1 : Window
   8:      {
   9:          IEnumerable<employee> employeecontainer;
  10:          CollectionView view;
  11:          public Window1()
  12:          {
  13:              InitializeComponent();
  14:          }
  15:   
  16:          private void btnexit_Click(object sender, RoutedEventArgs e)
  17:          {
  18:              this.Close();
  19:          }
  20:   
  21:          private void Window_Loaded(object sender, RoutedEventArgs e)
  22:          {
  23:              BindData();
  24:           }
  25:   
  26:          private void BindData()
  27:          {
  28:              using (MyTestDBDataContext datactx = new MyTestDBDataContext())
  29:              {
  30:                  employeecontainer = (from a in datactx.employees select a);
  31:                  this.DataContext = datactx.employees;
  32:                  view = (CollectionViewSource.GetDefaultView(employeecontainer) as CollectionView);
  33:                  view.MoveCurrentToFirst();
  34:                  stcRight.DataContext = view;
  35:   
  36:              }
  37:          }
  38:          private void ClearAllTextBox()
  39:          {
  40:              foreach (var item in stcRight.Children)
  41:              {
  42:                  if (item.GetType().Name == "TextBox")
  43:                      ((TextBox)item).Text = string.Empty;
  44:              }
  45:          }
  46:       
  47:          private void cmdadd_Click(object sender, RoutedEventArgs e)
  48:          {
  49:              if (cmdadd.Content.ToString() == "Add")
  50:              {
  51:              ClearAllTextBox();
  52:              cmdadd.Content = "Update";
  53:              sbaritem.Content = String.Empty;
  54:              txtid.Background = new SolidColorBrush(Colors.Gray);
  55:              txtname.Focus();
  56:              }
  57:              else
  58:              {
  59:                  employee tmp = new employee();             
  60:                  tmp.Name = txtname.Text;
  61:                  tmp.Address = txtaddress.Text;
  62:                  using (MyTestDBDataContext datactx = new MyTestDBDataContext())
  63:                  {
  64:                      datactx.employees.InsertOnSubmit(tmp);
  65:                      try
  66:                      {
  67:                          datactx.SubmitChanges();
  68:                          sbaritem.Content = "Success Insert 1 Record";
  69:                          BindData();
  70:                          view.MoveCurrentToLast();
  71:                      }
  72:                      catch (Exception ex)
  73:                      {
  74:                          MessageBox.Show(ex.Message);
  75:                      }
  76:                  }               
  77:                  cmdadd.Content = "Add";
  78:                  txtid.Background = new SolidColorBrush(Colors.White);
  79:              
  80:              }
  81:          }
  82:   
  83:          private void btnmovefirst_Click(object sender, RoutedEventArgs e)
  84:          {
  85:              view.MoveCurrentToFirst();
  86:          }
  87:   
  88:          private void btnprevious_Click(object sender, RoutedEventArgs e)
  89:          {
  90:              if(view.CurrentPosition>0)
  91:              view.MoveCurrentToPrevious();
  92:          }
  93:   
  94:          private void btnmovenext_Click(object sender, RoutedEventArgs e)
  95:          {
  96:              if (view.CurrentPosition < view.Count - 1)
  97:              {
  98:                  view.MoveCurrentToNext();
  99:              }
 100:          }
 101:   
 102:          private void btndelete_Click(object sender, RoutedEventArgs e)
 103:          {
 104:              if(view.CurrentPosition>-1)
 105:              {
 106:                  using (MyTestDBDataContext datactx = new MyTestDBDataContext())
 107:                  {
 108:                      datactx.employees.Attach((employee)view.CurrentItem);
 109:                      datactx.employees.DeleteOnSubmit((employee)view.CurrentItem);
 110:                      datactx.SubmitChanges();
 111:                      BindData();
 112:                  }
 113:              }
 114:          }
 115:   
 116:          private void btnmovelast_Click(object sender, RoutedEventArgs e)
 117:          {
 118:              view.MoveCurrentToLast();
 119:          }
 120:   
 121:          private void btncancel_Click(object sender, RoutedEventArgs e)
 122:          {
 123:              view.MoveCurrentToFirst();
 124:              cmdadd.Content = "Add";
 125:          }
 126:   
 127:       
 128:   
 129:      }
 130:  }
Share this post: | | | |
Posted by cipto with no comments
Filed under:

Changing 2D to 3D

Now i've just take a look at this 3d WPF HOL

to make everything inside a grid, which is just ordinary 2d . To become a 3D

just download the 3d Tools on code plex, reference it on your WPF project

add a reference for the namespace in your xaml xmlns:tools="clr-namespace:_3DTools;assembly=3DTools"

<Grid>
       
        <tools:TrackballDecorator>
            <tools:Interactive3DDecorator>
                <Viewport3D>
                    <Viewport3D.Camera>
                        <PerspectiveCamera Position="0,0,-10" LookDirection="0,0,1"
                               UpDirection="0,1,0" FieldOfView="45" />
                    </Viewport3D.Camera>

                    <tools:InteractiveVisual3D>
                        <tools:InteractiveVisual3D.Geometry>
                            <MeshGeometry3D Positions="-3,-1,1.5 3,-1,1.5 -3,-1,0 3,-1,0 -3,1,0 3,1,0 -3,1,1.5 3,1,1.5"
                              TextureCoordinates="1,1 0,1 0.75,1 0.25,1 0.75,0 0.25,0 1,0 0,0"

                              TriangleIndices="0,6,4 0,4,2 2,4,5 2,5,3 3,5,1 1,5,7" />
                        </tools:InteractiveVisual3D.Geometry>

                        <tools:InteractiveVisual3D.Visual>

     --------------------BELOW IS YOUR CONTENT---------------------------------------------

    ---------------------Till here----------------------------------------------------------------------------

        </tools:InteractiveVisual3D.Visual>
                    </tools:InteractiveVisual3D>

                    <ModelVisual3D>
                        <ModelVisual3D.Content>
                            <Model3DGroup>

                                <!-- All 3D models require a light source to look right -->
                                <AmbientLight Color="White" />

                            </Model3DGroup>
                        </ModelVisual3D.Content>
                    </ModelVisual3D>
                </Viewport3D>
            </tools:Interactive3DDecorator>
        </tools:TrackballDecorator>
        
    </Grid>

</Window>
 

When you take a look Whoalah, it's 3d, very nice tool and wpf right?

Cool

Share this post: | | | |
Posted by cipto with no comments
Filed under:

Changing Button Template in WPF

ok, i've just take a look at some WPF cast from the developer kit.net 3.5 sp1 from yesterday MSDN day.

 and mm i try the HOL for WPF, 

and when changing the skin of a button

i simply right click on the normal button the expression blend 

Edit a control parts->edit a copy.

There's a pop up for the New style, Named it , it will be usefull later if we want to apply this style to another button.

 

Open up the Interaction Tab.

You'll find it hard to find, it's just under the zoom tab.

 Now you can see there's two items , one is the chrome the other is ContentPresenter

 

Delete the chrome

 

Insert any Shape it's like the corel draw drawing, vector based, draw anything you like

Now i my self a little confuse at first how can i add another shape if there's already one......

it just keep replacing the old one.

Ohhh apperantly i forget that You Must add a container for this template to have more than one shape

add a GRID tag as the outer one, than include your shapes inside of it. don't forget to Enter the  ContentPresenter

It's the Text label for our button.

 

For the next button that you want to apply this kind of button you have just make , just

Right Click->Edit control parts (template)->Apply Resources->[Your Style Name]

 

Share this post: | | | |
Posted by cipto with no comments
Filed under:

MSBuild Shell Extension, MSBuild Extension Pack, Web Deployment Project, MSBuild External Tools

 MSBuild shell extension, just add a menu everytime you right click a proj, csproj extension file

giving you the power to rebuild outside of vs ide.

 

ImageHost.org

Msbuild extension pack, contains the dll for extend the feature available on your msbuild

here is the description

The MSBuild Extension Pack is the successor to the FreeToDev MSBuild Tasks Suite and provides a collection of over 170 MSBuild tasks designed for the .net 3.5 Framework. A high level summary of what the tasks currently cover includes the following:

• System Items: Certificates, COM+, Console, Date and Time, Drives, Environment Variables, Event Logs, Files and Folders, GAC, Network, Performance Counters, Registry, Services, Sound
• Code: Assemblies, CAB Files, Code Signing, File Detokenisation, GUID’s, Mathematics, Strings, Threads, Zip
• Applications: BizTalk 2006, Email, IIS7, MSBuild, SourceSafe, StyleCop, Team Foundation Server, Visual Basic 6, WMI

 

Web Deployment Project

 

ImageHost.org
Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{A6843112-B666-4CCC-8178-9B04079577ED}</ProjectGuid>
    <SourceWebPhysicalPath>..\PipeLineStaging</SourceWebPhysicalPath>
    <SourceWebProject>{3B266AA5-9C02-4D38-9E70-3C39B3A4078A}|E:\ForAna\PipeLineStaging\Pipeline\PipeLineStaging</SourceWebProject>
    <SourceWebVirtualPath>/PipeLineStaging</SourceWebVirtualPath>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>.\Debug</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>PipeLineStaging_deploy</SingleAssemblyName>
    <UseExernalWebConfigReplacementFile>true</UseExernalWebConfigReplacementFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <OutputPath>.\Release</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>PipeLineStaging_deploy</SingleAssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Staging|AnyCPU' ">
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <UseWebConfigReplacement>true</UseWebConfigReplacement>
    <SingleAssemblyName>
    </SingleAssemblyName>
    <OutputPath>.\Staging</OutputPath>
    <ContentAssemblyName>PipeLineBehindCode</ContentAssemblyName>
    <VirtualDirectoryAlias>pipeline</VirtualDirectoryAlias>
    <ReplaceExistingVirtualDirectory>true</ReplaceExistingVirtualDirectory>
    <UseExernalWebConfigReplacementFile>true</UseExernalWebConfigReplacementFile>
  </PropertyGroup>
  <ItemGroup>
  </ItemGroup>
  <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Staging|AnyCPU'">
    <AssemblyAttributes Include="AssemblyFileVersion">
      <Value>1.0.0.0</Value>
    </AssemblyAttributes>
    <AssemblyAttributes Include="AssemblyVersion">
      <Value>1.0.0.0</Value>
    </AssemblyAttributes>
    <WebConfigReplacementFiles Include="appsettings.config">
      <Section>appSettings</Section>
    </WebConfigReplacementFiles>
  </ItemGroup>
  <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <WebConfigReplacementFiles Include="sit.config">
      <Section>asppSettings</Section>
    </WebConfigReplacementFiles>
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.WebDeployment.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="BeforeMerge">
  </Target>
  <Target Name="AfterMerge">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

As i stated on my previous Post. Here you can uncomment the target

and add another task for msbuild

Share this post: | | | |
Posted by cipto with no comments
Filed under:

MSBuild Introduction

As a follow up to my previous post on cruise control.

Let's look at what msbuild can do.

Many developers did not reliaze that when they make a project or solution, visual studio create an msbuild script . that is on your ProjectName.Csproj for c#project,as for web it just contain the path of the build on sln, this is what the web deployment project comes in creating additional msbuild for web

So when you click on Build ,Rebuild or Clean, Visual studio actually execute the script using MSbuild.

You can see the csproj using notepad or You might wondering How the hell i can see that xml on my Vs IDE?. the answer is right click on your project ->Click Unload Project -> Rightclick on your disable project -> Edit MyprojectName.CSproj.

Msbuild work on Targets.

Msbuild possessed property , and each target can have items.

You can do Import Targets. Using tag is used for Using your own DLL.

Msbuild can be customized  as you wish

Let's Take an Example: I've got a pop3 projects that change the app.config during SIT,UAT and i want to email my others developer everytime i build

Now  how can i automated that every time i build the project?

By Default Visual studio already give you the place , now lets edit our project.

  1.  Add an SIT and UAT Configuration in your Configuration Manager

ImageHost.org

add the extension pack for Msbuild on your csproj ,i'm using the MSBuild Extension Pack , there is another option MSBuild Community extension.

 <PropertyGroup>

<TPath>C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks</TPath>
<TPath Condition="Exists('C:\Program Files\MSBuild\ExtensionPack\Common\MSBuild.ExtensionPack.tasks')">C:\Program Files\MSBuild\ExtensionPack\Common\MSBuild.ExtensionPack.tasks</TPath>   

... 

   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(TPath)" />

 ...

 <Target Name="AfterBuild">
    <Message Text="Sending Email To Developers and QA" />
    <ItemGroup>
      <Attachment Include="C:\demo.txt" />
      <Recipient Include="penting@cipto.com" />
      <Recipient Include="iqbal@cipto.com" />
    </ItemGroup>
    <MSBuild.ExtensionPack.Communication.Email Attachments="@(Attachment)" TaskAction="Send" Subject="Pop3 is Build Version 1.0.0.1" SmtpServer="127.0.0.1" MailFrom="ciptoaja@cipto.com" MailTo="@(Recipient)" Body="HUii" />
    <Copy Condition="$(Configuration)=='UAT'" SourceFiles=".\uatconfig\Pop3Downloader.exe.config" DestinationFiles="$(OutputPath)Pop3Downloader.exe.config" />
    <Copy Condition="$(Configuration)=='SIT'" SourceFiles=".\sitconfig\Pop3Downloader.exe.config" DestinationFiles="$(OutputPath)Pop3Downloader.exe.config" />

  </Target>


 There you go. Now every time you build Copy the config and email other developer or qa

 Now you might wondering VS always create your first schema target="Build" etc comes from? i can't find it anywhere on my projects

well actually it imports them

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> and also

MSBuild ships with several useful tasks. For a complete list, see the Microsoft.Common.tasks file located in the %WinDir%\Microsoft.NET\Framework\v2.0.50727 directory

 22/10/2008 , You can add an external tool for accessing msbuild.exe from your ide.

click tools->External tools-> Fill TItle with MSBUild -> Fill command with C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe -> Fill arguments and initial directory

check the use output window, and prompt for arguments option.

 

ImageHost.org
Share this post: | | | |
Posted by cipto with 4 comment(s)
Filed under:

ASP.NET website Continuous Integration+Deployment using CruiseControl.NET, Subversion, MSBuild and Robocopy

Refer to

Omar's Blog

 

Weksss, cool right?

imagine that your client , demands to see the website that you have made so far, on their network or internet, do you call project support and always build and deploy there?

well it's time for the automatically one, using cruise control we can execute msbuild on the sln, check for changes in subversion and if there is build and deploy to IIS +
Email to the developers and QA

:D
i love this omar guy

 

15/10/2008

hmm, i've got to make some changes on omar Configuration, since what i intended to do is precompiled it, and copy it to the virtual directory automatically.

i encountered some problems with msbuild . which msbuild will see the right compiler for visual studio, as for web project going to the asp_net compiler.

Now sometimes ASPNET compiler generate error like: can not delete folder , delete manually, it's because the folder is already exists, like this precompiled folder.

i delete it and it's all running. as for command in aspnet_compiler you should add -f to replace if exists(f=forcewrite).

aspnet_compiler -f -p D:\cc\pipeline\code\trunk\pipelinestaging -v /pipeline d:\hasilcompile 

 

But this is msbuild , msbuild just use the -p on regular one , how can we give the -f to aspnetcompiler? ....

well if you see our solution .sln , it's already there..

icrosoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "PipeLineStaging", "PipeLineStaging\", "{3B266AA5-9C02-4D38-9E70-3C39B3A4078A}"
    ProjectSection(WebsiteProperties) = preProject
        TargetFramework = "3.5"
        Debug.AspNetCompiler.VirtualPath = "/PipeLineStaging"
        Debug.AspNetCompiler.PhysicalPath = "PipeLineStaging\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\debug\PipeLineStaging\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
       
Debug.AspNetCompiler.FixedNames = "true"
        Debug.AspNetCompiler.Debug = "True"
        Release.AspNetCompiler.VirtualPath = "/PipeLineStaging"
        Release.AspNetCompiler.PhysicalPath = "PipeLineStaging\"
        Release.AspNetCompiler.TargetPath = "PrecompiledWeb\release\PipeLineStaging\"
        Release.AspNetCompiler.Updateable = "true"
        Release.AspNetCompiler.ForceOverwrite = "true"
       
Release.AspNetCompiler.FixedNames = "true"
        Release.AspNetCompiler.Debug = "False"
        VWDPort = "3024"
    EndProjectSection
EndProject

There are some that msbuild can not understand..

and from omars one , he does not turn on iis again, so i add another turn on iis..

and change the path for the precompiled as source and target the virtual directory

        <executable>D:\Program Files\Windows Resource Kits\Tools\robocopy.exe</executable>

            <baseDirectory>pipeline\</baseDirectory>

            <buildArgs>D:\cc\pipeline\code\trunk\PrecompiledWeb\debug\PipeLineStaging C:\Inetpub\wwwroot\Pipeline *.* /E /XA:H /PURGE /XO /XD ".svn" /NDL /NC /NS /NP</buildArgs>

            <buildTimeoutSeconds>60</buildTimeoutSeconds>

            <successExitCodes>1,0</successExitCodes>

        </exec>
        <exec>
            <executable>iisreset</executable>
            <buildArgs>/start</buildArgs>
        </exec>

    </tasks>

 

Share this post: | | | |
Posted by cipto with no comments
Filed under:

Loading Template For Asp.Net Control

First of all here what i've got from   MSDN Magazines

For most of us as web developer , work with asp.net controls, some of these controls let us control the layout, by providing us template, like for example, header template, footer template,item template.

now There are 4 types of how we can load the template

  1. Manually declare on the tag on aspx page
  2. Full In Memory template using Class inherit from ITemplate
  3. Page.LoadTemplate(ascx path)
  4. Itemplate with Loading from HTML files

Now this can be combine for some scenario ,if user's role is  admin load another template.etc.

example no.2: 

 internal class TypeDescriptiontemplate : ITemplate
        {
            #region ITemplate Members

            public void InstantiateIn(Control container)
            {
                Label b = new Label();
                b.DataBinding += new EventHandler(BindTypeDescription);
                container.Controls.Add(b);
            }

            #endregion
        }
        static void BindTypeDescription(object sender, EventArgs e)
        {
            Label l = (Label)sender;
            //get the parent container of this sender
            GridViewRow container = (GridViewRow)l.NamingContainer;
            DataRowView drv = (DataRowView)container.DataItem;
            l.Text = drv["Type"] + ",  " + drv["Description"];
        }

  protected void Page_Load(object sender, EventArgs e)
        {
            //in memory Template using ITemplate
            TemplateField b = new TemplateField();
            b.HeaderText = "Type Plus Description";
            b.ItemTemplate = new TypeDescriptiontemplate();
            GridView1.Columns.Add(b);

}

 

example no.3:

       protected void Page_Load(object sender, EventArgs e)
        {

            //Ascx template
            TemplateField c = new TemplateField();
            c.HeaderText = "Details";
            c.ItemTemplate = Page.LoadTemplate("~/Qty.ascx");
            GridView1.Columns.Add(c);

        }

 Qty.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Qty.ascx.cs" Inherits="testPro35wrox.Qty" %>

<table>
<tr>
<td>
    <asp:CheckBox ID="ChkIsStockAvailable" Text="IsOnStock" runat="server" />
</td>
<td style="vertical-align:middle">
    <asp:TextBox ID="TxtQty" runat="server"></asp:TextBox>
</td>
<td>
    <asp:Image Height="20" Width="20" ID="ImgCollateral" runat="server" />
</td>
</tr>
</table>

 example no.4:

the htmlfile

mydatatemplate.htm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
</head>
<body>
    <table style="width: 100%;">
        <tr>
            <td>
                {0}
            </td>
            <td>
                {1}
            </td>
            <td>
                {2}
            </td>
            <td>
                {3}
            </td>
        </tr>
    </table>
</body>
</html>
 

   public class MycustomTemplate : ITemplate
    {
        public event EventHandler OnPanelBinding;
        #region ITemplate Members

        public void InstantiateIn(Control container)
        {
            Panel p = new Panel();
            p.DataBinding+=OnPanelBinding;
            container.Controls.Add(p);
        }
        #endregion
     
    }
       protected void Page_Load(object sender, EventArgs e)
        {
            MycustomTemplate dd = new MycustomTemplate();
            dd.OnPanelBinding += new EventHandler(p_DataBinding);
            DataList1.ItemTemplate =  dd;
            DataList1.DataSource = SqlDataSource1;
            DataList1.DataBind();

        }
  protected  string Merge(string all,string type,string description,string priority)
        {
            return String.Format(all,type, description, priority,"");
        }
        public void p_DataBinding(object sender, EventArgs e)
        {

            string theframe = LoadFrame();
            DataListItem container = (DataListItem)((Panel)sender).NamingContainer;
            var i = new Literal();
            DataRow containerrow =(DataRow)((DataRowView)container.DataItem).Row;
            i.Text = Merge(theframe, containerrow["Type"].ToString(),containerrow["Description"].ToString(),containerrow["Priority"].ToString());
            ((Panel)sender).Controls.Add(i);

        }

Share this post: | | | |
Posted by cipto with no comments
Filed under:

ultraweblistbar host ultrawebtree

Now for this example : it's the role management page, i would like to group based on the report path.

such as sales activity consist of 2 : sales activiy branch report ,sales activity per region. CMU consist of three reports.as you can see below

this is the role management. and i would like to use ultraweblistbar Hosting ultrawebtree
ImageHost.org ImageHost.org

 

for the ultraweblist bar can host the ultrawebtree you can use:

1.internal class inherits from ITemplate(System.web.ui.ITemplate)

ex: internal class salesactivitytemplate:ITemplate
    {

        #region ITemplate Members

        public void InstantiateIn(Control container)
        {
            UltraWebTree salestree = new UltraWebTree();
            salestree.Nodes.Add("SalesActivityPerRO");
            salestree.Nodes.Add("SalesActivityperRegionBranch");
            salestree.CheckBoxes = true;
            container.Controls.Add(salestree);
        }

        #endregion
    }

and then set to this.UltraWebListbar1.Groups[0].Template = st; and so on and so on

2. Add a blank Web user control which i use this approach.. because you can retrieve the webtree control as a tree not split up to another control.

     protected void Page_Init(object sender, EventArgs e)
    {
        btnsubmit.Value = "Submit";
        btnsubmit.ServerClick += new EventHandler(btnsubmit_ServerClick);
        btnsubmit.Visible = false;
        btnreset.Visible = false;
        PlaceHolder1.Controls.Add(btnsubmit);
        PlaceHolder1.Controls.Add(btnreset);
        salesactivitytemplate st = new salesactivitytemplate();
        //this.UltraWebListbar1.Groups[0].Template = st;

        this.UltraWebListbar1.Groups[0].UserControlUrl = "MyWebUserControl.ascx";
        this.UltraWebListbar1.Groups[1].UserControlUrl = "MyWebUserControl.ascx";

        var i = this.UltraWebListbar1.Groups[0].UserControl;
        UltraWebTree salestree = new UltraWebTree();
        salestree.ID = "salestree";
        salestree.LeafNodeImageUrl = "~/images/ig_treeXPFolderClosed.gif";
        salestree.Nodes.Add("SalesActivityPerRO");
        salestree.Nodes.Add("SalesActivityperRegionBranch");
        salestree.CheckBoxes = true;
        salestree.ClientSideEvents.NodeChecked = "TreeNodeChecked";
        i.Controls.Add(salestree);


        var d = this.UltraWebListbar1.Groups[1].UserControl;
        UltraWebTree cmutree = new UltraWebTree();
        cmutree.ID = "cmu";
        cmutree.LeafNodeImageUrl = "~/images/ig_treeXPFolderClosed.gif";
        cmutree.Nodes.Add("ProductivityReport");
        cmutree.Nodes.Add("SLAperAppraisalReport");
        cmutree.Nodes.Add("TATmoreSLAReport");
        cmutree.ClientSideEvents.NodeChecked = "TreeNodeChecked";
        cmutree.CheckBoxes = true;
        d.Controls.Add(cmutree);

    }

 

 as for taking the webtree value, when Post or submit 

i've got to double unbox it.

  private List<UltraWebTree> GetMywebtrees()
    {
        List<UltraWebTree> mywebtrees;
        List<MyControls.MyWebUserControl> some =
            (from Group tmp in UltraWebListbar1.Groups
             select tmp.UserControl).Cast<MyControls.MyWebUserControl>().ToList();

        mywebtrees=(from MyControls.MyWebUserControl g in some select g.Controls
                    into temporary
                        from Control g in temporary
                        select g).Cast<UltraWebTree>().ToList();
        return mywebtrees;
    }

  void btnsubmit_ServerClick(object sender, EventArgs e)
    {
       
        List<UltraWebTree> mywebtrees = new List<UltraWebTree>();
        mywebtrees = GetMywebtrees();
        mywebtrees.Foreach<UltraWebTree>(new Action<UltraWebTree>(CheckEveryNodesinTree));
    }

 private void CheckEveryNodesinTree(UltraWebTree tree)
    {
        foreach (Node o in tree.Nodes)
        {
            if(o.Checked)
            {
                //o.Text
                //TODO: Add Logic like Chkmneluist.checked, check if !User.isinrole(username,role){ Roles.adduser(username,o.text)

            }
            else
            {
                //TODO: Add Logic like Chkmneluist.checked, reverse above
            }
        }
    }

 Lastly to change the Icon When User click or unclick use the javascript.

Every nodes that we got . has 3 childrens and number 2 is the image .

   function TreeNodeChecked(treeId, nodeId, bChecked) {
        var d = document.getElementById(nodeId);
        var e = d.children[2];
        try
        {
        if (bChecked) {
            e.src= '../images/ig_treeXPFolderOpen.gif';
        }
        else {
            e.src= '../images/ig_treeXPFolderClosed.gif';
        }
        }
        catch(e)
        {
        alert(e);}
    }

26/10/2008

Use JQuery, because on ie it's children but on Firefox it's childNodes

    function TreeNodeChecked(treeId, nodeId, bChecked) {
            var node = $('#' + nodeId.toString() + ' img');
            node.each(function() {
              
                    if (bChecked) {
                        this.src = '../images/ig_treeXPFolderOpen.gif';
                    }
                    else {
                            this.src = '../images/ig_treeXPFolderClosed.gif';
                    }
               
            });

Final Result UI:

 Listbar type

ImageHost.org
Explorer Type

ImageHost.org
Share this post: | | | |
Posted by cipto with no comments
Filed under:

Composite Control

 I did some learning on these.

but not too deep.

just a shallow one.

  • how to make a property like tree ? inherit from ExpandableObjectConverter
  • how to create type converter
  • how to build custom action lists and designers
  • how to tap into vs automation object model.
  • Build own type editor

all of this need to be researched more deeply if , the time allows me

:)

 

 

 

 

Share this post: | | | |
Posted by cipto with no comments

Maximizing VSTS Team Suite and Others below

VSTS Team suite include all of the 4 other's VSTS

VSTS Database Edition,VSTS Architecture Edition,VSTS Development Edition,VSTS Testing Edition.

if you haven't read the article 10 things you should know vsts then better search it.

 

You should install the VSTS Database Power Tools, VSTS Architecture Power tools

the Database edition power tools , Give's u extraordinary tools, Almost The same like RedGate- SQLBELT

Schema Compare, You can compare the schema(table, view,storeproc,function)  From one DB to another DB. Cool, and you can choose to create,update or skip the difference, in one button deploy to the target db

Data Compare,you can compare data from one instance db to another.

Refactor, ex: you want to change the schema from Sales to Marketing etc

DataGenerator-> Create your own Dummy data? Mew using regular expression. and you can choose how many rows

TSQL Editor-> Your own editor in single IDE WIndow MEW

Static Code analysis-> Mew they can even analyze your store proc,the query performance,etc.

And you can create your Database Test,

Create Database Project-> every schema would own it's .sql query. RIght click deploy , and whoala it's created for you.

 

 VSTS Architecture Power tools, give you the ability to create diagram

 For Abstract High level application one. you can click drag your solution projects link them together, create the webservice

and when you click to Implemet all . it's created for you, the power tools, give you the ability to create class library.

 

VSTS Development edition, Class diagram, etc.

 

VSTS Test Edition Give's you all the ability test that you can't find on other edition, such as Web Test, Load Test,Peformance Test

with web test we can see like other debugging proxy, and also can create rules for the responses etc.

for the load Test we can create like a stress tools, how many user log to our web

For the performance test, we can generate binary2 and then test it to our application and see the impact.

 

Combine these VSTS , and then The TFS , whoalah it's a complete Cycle.

:)

Top Markotok

 

 

Share this post: | | | |
Posted by cipto with no comments
Filed under:

Debugging Visualizer and Customized Object For Debugging/DebuggerTypeProxy

You can Create your own Visualizer while Debugging a type, say likethe example on the book,you can use an image debugging viewer , create Your own winform and Controls,

Right klik add new Debugger Visualizer on your classlibrary,

add the Form etc  put your logic on Show method.

Compiled put the dll on your visualizer folder on mydocument->visualstudio2008->visualizer

You can also Customize how the look When Debugging a type.

 Create an Internal Class , inside your class.

 Ex:

    internal class RbmProxy
        {
            private RBMInput RBM;
            public RbmProxy(RBMInput rbm)
            {
                RBM = rbm;
            }
            [DebuggerBrowsable(DebuggerBrowsableState.Never)]
            public string BirNumber { get { return RBM.SplitRawinput[1].ToString(); } }
            public string CustomerName { get { return RBM.SplitRawinput[2].ToString(); }
            }
            public string RBMCode { get { return RBM.SplitRawinput[3].ToString(); }
            }
            public DateTime DateReceived { get { return Convert.ToDateTime(RBM.SplitRawinput[4].ToString()); }
            }
            public DateTime DateIn { get { return Convert.ToDateTime(RBM.SplitRawinput[5].ToString()); }
            }
            public DateTime ProcessDate { get { return Convert.ToDateTime(RBM.SplitRawinputDevil.ToString()); }
            }
            public DateTime DateOut{ get { return Convert.ToDateTime(RBM.SplitRawinput[7].ToString()); }
            }
            public string status{ get { return RBM.SplitRawinputMusic.ToString(); }
            }
            public DateTime CaDate { get { return Convert.ToDateTime(RBM.SplitRawinput[9].ToString()); }
            }
            [DebuggerDisplay("{ValidationRules()}")]
            public string BusinessRulesViolation { get { return string.Empty; } }
            private string ValidationRules()
            {
                StringBuilder sb = new StringBuilder();
                if(BirNumber.Length<14) sb.Append("BirNumber can not less than 14;");
                if (DateOut < DateIn) sb.Append("Date Out Must be Larger than Date In;");
                if(!status.Equals("PASS") && !status.Equals("NO PASS"))
                sb.Append("Status can only be filled with 'PASS' or 'NO PASS';");
                return sb.ToString();
            }

 

add the debugger type proxy to your class

    [DebuggerTypeProxy(typeof(RbmProxy))]
    public class RBMInput : BaseGenericInput
    {

 

 when you run it , and on the debug mode you should see the debugger has already change the behaviour

 

 

Share this post: | | | |
Posted by cipto with no comments
Filed under:

huaahh Start The Engine with Tools

It's been a long and nice holiday. get ready to start your engine a.k.a Brain and mentality for the upcoming projects.

There are many tools that i unduh(Download)

Nevron Net Vision Enterprise, Download and try the demo but the Analyze one does not run. any idea what this is for?

Dissharp is used for like reflector,but user friendly, can view ildasm, what good can change code/dll from c# to VB or Delphi or CHROME IN A ZIP.
VSTRac is for used with trac open project (WIKI)
Aspose word Transfer, Can Generate Document(TEXT) into Word 2003,OpenXML 2007,PDF,Txt,Rich Test,Barcode Genrator.

Resharper 4.1

FxCop

Stylecop Plugin for resharper

SQL Assistant for Bringing the Intelese in your SQL management->Query (Cool)

Visual SVN 1.5 (Integrator Tool for subversion in visual studio)

SQL Tool Belt - RedGate

SyncroSVN Client v.4.0 - Helps u when merging the conflict

MZ.Tools.6.0.For.VS.NET.Enterprise.Editon - Kind like of external tools for IDE, not so usefull

MathML.NET.Control.v.2.1.6.0 - TOP BGTTTTTTT

ComponentArt.WebUI.2008.1.1085.3.For.ASP.NET.Ajax - Now this is something, Elegant, Nice Look, Nice Feauter, Fastttt Ajax not like those infra 

Data.Dynamics.Reports.v1.0.63.0 -  as it names implies , for generate reporting,Support vs2005 only

 

Share this post: | | | |
Posted by cipto with 2 comment(s)
Filed under: