About Me

My photo
a Dynamic and Energetic guy.....

Monday, May 25, 2009

My Career After One Year + My Interests In Next Year

We did many sharepoint implementations. But......

What we did more, other than sharepoint branding & small customization

(1) ( 1) Build using feature

(2) (2) Fire feature activation events & add tracking

(3) (3) Configure RMS (Rights Management Server)

(4) (4) Change whole master pages using features & SPD (Sharepoint Designer)

(5) (5) Add Ajax enable webparts into sharepoint sites

(6) (6) Active directory users migration using SSP


We did workflows other than simple approval workflows

(1) (1) Dynamic workflows (No of levels)

(2) (2) Dynamic approvers (different approvers)

(3) (3) Configure SSL

(4) (4) Reports generations using SSRS

(5) (5)Creating Collect feedback, Collect signature workflows

(6) (6) InfoPath forms integration using X-Path to workflows








Thursday, May 14, 2009

Write a TRIGGER when data INSERT into table

USE SalesOne;
GO
IF OBJECT_ID ('SalesOne.reminder4', 'TR') IS NOT NULL
DROP TRIGGER SalesOne.reminder4;
GO
CREATE TRIGGER reminder4
ON SalesOne.dbo.Assets
AFTER INSERT,UPDATE
AS
--RAISERROR ('Notify Customer Relations', 16, 10);
UPDATE Assets SET LastUpdated = {fn now()}
GO

Thursday, April 23, 2009

Play with SQL

// getting today
SET @today = CONVERT(CHAR(8), GETDATE(), 112)

//getting first day of month
SELECT DATEADD(DAY, - DATEPART(DAY, CONVERT(CHAR(8), GETDATE(), 112)) + 1, CONVERT(CHAR(8), GETDATE(), 112)) AS firstDay

//getting last day of month
SELECT DATEADD(DAY, - DATEPART(DAY, CONVERT(CHAR(8), GETDATE(), 112)), DATEADD(MONTH, 1, CONVERT(CHAR(8), GETDATE(), 112))) AS lstDay


IF EXISTS

(
SELECT
Date,IsUnblock
FROM
SOSupervisorRemarks
WHERE (Date = '11/30/2009 12:00:00 AM')
)
UPDATE SOSupervisorRemarks SET IsUnblock='False' WHERE Date = '11/30/2009 12:00:00 AM'
ELSE
INSERT INTO SOSupervisorRemarks (Date,IsUnblock) VALUES ('11/30/2009 12:00:00 AM', 'false')


//Getting Date Value from DateTime
dateadd(dd,0, datediff(dd,0,tblSLSale.ExchangeDate)) as ExchangeDate

Monday, April 20, 2009

Apply a style sheet + style class programatically

Finally we were managed to do this(Apply a style sheet programatically ) :)

Table objTable = new Table();

objTable.Attributes.Add("href", "txtstyle.css");
objTable.Attributes.Add("type", "text/css");
objTable.Attributes.Add("rel", "stylesheet");
objTable.Attributes.Add("class", "ph11");

Page.Controls.Add(objTable);


Remember to add tag in "ASPX" page also
<
link
href="txtstyle.css"
rel="stylesheet"
type="text/css"
/>

Friday, April 17, 2009

Tips in Windows Mobile Development

*** It is a scale down version, So you wont get all features as .NET framework
*** You should install .NET Compact framework(3.5) + SQL compact version.

*** Try to use ShowDialog() other than Show()
*** Use Singleton pattern to avoid load many occurances of single form
*** Its easy to user picture/image buttons than menu click
*** Its good to use cursor until data is loading to the form

*** SQL Compact framework doesn't support statements like "IF EXITS"

*** If you want to connect to a Mobile(Compact) DB in ASP.NET add following method
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
this allow you to connect to a DB that has .SDF extension :)


Thursday, March 12, 2009

Active Directory Properties

Now its simple, You can get more details using the "DirectoryEntry" object

It consists of a hashtable, that includes properties

"countrycode"

"cn"

"lastlogoff"

"usncreated"

"whenchanged"

"memberof"

"accountexpires"

"displayname"

"primarygroupid"

"badpwdcount"

"samaccounttype"

"givenname"

"mail"

"adspath"

"pwdlastset"

"manager"

"logoncount"

"name"

"usnchanged"

"userprincipalname"

"admincount"

"badpasswordtime"

"objectsid"

"distinguishedname"

"lastlogontimestamp"

Sunday, March 8, 2009

How to find selected checkbox controls inside Webpage

using System.Collections.Generic;

