0

I need to convert this into PHP. I heard of ASP to PHP convert programs but they don't work they just append $ to a couple of places thats all. Since my other posts have remained unanswered I don't really expect replies from here either, but I a desperate. Could someone plz convert this in to php.

File1:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="scheduleGame.aspx.cs" Inherits="scheduleGame" MasterPageFile="~/uds.master" %>
<%@ Register src="include/splitSlot.ascx" tagname="slot" tagprefix="uc1" %>

<asp:Content ID="contentTitle" ContentPlaceHolderID="pageTitle" runat="server">
    <title>City UDS: Schedule Game</title>
    </asp:Content>
<asp:Content ID="contentheader" ContentPlaceHolderID="header" runat="server">
        <tr><td class="pagetitle">City UDS: Schedule Game</td></tr>
        <tr><td class="pagesubtitle">Project ID <%=objProj.projectName%> </td></tr>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="mainView" Runat="Server">

<table cellpadding=0 cellspacing=0 border=0>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" align=center><asp:Label CssClass="error" runat=server ID="lblError" Visible=false >&nbsp;</asp:Label></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>


<td class="normaltd" style="vertical-align:top;">
    <asp:DataGrid id="dgWeek" CssClass="dgWeek" DataKeyField="slots" runat="server" AutoGenerateColumns=false>
                <Columns>
                    <asp:BoundColumn DataField="slots"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Monday">
                        <ItemTemplate >
                            <uc1:slot ID="ucdsMon" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Tuesday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsTues" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Wednesday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsWed" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Thursday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsThu" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Friday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsFri" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    
                </Columns>
            </asp:DataGrid>
</td> 


<td class="normaltd" style="vertical-align:top;">
    <asp:DataGrid id="dgWeek2" CssClass="dgWeek" DataKeyField="slots" runat="server" AutoGenerateColumns="false">
                <Columns>
                    <asp:BoundColumn DataField="slots" Visible="false"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Monday">
                        <ItemTemplate >
                            <uc1:slot ID="ucdsMon" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Tuesday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsTues" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Wednesday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsWed" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Thursday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsThu" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="Friday">
                        <ItemTemplate>
                            <uc1:slot ID="ucdsFri" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    
                </Columns>
            </asp:DataGrid>
</td> 

</tr>
<tr><td colspan="2">&nbsp;</td></tr
<tr><td colspan="2"><asp:Button runat="server" ID="btnSendGameRequest" Text="send Game request" 
            onclick="btnSendGameRequest_Click" /></td></tr>
</table>
    
    <asp:HiddenField ID="hdnStartWeekDate" runat="server" Value="14:09/2008" />
    <asp:HiddenField ID="hdnStartWeek2Date" runat="server" Value="14:09/2008" />
        
        
</asp:Content>

