Uncategorized

MCMS Restrict Posting only during 9am to 5pm

 

Check out the follwoing code sample , it shows how to allow posting in MCMS2002 only during 9am to 5pm

this is a classic example of how bussiness rules can be applied.

 

 

protected void CmsPosting_Submitted( Object sender, ChangedEventArgs e )

{

//get the posting

Posting post = e.Target

as Posting;

//Get the current time of server

String now = DateTime.Now.ToShortTimeString();

String []hr = now.Split(‘:’);

String []min = hr[1].Split(‘ ‘);

String amPm = min[1];

Int32 allowedStartHour = 9;

Int32 allowedEndHour = 5;

String allowedZone = "am";

 

 

if("am".Equals(amPm.ToLower()))

{

//check for 9 – 12 am (12 pm exclusive)

if(Int32.Parse(hr[0]) >= allowedStartHour && Int32.Parse(hr[0])<=11)

{

//allowed

Response.Write("The Posting is submitted sucessfully");

}

else

{

//delete

Response.Write("The Posting can only submitted at 9am to 5pm ");

CmsHttpContext.Current.CommitAll();

post.AcquireOwnership();

post.Delete();

CmsHttpContext.Current.CommitAll();

Response.Redirect("http://localhost/MCMS/McmsHomeport/McmsHomeport.aspx&quot;);

}

}

else if("pm".Equals(amPm.ToLower()))

{

//check for 12 – 5 pm

if(Int32.Parse(hr[0])>= 12 && Int32.Parse(hr[0])<=allowedEndHour-1)

{

//allowed

Response.Write("The Posting is submitted sucessfully");

}

else

{

Response.Write("The Posting can only submitted at 9am to 5pm ");

CmsHttpContext.Current.CommitAll();

post.AcquireOwnership();

post.Delete();

CmsHttpContext.Current.CommitAll();

Response.Redirect("http://localhost/MCMS/McmsHomeport/McmsHomeport.aspx&quot;);

}

}//end conditional logic

 

}

 

The only thing required is an HHTP CMSPosting Mudule , enrolled in web.config.

 

Advertisements
Uncategorized

MCMS 2002 & WWF (Architecture Overview)

Well one thing that i love about CMS 2002 workflow (yes if you dont know that ,this may be surprising to you ) is that its simple ( 3 step at most ) , secondly we have all the Events with much more authority , for example in contrast to SharePoint Portal Server 2003 Document Libarary Events (Uploading etc ) the events can stop the flow and revert the action something which is not possible SharePoint Portal Server 2003 DOcuemnt Libaray Events (you cant stop them they jsut happen and you are sort of notified!) .

Anyways come back to the subject of Workflow , i want to design a workflow for CMS 2002 using WWF (offcourse how can i forget that , group moderator please dont kick me out  ) , here is a simple digram of what i had in mind (by the way can i place a full visio picture here )

__________________________________________________________________

MCMS Aplication Boundary                                        WWF Execution Engine    
__________________________________________________________________
——————                                                         
MCMS HTTPModule                                                             Start   
—————–                                                                        _                   
          ::                    <–MCMS Context Passed–>        Activities 1..n      
                                                                                               –
—————–                                                                     End
    Global.asax
—————– 

_________________________________________________________________

Now i recon that we passed the MCMSContext/Object to WWF where activites and all the logic is build , and later give the acknowledgment back to the caller , which in our case is Global.asax .

Uncategorized

WFF Rocks and more

Windows Workflow Foundation is one the coolest thing that i see in years , its prrety much in news and hype is quite massive (http://msdn.microsoft.com/windowsvista/building/workflow/) . Well I start playing with it  and as it is in beta1 it still behaves quite fine accept few hitches . I also develop a custom Activitie which you can find at http://www.windowsworkflow.net/ControlGallery/ControlDetail.aspx?Control=2229&tabindex=2 .
Well gona update on this in the future ! .
Uncategorized

Artcile On WSS/SharePoint Server 2003 Architecture

Well i want to write on this topic for quite a while , the article not only explains the architecure but also examine the  roles of IIS6.0 and ASP.NET.
 
check it out at
 
 
 
 
Uncategorized

My First Blog Entry

 
This is my first blog entry ………………….
Lets put it this way
 
class Blog
{
 
         try
         {
                  //try to do blogging
                   doBlogging();
            }
 
 catch (System.Blog.Exception exp)
          {
        
                 throw exp ; // hope fully some day some one will catch it
          }
 
}