protected void StoreSelectedDates()
{
Control[] allControls = FlattenHierachy(Page);

foreach (Control control in allControls)
{
CheckBox mycheckBox = control as CheckBox;
if (mycheckBox != null)
{
if (mycheckBox.Checked)
{
try
{
string setDay = mycheckBox.ID.Substring(3);
}
catch (Exception ex)
{}
}
}
}


private Control[] FlattenHierachy(Control root)

{
List list = new List();
list.Add(root);
if (root.HasControls())
{
foreach (Control control in root.Controls)
{
list.AddRange(FlattenHierachy(control));
}
}
return list.ToArray();
}



How to write a Stored Procedure with a Cursor

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: chanaka
-- Create date: 04/03/2009
-- Description:
-- =============================================
CREATE PROCEDURE dbo.SearchRegionWise
-- Add the parameters for the stored procedure here
@firstPara nvarchar(25),
@secondPara nvarchar(25)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
DROP TABLE TemporySearchData
CREATE TABLE TemporySearchData(OfferID nvarchar(50), UserID nvarchar(50), StartLocation nvarchar(100), Destination nvarchar(100))
DECLARE @firstName nvarchar(25)
DECLARE @nextName nvarchar(25)
DECLARE @addString nvarchar(25)
DECLARE @UserID nvarchar(50)
DECLARE @StartLocation nvarchar(50)
DECLARE @Destination nvarchar(50)

DECLARE firstCursor CURSOR FOR (SELECT LocationName FROM dbo.tblLocation WHERE (RegionId =
(SELECT RegionId FROM dbo.tblLocation AS tblLocation_1 WHERE (LocationName = @firstPara))))
OPEN firstCursor
FETCH NEXT FROM firstCursor INTO @firstName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @firstName

DECLARE loopCursor CURSOR READ_ONLY FOR (SELECT LocationName FROM dbo.tblLocation WHERE (RegionId =
(SELECT RegionId FROM dbo.tblLocation AS tblLocation_1 WHERE (LocationName = @secondPara))))
OPEN loopCursor
FETCH NEXT FROM loopCursor INTO @nextName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @nextName

DECLARE loopInfo CURSOR READ_ONLY FOR (SELECT DISTINCT dbo.tblTravelOffer.tblTravelId, dbo.tblTravelOffer.UserId, dbo.tblTravelOffer.StartLocation, dbo.tblTravelOffer.Destination FROM dbo.tblTravelOffer WHERE dbo.tblTravelOffer.StartLocation = @firstName AND dbo.tblTravelOffer.Destination = @nextName)
OPEN loopInfo
FETCH NEXT FROM loopInfo INTO @addString, @UserID, @StartLocation, @Destination
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO TemporySearchData (OfferID, UserID, StartLocation, Destination)
VALUES (@addString, @UserID, @StartLocation, @Destination)
FETCH NEXT FROM loopInfo INTO @addString, @UserID, @StartLocation, @Destination
END
CLOSE loopInfo
DEALLOCATE loopInfo
FETCH NEXT FROM loopCursor INTO @nextName
END
CLOSE loopCursor
DEALLOCATE loopCursor
FETCH NEXT FROM firstCursor INTO @firstName
END
CLOSE firstCursor
DEALLOCATE firstCursor
select * from dbo.TemporySearchData
END
GO

Friday, March 6, 2009

Get User belongs Active Groups

public string[] getUserBelongsGroup(string userName)
{
DirectoryEntry objDirEntry = GetUserInforamtionFromAD(userName);

PropertyValueCollection objPVC = objDirEntry.Properties["memberof"];
string[] strData = new string[objPVC.Count];
for (int count = 0; count < objPVC.Count; count++)
{
strData[count] = objPVC[count].ToString().Split(new char[] { ',' })[0].Substring(3);
}
return strData;
}


public DirectoryEntry GetUserInforamtionFromAD(string _UserName)
{
// Create a DirectorySearcher object using the user name as the LDAP search filter. If using a directory other than Exchange, use sAMAccountName instead of mailNickname.
string strActualName = _UserName.Split(new char[] {'\\'})[1].ToString();
DirectorySearcher searcher = new DirectorySearcher("(cn=" + strActualName + ")");

// Search for the specified user.
SearchResult result = searcher.FindOne();


if (result == null)
{
return null;
}
else
{
// Create a DirectoryEntry object to retrieve the collection of attributes (properties) for the user.
DirectoryEntry user = result.GetDirectoryEntry();
return user;
}
}

Thursday, February 19, 2009

Create Record Repository inside Sharepoint

1.Create a web application

2.Use “Record Center” template to create site

[eg: http://server03:2222]

3. Central administration --> Application Management --> External Services --> Records Center --> ”Ironone Record Center” -->

http://server03:2222/_vti_bin/officialfile.asmx

4. Create a document library --> Add a document

5. Right Click the document --> Send to "Ironone Record Center"

My Masters