File2:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class scheduleGame : System.Web.UI.Page
{
    protected projectServices.project objProj;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["proj_id"] == null)
        {
            Response.Redirect("login.aspx");
        }
        
        if (!IsPostBack)
        {
            //if (Session["slots"] != null) Session.Remove("slots");
            setStartDates();
            setProject();
            fillWeek();
            fillWeek2();
        }
        else
        {
            objProj = (projectServices.project)ViewState["project"];
        }
        
    }

    private void setStartDates()
    {
        appConfigServices.appConfig objAC = appConfigServices.getAppConfig();
        string w1 = Convert.ToDateTime(objAC.week1startdate.ToString()).Day + ":" + Convert.ToDateTime(objAC.week1startdate.ToString()).Month + "/" + Convert.ToDateTime(objAC.week1startdate.ToString()).Year;
        string w2 = Convert.ToDateTime(objAC.week2startdate.ToString()).Day + ":" + Convert.ToDateTime(objAC.week2startdate.ToString()).Month + "/" + Convert.ToDateTime(objAC.week2startdate.ToString()).Year;
        w1 = objAC.w1Day.ToString() + ":" + objAC.w1Month + "/" + objAC.w1Year;
        w2 = objAC.w2Day.ToString() + ":" + objAC.w2Month + "/" + objAC.w2Year;

        //Response.Write(w1 + " - " + w2);
        hdnStartWeekDate.Value = w1;
        hdnStartWeek2Date.Value = w2;
    }
    
    private void preselectSlots()
    {
        if (Session["slots"] != null)
        {
            string[] slotIds = Session["slots"].ToString().Replace("'", "").Split(',');
            string slotId;

            foreach (string sid in slotIds)
            {
                //Response.Write(dgWeek.Items.Count);
                foreach (DataGridItem dgi in dgWeek.Items)
                {
                    
                    for (int i = 1; i < dgWeek.Columns.Count; i++)
                    {
                        int slotType = Convert.ToInt16(((include_splitslot)dgi.Cells[i].Controls[1]).slotType());
                        slotId = ((include_splitslot)dgi.Cells[i].Controls[1]).slotId();
                        
                        if (sid == slotId.ToString())
                        {
                            //Response.Write(sid + "-" + slotId.ToString() + "<br>");
                            ((include_splitslot)dgi.Cells[i].Controls[1]).selectSlot();
                        }
                    }
                }
            }
        }
    }

    private void preselectSlots2()
    {
        if (Session["slots"] != null)
        {
            string[] slotIds = Session["slots"].ToString().Replace("'", "").Split(',');
            string slotId;

            foreach (string sid in slotIds)
            {
                //Response.Write(dgWeek.Items.Count);
                foreach (DataGridItem dgi in dgWeek2.Items)
                {

                    for (int i = 1; i < dgWeek2.Columns.Count; i++)
                    {
                        int slotType = Convert.ToInt16(((include_splitslot)dgi.Cells[i].Controls[1]).slotType());
                        slotId = ((include_splitslot)dgi.Cells[i].Controls[1]).slotId();

                        if (sid == slotId.ToString())
                        {
                            //Response.Write(sid + "-" + slotId.ToString() + "<br>");
                            ((include_splitslot)dgi.Cells[i].Controls[1]).selectSlot();
                        }
                    }
                }
            }
        }
    }

    private void setProject()
    {

        objProj = projectServices.getProjectById(Session["proj_id"].ToString());
        ViewState.Add("project", objProj);
    }

    protected string getProjectName(string strProjectid)
    {
        string strProjectName = "";
        

        return (strProjectName);
    }

    private void fillWeek()
    {
        DataSet dsWeek = new DataSet();
        dsWeek.Tables.Add(new DataTable("dtWeek"));

        int startDay = Convert.ToInt16(hdnStartWeekDate.Value.ToString().Split(':')[0]);
        int month = Convert.ToInt16(hdnStartWeekDate.Value.ToString().Split(':')[1].Split('/')[0]);
        int year = Convert.ToInt16(hdnStartWeekDate.Value.ToString().Split(':')[1].Split('/')[1]);

        for (int i = 0; i < 5; i++)
        {

            int day = startDay + i;
            int mon = month;
            int yr = year;
            if (month == 2)//feb
            {
                if (year % 4 == 0)
                {
                    if (day >= 30)
                    {
                        day = day % 29;
                        mon = month + 1;
                    }
                }
                else
                {
                    if (day >= 29)
                    {
                        day = day % 28;
                        mon = month + 1;
                    }
                }
            }
            else
            {
                if (month == 4 || month == 6 || month == 9 || month == 11)
                {
                    if (day >= 31)
                    {
                        day = day % 30;
                        mon = month + 1;
                    }
                }
                else
                {
                    if (month != 12)
                    {
                        if (day >= 32)
                        {
                            day = day % 31;
                            mon = month + 1;
                        }
                    }
                    else
                    {
                        if (day >= 32)
                        {
                            day = day % 31;
                            mon = 1;
                            yr = year + 1;
                        }
                    }
                }
            }
            dgWeek.Columns[i + 1].HeaderText = dgWeek.Columns[i + 1].HeaderText.Split(' ')[0] + " (" + day + "/" + mon + "/" + yr + ")";
        }

        //add columns
        DataColumn dc1 = new DataColumn("slots");
        DataColumn dc2 = new DataColumn("monday");
        DataColumn dc3 = new DataColumn("tuesday");
        DataColumn dc4 = new DataColumn("wednesday");
        DataColumn dc5 = new DataColumn("thursday");
        DataColumn dc6 = new DataColumn("friday");

        dsWeek.Tables[0].Columns.Add(dc1);
        dsWeek.Tables[0].Columns.Add(dc2);
        dsWeek.Tables[0].Columns.Add(dc3);
        dsWeek.Tables[0].Columns.Add(dc4);
        dsWeek.Tables[0].Columns.Add(dc5);
        dsWeek.Tables[0].Columns.Add(dc6);

        for (int i = Convert.ToInt16(System.Configuration.ConfigurationSettings.AppSettings["dayStartHours"]); i < Convert.ToInt16(System.Configuration.ConfigurationSettings.AppSettings["dayEndHours"]); i += 50)
        {
            DataRow dr = dsWeek.Tables[0].NewRow();
            dr["slots"] = i.ToString().PadLeft(4, '0').Insert(2, ":").Replace("50", "30");
            dr["monday"] = 0;
            dr["tuesday"] = 0;
            dr["wednesday"] = 0;
            dr["thursday"] = 0;
            dr["friday"] = 0;
            dsWeek.Tables[0].Rows.Add(dr);
        }

        dgWeek.DataSource = dsWeek;
        dgWeek.DataBind();

        fillSlots();
        fill2MSlots();
        preselectSlots();
    }

    private void fillWeek2()
    {
        DataSet dsWeek = new DataSet();
        dsWeek.Tables.Add(new DataTable("dtWeek"));

        int startDay = Convert.ToInt16(hdnStartWeek2Date.Value.ToString().Split(':')[0]);
        int month = Convert.ToInt16(hdnStartWeek2Date.Value.ToString().Split(':')[1].Split('/')[0]);
        int year = Convert.ToInt16(hdnStartWeek2Date.Value.ToString().Split(':')[1].Split('/')[1]);

        for (int i = 0; i < 5; i++)
        {

            int day = startDay + i;
            int mon = month;
            int yr = year;
            if (month == 2)//feb
            {
                if (year % 4 == 0)
                {
                    if (day >= 30)
                    {
                        day = day % 29;
                        mon = month + 1;
                    }
                }
                else
                {
                    if (day >= 29)
                    {
                        day = day % 28;
                        mon = month + 1;
                    }
                }
            }
            else
            {
                if (month == 4 || month == 6 || month == 9 || month == 11)
                {
                    if (day >= 31)
                    {
                        day = day % 30;
                        mon = month + 1;
                    }
                }
                else
                {
                    if (month != 12)
                    {
                        if (day >= 32)
                        {
                            day = day % 31;
                            mon = month + 1;
                        }
                    }
                    else
                    {
                        if (day >= 32)
                        {
                            day = day % 31;
                            mon = 1;
                            yr = year + 1;
                        }
                    }
                }
            }
            dgWeek2.Columns[i + 1].HeaderText = dgWeek2.Columns[i + 1].HeaderText.Split(' ')[0] + " (" + day + "/" + mon + "/" + yr + ")";
        }

        //add columns
        DataColumn dc1 = new DataColumn("slots");
        DataColumn dc2 = new DataColumn("monday");
        DataColumn dc3 = new DataColumn("tuesday");
        DataColumn dc4 = new DataColumn("wednesday");
        DataColumn dc5 = new DataColumn("thursday");
        DataColumn dc6 = new DataColumn("friday");

        dsWeek.Tables[0].Columns.Add(dc1);
        dsWeek.Tables[0].Columns.Add(dc2);
        dsWeek.Tables[0].Columns.Add(dc3);
        dsWeek.Tables[0].Columns.Add(dc4);
        dsWeek.Tables[0].Columns.Add(dc5);
        dsWeek.Tables[0].Columns.Add(dc6);

        for (int i = Convert.ToInt16(System.Configuration.ConfigurationSettings.AppSettings["dayStartHours"]); i < Convert.ToInt16(System.Configuration.ConfigurationSettings.AppSettings["dayEndHours"]); i += 50)
        {
            DataRow dr = dsWeek.Tables[0].NewRow();
            dr["slots"] = i.ToString().PadLeft(4, '0').Insert(2, ":").Replace("50", "30");
            dr["monday"] = 0;
            dr["tuesday"] = 0;
            dr["wednesday"] = 0;
            dr["thursday"] = 0;
            dr["friday"] = 0;
            dsWeek.Tables[0].Rows.Add(dr);
        }

        dgWeek2.DataSource = dsWeek;
        dgWeek2.DataBind();

        fillSlots2();
        fill2MSlots2();
        preselectSlots2();
    }

    private void fillSlots()
    {
        string err = "";
        DataSet ds = slotServices.getIndividualSlots(Convert.ToInt16(Session["individ"].ToString()), ref err);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {

            string slotId = dr["slotid"].ToString();
            //string strDate = dr["sDateTime"].ToString();
            string year = dr["year"].ToString();
            string month = dr["month"].ToString();
            string day = dr["day"].ToString();
            string hour = dr["hour"].ToString();
            string min = dr["min"].ToString();

            string strSlotType = dr["slotPriorityCode"].ToString();
            string strDay = ""; 
            string strSlotTime;
            //if (strDate.IndexOf("AM") >= 0 || strDate.IndexOf("PM") >= 0)
            //{
            //    strDay = strDate.Split('/')[1];
            //    if (strDate.Split(' ')[2].ToUpper() == "PM" && Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0]) != 12)
            //    {
            //        strSlotTime = (Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0]) + 12).ToString().PadLeft(2, '0') + ":" + strDate.Split(' ')[1].Split(':')[1];
            //    }
            //    else
            //    {
            //        strSlotTime = (Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0])).ToString().PadLeft(2, '0') + ":" + strDate.Split(' ')[1].Split(':')[1];
            //    }
            //}
            //else
            //{
            //    strDay = strDate.Split('/')[0];
            //    strSlotTime = (Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0])).ToString().PadLeft(2, '0') + ":" + strDate.Split(' ')[1].Split(':')[1];
            //}
            strDay = day;
            strSlotTime = hour.PadLeft(2, '0') + ":" + min.PadLeft(2, '0');


            foreach (DataGridItem dgi in dgWeek.Items)
            {
                if (strSlotTime == dgWeek.DataKeys[dgi.ItemIndex].ToString())
                {
                    for (int i = 0; i < 5; i++)
                    {
                        int dy = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[0]) + i;
                        int mon = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[1].Split('/')[0]);
                        int yr = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[1].Split('/')[1]);
                        if (mon == 2)//feb
                        {
                            if (yr % 4 == 0)
                            {
                                if (dy >= 30)
                                {
                                    dy = dy % 29;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (dy >= 29)
                                {
                                    dy = dy % 28;
                                    mon = mon + 1;
                                }
                            }
                        }
                        else
                        {
                            if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
                            {
                                if (dy >= 31)
                                {
                                    dy = dy % 30;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (mon != 12)
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = mon + 1;
                                    }
                                }
                                else
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = 1;
                                        yr = yr + 1;
                                    }
                                }
                            }
                        }

                        if (strDay == dy.ToString() && month == mon.ToString() && year == yr.ToString())
                        {
                            ((include_splitslot)dgi.Cells[i + 1].Controls[1]).setSlotType(strSlotType,slotId);
                            //if (strSlotType.ToUpper() == "H") hSlotCount += 1;
                            //if (strSlotType.ToUpper() == "L") lSlotCount += 1;
                        }
                    }
                }
            }
        }
    }

    private void fill2MSlots()
    {
        string err = "";
        //fetch the second marker
        string otherMarker = "";
        if (objProj.supervisorid.ToString().Equals(Session["individ"].ToString())) otherMarker = objProj.markerid.ToString(); else otherMarker = objProj.supervisorid.ToString(); 
        DataSet ds = slotServices.getIndividualSlots(Convert.ToInt16(otherMarker), ref err);

        if (Session["othermarker"] == null) Session.Add("othermarker", otherMarker);
        else Session["othermarker"] = otherMarker;

        foreach (DataRow dr in ds.Tables[0].Rows)
        {

            //string strDate = dr["sDateTime"].ToString();
            string year = dr["year"].ToString();
            string month = dr["month"].ToString();
            string day = dr["day"].ToString();
            string hour = dr["hour"].ToString();
            string min = dr["min"].ToString();

            string strSlotType = dr["slotPriorityCode"].ToString();
            string strDay = "";
            string strSlotTime;
            //if (strDate.IndexOf("AM") >= 0 || strDate.IndexOf("PM") >= 0)
            //{
            //    strDay = strDate.Split('/')[1];
            //    if (strDate.Split(' ')[2].ToUpper() == "PM" && Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0]) != 12)
            //    {
            //        strSlotTime = (Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0]) + 12).ToString().PadLeft(2, '0') + ":" + strDate.Split(' ')[1].Split(':')[1];
            //    }
            //    else
            //    {
            //        strSlotTime = (Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0])).ToString().PadLeft(2, '0') + ":" + strDate.Split(' ')[1].Split(':')[1];
            //    }
            //}
            //else
            //{
            //    strDay = strDate.Split('/')[0];
            //    strSlotTime = (Convert.ToInt16(strDate.Split(' ')[1].Split(':')[0])).ToString().PadLeft(2, '0') + ":" + strDate.Split(' ')[1].Split(':')[1];
            //}

            strDay = day;
            strSlotTime = hour.PadLeft(2, '0') + ":" + min.PadLeft(2, '0');


            foreach (DataGridItem dgi in dgWeek.Items)
            {
                if (strSlotTime == dgWeek.DataKeys[dgi.ItemIndex].ToString())
                {
                    for (int i = 0; i < 5; i++)
                    {
                        int dy = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[0]) + i;
                        int mon = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[1].Split('/')[0]);
                        int yr = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[1].Split('/')[1]);
                        if (mon == 2)//feb
                        {
                            if (yr % 4 == 0)
                            {
                                if (dy >= 30)
                                {
                                    dy = dy % 29;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (dy >= 29)
                                {
                                    dy = dy % 28;
                                    mon = mon + 1;
                                }
                            }
                        }
                        else
                        {
                            if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
                            {
                                if (dy >= 31)
                                {
                                    dy = dy % 30;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (mon != 12)
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = mon + 1;
                                    }
                                }
                                else
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = 1;
                                        yr = yr + 1;
                                    }
                                }
                            }
                        }

                        if (strDay == dy.ToString() && month == mon.ToString() && year == yr.ToString())
                        {
                            ((include_splitslot)dgi.Cells[i + 1].Controls[1]).set2SlotType(strSlotType);
                            //if (strSlotType.ToUpper() == "H") hSlotCount += 1;
                            //if (strSlotType.ToUpper() == "L") lSlotCount += 1;
                        }
                    }
                }
            }
        }
    }








    private void fillSlots2()
    {
        string err = "";
        DataSet ds = slotServices.getIndividualSlots(Convert.ToInt16(Session["individ"].ToString()), ref err);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {

            string slotId = dr["slotid"].ToString();
            //string strDate = dr["sDateTime"].ToString();
            string year = dr["year"].ToString();
            string month = dr["month"].ToString();
            string day = dr["day"].ToString();
            string hour = dr["hour"].ToString();
            string min = dr["min"].ToString();

            string strSlotType = dr["slotPriorityCode"].ToString();
            string strDay = "";
            string strSlotTime;
            
            strDay = day;
            strSlotTime = hour.PadLeft(2, '0') + ":" + min.PadLeft(2, '0');


            foreach (DataGridItem dgi in dgWeek2.Items)
            {
                if (strSlotTime == dgWeek2.DataKeys[dgi.ItemIndex].ToString())
                {
                    for (int i = 0; i < 5; i++)
                    {
                        int dy = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[0]) + i;
                        int mon = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[1].Split('/')[0]);
                        int yr = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[1].Split('/')[1]);
                        if (mon == 2)//feb
                        {
                            if (yr % 4 == 0)
                            {
                                if (dy >= 30)
                                {
                                    dy = dy % 29;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (dy >= 29)
                                {
                                    dy = dy % 28;
                                    mon = mon + 1;
                                }
                            }
                        }
                        else
                        {
                            if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
                            {
                                if (dy >= 31)
                                {
                                    dy = dy % 30;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (mon != 12)
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = mon + 1;
                                    }
                                }
                                else
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = 1;
                                        yr = yr + 1;
                                    }
                                }
                            }
                        }

                        if (strDay == dy.ToString() && month == mon.ToString() && year == yr.ToString())
                        {
                            ((include_splitslot)dgi.Cells[i + 1].Controls[1]).setSlotType(strSlotType, slotId);
                        }
                    }
                }
            }
        }
    }

    private void fill2MSlots2()
    {
        string err = "";
        //fetch the second marker
        string otherMarker = "";
        if (objProj.supervisorid.ToString().Equals(Session["individ"].ToString())) otherMarker = objProj.markerid.ToString(); else otherMarker = objProj.supervisorid.ToString();
        DataSet ds = slotServices.getIndividualSlots(Convert.ToInt16(otherMarker), ref err);

        if (Session["othermarker"] == null) Session.Add("othermarker", otherMarker);
        else Session["othermarker"] = otherMarker;

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            //string strDate = dr["sDateTime"].ToString();
            string year = dr["year"].ToString();
            string month = dr["month"].ToString();
            string day = dr["day"].ToString();
            string hour = dr["hour"].ToString();
            string min = dr["min"].ToString();

            string strSlotType = dr["slotPriorityCode"].ToString();
            string strDay = "";
            string strSlotTime;

            strDay = day;
            strSlotTime = hour.PadLeft(2, '0') + ":" + min.PadLeft(2, '0');


            foreach (DataGridItem dgi in dgWeek2.Items)
            {
                if (strSlotTime == dgWeek2.DataKeys[dgi.ItemIndex].ToString())
                {
                    for (int i = 0; i < 5; i++)
                    {
                        int dy = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[0]) + i;
                        int mon = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[1].Split('/')[0]);
                        int yr = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[1].Split('/')[1]);
                        if (mon == 2)//feb
                        {
                            if (yr % 4 == 0)
                            {
                                if (dy >= 30)
                                {
                                    dy = dy % 29;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (dy >= 29)
                                {
                                    dy = dy % 28;
                                    mon = mon + 1;
                                }
                            }
                        }
                        else
                        {
                            if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
                            {
                                if (dy >= 31)
                                {
                                    dy = dy % 30;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (mon != 12)
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = mon + 1;
                                    }
                                }
                                else
                                {
                                    if (dy >= 32)
                                    {
                                        dy = dy % 31;
                                        mon = 1;
                                        yr = yr + 1;
                                    }
                                }
                            }
                        }

                        if (strDay == dy.ToString() && month == mon.ToString() && year == yr.ToString())
                        {
                            ((include_splitslot)dgi.Cells[i + 1].Controls[1]).set2SlotType(strSlotType);
                        }
                    }
                }
            }
        }
    }

    protected void btnSendGameRequest_Click(object sender, EventArgs e)
    {
        int markerId = Convert.ToInt16(Session["individ"]);
        string slotId;
        int selSlotCount = 0;
        if (Session["slots"] != null) Session.Remove("slots");
        //populate slot data
        foreach (DataGridItem dgi in dgWeek.Items)
        {
            for (int i = 1; i < dgWeek.Columns.Count; i++)
            {
                int slotType = Convert.ToInt16(((include_splitslot)dgi.Cells[i].Controls[1]).slotType());
                if (slotType > 0)
                {
                    slotServices.slots objSlot = new slotServices.slots();
                    objSlot.sDateTime = hdnStartWeekDate.Value.Split(':')[1].Split('/')[0] + "/" + (Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[0]) + (i - 1)).ToString() + "/" + hdnStartWeekDate.Value.Split(':')[1].Split('/')[1] + " " + dgWeek.DataKeys[dgi.ItemIndex].ToString();
                    int day = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[0]) + (i - 1);
                    int mon = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[1].Split('/')[0]);
                    int yr = Convert.ToInt16(hdnStartWeekDate.Value.Split(':')[1].Split('/')[1]);
                    if (mon == 2)//feb
                    {
                        if (yr % 4 == 0)
                        {
                            if (day >= 30)
                            {
                                day = day % 29;
                                mon = mon + 1;
                            }
                        }
                        else
                        {
                            if (day >= 29)
                            {
                                day = day % 28;
                                mon = mon + 1;
                            }
                        }
                    }
                    else
                    {
                        if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
                        {
                            if (day >= 31)
                            {
                                day = day % 30;
                                mon = mon + 1;
                            }
                        }
                        else
                        {
                            if (mon != 12)
                            {
                                if (day >= 32)
                                {
                                    day = day % 31;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (day >= 32)
                                {
                                    day = day % 31;
                                    mon = 1;
                                    yr = yr + 1;
                                }
                            }
                        }
                    }
                    objSlot.Month = mon.ToString();
                    objSlot.Day = day.ToString();
                    objSlot.Year = yr.ToString();


                    objSlot.Hour = dgWeek.DataKeys[dgi.ItemIndex].ToString().Split(':')[0];
                    objSlot.Minute = dgWeek.DataKeys[dgi.ItemIndex].ToString().Split(':')[1];
                    objSlot.individ = markerId.ToString();

                    if (slotType == 1) //i.e. slot is selected
                    {
                        selSlotCount += 1;
                        slotId = ((include_splitslot)dgi.Cells[i].Controls[1]).slotId();
                        if (slotId == "0")
                        {
                            string err = "";
                            int _slotId = 0;
                            objSlot.slotPriorityCode = "N";
                            objSlot.slotType = "N";
                            slotServices.insertSlot(objSlot, ref err,ref _slotId);
                            slotId = _slotId.ToString();
                        }
                        if (Session["slots"] == null) Session.Add("slots", "'" + slotId + "'");
                        else Session["slots"] = Session["slots"].ToString() + ",'" + slotId + "'";
                    }
                    
                    //slotServices.insertSlot(objSlot, ref err);
                }
            }
        }




        foreach (DataGridItem dgi in dgWeek2.Items)
        {
            for (int i = 1; i < dgWeek2.Columns.Count; i++)
            {
                int slotType = Convert.ToInt16(((include_splitslot)dgi.Cells[i].Controls[1]).slotType());
                if (slotType > 0)
                {
                    slotServices.slots objSlot = new slotServices.slots();
                    objSlot.sDateTime = hdnStartWeek2Date.Value.Split(':')[1].Split('/')[0] + "/" + (Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[0]) + (i - 1)).ToString() + "/" + hdnStartWeek2Date.Value.Split(':')[1].Split('/')[1] + " " + dgWeek2.DataKeys[dgi.ItemIndex].ToString();
                    int day = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[0]) + (i - 1);
                    int mon = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[1].Split('/')[0]);
                    int yr = Convert.ToInt16(hdnStartWeek2Date.Value.Split(':')[1].Split('/')[1]);
                    if (mon == 2)//feb
                    {
                        if (yr % 4 == 0)
                        {
                            if (day >= 30)
                            {
                                day = day % 29;
                                mon = mon + 1;
                            }
                        }
                        else
                        {
                            if (day >= 29)
                            {
                                day = day % 28;
                                mon = mon + 1;
                            }
                        }
                    }
                    else
                    {
                        if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
                        {
                            if (day >= 31)
                            {
                                day = day % 30;
                                mon = mon + 1;
                            }
                        }
                        else
                        {
                            if (mon != 12)
                            {
                                if (day >= 32)
                                {
                                    day = day % 31;
                                    mon = mon + 1;
                                }
                            }
                            else
                            {
                                if (day >= 32)
                                {
                                    day = day % 31;
                                    mon = 1;
                                    yr = yr + 1;
                                }
                            }
                        }
                    }
                    objSlot.Month = mon.ToString();
                    objSlot.Day = day.ToString();
                    objSlot.Year = yr.ToString();


                    objSlot.Hour = dgWeek2.DataKeys[dgi.ItemIndex].ToString().Split(':')[0];
                    objSlot.Minute = dgWeek2.DataKeys[dgi.ItemIndex].ToString().Split(':')[1];
                    objSlot.individ = markerId.ToString();

                    if (slotType == 1) //i.e. slot is selected
                    {
                        selSlotCount += 1;
                        slotId = ((include_splitslot)dgi.Cells[i].Controls[1]).slotId();
                        if (slotId == "0")
                        {
                            string err = "";
                            int _slotId = 0;
                            objSlot.slotPriorityCode = "N";
                            objSlot.slotType = "N";
                            slotServices.insertSlot(objSlot, ref err, ref _slotId);
                            slotId = _slotId.ToString();
                        }
                        if (Session["slots"] == null) Session.Add("slots", "'" + slotId + "'");
                        else Session["slots"] = Session["slots"].ToString() + ",'" + slotId + "'";
                    }

                    //slotServices.insertSlot(objSlot, ref err);
                }
            }
        }



        if (selSlotCount > 0)
        {
            lblError.Text = "&nbsp;";
            Response.Redirect("requestSummary.aspx");
        }
        else
        {
            lblError.Text = "Please select atleast one slot to schedule a Game.";
            lblError.Visible = true;
        }
    }
}

Thanks in advance;

Mike

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by diafol
0

The first file is basically html and most of it is converted to the following:

<?php include('include/splitSlot.ascx'); ?>
<head>
<title>City UDS: Schedule Game</title>
</head>
<tr><td class="pagetitle">City UDS: Schedule Game</td></tr>
<tr><td class="pagesubtitle">Project ID <%=objProj.projectName%> </td></tr>
<table cellpadding=0 cellspacing=0 border=0>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" align=center></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>


<td class="normaltd" style="vertical-align:top;">
</td> 


<td class="normaltd" style="vertical-align:top;">
</td> 

</tr>
<tr><td colspan="2">&nbsp;</td></tr
<tr><td colspan="2"><input type="button" value="send Game request" onclick="btnSendGameRequest_Click"></td></tr>
</table>
    
<input type="hidden" id="hdnStartWeekDate" value="14:09/2008" />
<input type="hidden" id="hdnStartWeek2Date" value="14:09/2008" />

And gee aren't I glad that my webhost doesn't support asp because it looks so confusing at first glance.

0

Have you thought to learn pHp yourself and have a go? There's nothing difficult in there, but a bugger of a lot of work for somebody on a help forum. Is it realistic for somebody to wade through 1000 lines of code? I'm afraid I won't be looking.

Suggestion - go back to your forums and post 'pieces' of the code above. You may be able to jigsaw your way through it.

0

Have you thought to learn pHp yourself and have a go? There's nothing difficult in there, but a bugger of a lot of work for somebody on a help forum. Is it realistic for somebody to wade through 1000 lines of code? I'm afraid I won't be looking.

Suggestion - go back to your forums and post 'pieces' of the code above. You may be able to jigsaw your way through it.

Thanks for your honest answer. And cwarn23 thanks for helping me. The reason I post the entire code is, I have heard of ASP to PHP converter programs. But this don't convert all. I don't know what the difference is or how different they are. I thought maybe someone who has an advance ASP to PHP software could run this code on their program and use find and replace for the remaining of the unchanged code. Are the differences huge.

thanks

0

The differences most certainly aren't huge. You could change the majority with different keywords or syntax. The logic is pretty similar. But I ain't got the time for that behemoth.

0

Unfortunately, if you're using external 'include' files and classes, these will have to be "php-ified" as well. You'd be better off learning php and doing it yourself. Either that or pay somebody to do it properly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.