Friday, February 25, 2011

open color model window

source:
==========
   <link media="screen" rel="stylesheet" href="script/colorbox/colorbox.css" />

    <script type="text/javascript" src="script/colorbox/jquery.colorbox.js"></script>



function OpenModalWindow(TicketID) {

            //window.open("EditTicketDetail.aspx?TID=" + TicketID, "EditTicket", "width=800,height=500,resizable=no,scrollbars=yes");
            $jqry("#edit" + TicketID).colorbox({ width: "800", height: "700",  transition: "fade", href: "EditTicketDetail.aspx?TID=" + TicketID, iframe: true });
            $jqry("#cboxClose").append('saddddddddddddddddd');
            alert($jqry("#cboxClose").text);
            //$('selector').colorbox({onLoad: function() {  $('#cboxClose').remove();}});
        }


grid
=======



 <asp:TemplateField ItemStyle-Width="50px" HeaderText="Action" HeaderStyle-HorizontalAlign="Right">
                                                            <ItemTemplate>
                                                                <a href="#" id='edit<%# Eval("TicketID") %>' class="editbutton" onclick="javascript:OpenModalWindow('<%# Eval("TicketID") %>')">
                                                                    Edit</a> <a href="#" id='<%# Eval("TicketID") %>' class="delbutton">
                                                                        <img border="0" src="WHT_Images/delete.jpg" alt="Delete" /></a>
                                                            </ItemTemplate>
                                                            <ItemStyle Width="50px"></ItemStyle>
                                                        </asp:TemplateField>




http://buckwilson.me/lightboxme/ 

 $.colorbox({ href:"TicketUpload/TktOnline.aspx", iframe:true, innerWidth:900, innerHeight:650 });

Thursday, February 24, 2011

Monday, February 21, 2011

Wednesday, February 16, 2011

Download file in directory

 ArrayList FoldersFiles = new ArrayList();
            string strFolder = Server.MapPath("~/Etickets/");        //"C:\\Etickets\\";
            DirectoryInfo folder = new DirectoryInfo(strFolder);

            if (folder.Exists)
            {
                string[] Folder;
                Folder = Directory.GetDirectories(strFolder);
                foreach (string FolderName in Folder)
                {
                    FileInfo fi = new FileInfo(FolderName);
                    FoldersFiles.Add(fi.Name);
                    if (e.CommandArgument.ToString() == fi.Name)
                    {

                        string[] files;

                        string path = strFolder;
                        path += e.CommandArgument.ToString();
                        DirectoryInfo di = new DirectoryInfo(path);
                         FileInfo[] rgFiles = di.GetFiles("*.pdf");
                    
                         foreach (FileInfo fileName in rgFiles)
                        {
                  

                            Response.ContentType = "Application/pdf";

                            Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
                            Response.TransmitFile(path +"\\"+ fileName);
                       
                            Response.End();
                        }
                            
                   

                    }
            
                }

            }

        }

Uploading file into a directory

 string UserID = Session["UserID"].ToString();
            string importFileDirectory = string.Empty;
            importFileDirectory = "C:\\Inetpub\\wwwroot\\whohastwo\\Etickets\\";
           // importFileDirectory = "C:\\Etickets\\";
            //string SellerDirectory = importFileDirectory + UserID + "\\";
            string SellerDirectory = importFileDirectory + TicketId + "\\";
            if (FileEticketPdf.HasFile && Path.GetExtension(FileEticketPdf.FileName) == ".pdf")
            {
                if(!Directory.Exists(SellerDirectory))
                {
                    Directory.CreateDirectory(SellerDirectory);
                
                }
                // Replacing Filename with TicketID
                string var = FileEticketPdf.FileName;
                File = var.Replace(var, TicketId + ".pdf");
                FileEticketPdf.SaveAs(SellerDirectory + File);

Tuesday, February 8, 2011

jquery links

http://www.telerik.com/products/aspnet-ajax.aspx

http://blog.stevensanderson.com/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/(uploading

control)

http://www.asp.net/ajax/videos


http://blog.themeforest.net/screencasts/jquery-for-absolute-beginners-video-series/

Thursday, February 3, 2011

silverlight links code samples

http://silverlightmsgbox.codeplex.com/wikipage?title=Example%20Code

http://www.cellbi.com/Content/UI/Views/BlogItem.aspx?page=3731&AspxAutoDetectCookieSupport=1

http://www.silverlight.net/community/samples/silverlight-samples/

http://www.silverlight.net/content/samples/sl2/silverlightcontrols/run/default.html

http://aspalliance.com/silverlight/(silver light controls)
http://uiatoms.neurospeech.com/silverlight/index.html

http://blogs.silverlight.net/blogs/justinangel/archive/2009/05/19/silverlight-treeview-advanced-scenarios-treeviewextended.aspx

http://demos.telerik.com/silverlight/silverlight3/#ColorPicker/FirstLook

Tuesday, February 1, 2011

WCF SECURITY

http://www.c-sharpcorner.com/UploadFile/shivprasadk/1260/Default.aspx

pivot example sp

USE [Relishdb]
GO
/****** Object:  StoredProcedure [dbo].[sp_salestransaction_monthlyrep]    Script Date: 02/01/2011 17:41:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_salestransaction_monthlyrep] --1,1
(
@locationId int,
@monthid int
)--'cibertowers', 1
as
begin


declare @date datetime
set  @date = (select top 1 Trasdate from salestransaction where moncol=@monthid)

DECLARE @lastDate DATETIME
SET @lastDate = @date



 set @lastDate =  (SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@lastDate)+1,0))LastDay_AnyMonth)

DECLARE @firstdate DATETIME
SEt @firstdate = @date

--Get First Day of a Month Using SQL Queryset
set @firstdate = (SELECT DATEADD(dd,-(DAY(DATEADD(mm,1,@firstdate))-1),DATEADD(mm,0,@firstdate)))



select  [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31] , 'Espresso' as productname,  (select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Espresso from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate ) p pivot (sum(Espresso) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt
union all
select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Cappuccino' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Cappuccino from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Cappuccino) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt
union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Latte' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Latte from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Latte) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt
 union all

 select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Tea' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Tea from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Tea) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Lemon tea' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Lemontea from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Lemontea) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt

union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Milk' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Milk from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Milk) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Green tea' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Greentea from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Greentea) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt

union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Boost' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Boost from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Boost) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Horlicks' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Horlicks from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Horlicks) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'Dialy milk' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,Dailymilk from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(Dailymilk) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'chocomilk' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,chocolatemilk from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(chocolatemilk) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


union all

select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],'soop' as productname,(select convert(varchar(50),@lastDate,106)) as Lastdate, (select convert(varchar(50),@firstdate,106)) as Firstdate
from (select daycol,soop from salestransaction where locationId=@locationId and Trasdate between @firstdate and @lastDate) p pivot (sum(soop) for daycol in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))as pvt


end


exec [dbo].[sp_salestransaction_monthlyrep] 1,2

Azure links