ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 22nd, 2012, 02:22 PM
arv_rehal arv_rehal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 1 arv_rehal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 31 sec
Reputation Power: 0
ASP & PHP

I have following code made by some other program.. I am not able to understand what is Administration and how to create "webdev" similar like getemployee is created in the code like "DataView dataView = myAdmin.GetEmployees();"

code...

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Admin_Staff : System.Web.UI.Page
{
Administration myAdmin = new Administration();

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}


protected void gridEmployees_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals("Insert"))
{

myEmployee myEmployee = new myEmployee();
myEmployee.name = ((TextBox)gridEmployees.FooterRow.FindControl("nameTextboxInsert")).Text;
myEmployee.title = ((TextBox)gridEmployees.FooterRow.FindControl("titleTextboxInsert")).Text;
myEmployee.phone = ((TextBox)gridEmployees.FooterRow.FindControl("phoneTextboxInsert")).Text;
myEmployee.fax = ((TextBox)gridEmployees.FooterRow.FindControl("faxTextboxInsert")).Text;
myEmployee.email = ((TextBox)gridEmployees.FooterRow.FindControl("emailTextboxInsert")).Text;
myEmployee.position = ((TextBox)gridEmployees.FooterRow.FindControl("positionTextboxInsert")).Text;

myAdmin.InsertEmployee(myEmployee);

gridEmployees.ShowFooter = false;
BindData();
}

}

protected void gridEmployees_RowEditing(object sender, GridViewEditEventArgs e)
{
gridEmployees.EditIndex = e.NewEditIndex;
BindData();
}

protected void gridEmployees_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
gridEmployees.EditIndex = -1;
gridEmployees.ShowFooter = false;
BindData();
}

protected void gridEmployees_RowUpdating(object sender, GridViewUpdateEventArgs e)
{

myEmployee myEmployee = new myEmployee();
myEmployee.employeeID = (int)gridEmployees.DataKeys[e.RowIndex].Value;
myEmployee.name = ((TextBox)gridEmployees.Rows[e.RowIndex].FindControl("nameTextbox")).Text;
myEmployee.title = ((TextBox)gridEmployees.Rows[e.RowIndex].FindControl("titleTextbox")).Text;
myEmployee.phone = ((TextBox)gridEmployees.Rows[e.RowIndex].FindControl("phoneTextbox")).Text;
myEmployee.fax = ((TextBox)gridEmployees.Rows[e.RowIndex].FindControl("faxTextbox")).Text;
myEmployee.email = ((TextBox)gridEmployees.Rows[e.RowIndex].FindControl("emailTextbox")).Text;
myEmployee.position = ((TextBox)gridEmployees.Rows[e.RowIndex].FindControl("positionTextbox")).Text;

myAdmin.UpdateEmployee(myEmployee);

gridEmployees.EditIndex = -1;
BindData();
}

protected void gridEmployees_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Int32 employeeID = (int)gridEmployees.DataKeys[e.RowIndex].Value;

myAdmin.DeleteEmployee(employeeID);

gridEmployees.EditIndex = -1;
BindData();

}

protected void InsertRecord(object sender, EventArgs e)
{
gridEmployees.ShowFooter = true;
BindData();

//go to the template bottom
Page.MaintainScrollPositionOnPostBack = false;
ClientScript.RegisterStartupScript(this.GetType(), "hash", "location.hash = '#new';", true);
}


// Sorting Gridview
protected void gridEmployees_Sorting(object sender, GridViewSortEventArgs e)
{

if (Session["AdminTaskTable"] != null)
{
DataView dataView = Session["AdminTaskTable"] as DataView;
dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql();

gridEmployees.DataSource = dataView;
gridEmployees.DataBind();
}

}

private string ConvertSortDirectionToSql()
{

string newSortDirection = String.Empty;

if (ViewState["sortOrder"] == null || ViewState["sortOrder"].ToString() == "DESC")
{
newSortDirection = "ASC";
}
else
{
newSortDirection = "DESC";
}


ViewState["sortOrder"] = newSortDirection;
return newSortDirection;

}


private void BindData()
{

DataView dataView = myAdmin.GetEmployees();
Session["AdminTaskTable"] = dataView;
gridEmployees.DataSource = dataView;
gridEmployees.DataBind();

}
}

Reply With Quote
  #2  
Old October 22nd, 2012, 05:40 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 17 m
Reputation Power: 4445
I don't know what you're asking, but please use forum CODE tags around posted code. Try re-phrasing your question with more specific details.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > ASP & PHP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap