**********First************************************
protected void btn_submit_Click(object sender, EventArgs e)
{
string domain = txt_domain_name.Text.Trim() + "." + ddlDomainExt.SelectedValue.ToString();
objhosting = new HostingServices();
objhosting.addhosting(domain, ddl_hosting_type.SelectedValue.ToString(), ddl_type.SelectedValue.ToString(), ddl_planname.SelectedValue.ToString(), ddl_country.SelectedValue.ToString(), hdnplanid.Value, hdnAmountid.Value);
CartServices cartService = new CartServices();
string sessionId = Session.SessionID;
decimal unitPrice = Convert.ToDecimal(hdnAmountid.Value);
cartService.InsertCartDetails(sessionId, 0, domain, unitPrice, 1, (unitPrice * 1));
clear();
//string responseURL =getdomainNameAndCost(ddl_hosting_type.SelectedValue + "hosting" + ddl_type.SelectedValue, "6");
// Response.Redirect(responseURL);
}
************* Second **************************
namespace aaa.Services
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class HostingServices : IhostingServices
{
HostigBL objhosting = new HostigBL();
public int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, string planprice)
{
return objhosting.addhosting(domainname, hostingtype, ostype, duration, country, planname,Convert.ToDecimal(planprice));
}
}
}
****************** Third *********************************
namespace aaa.Services
{
interface IhostingServices
{
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "addhosting?domainname={domainname}&hostingtype={hostingtype}&ostype={ostype}&duration={duration}&country={country}&planname={planname}&planprice={planprice}")]
int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, string planprice);
}
}
************* Fourth ****************************************
namespace aaa.BusinessLayer
{
public class HostigBL
{
HostingDA objhosting = new HostingDA();
public int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, decimal planprice)
{
return objhosting.addhosting(domainname,hostingtype,ostype,duration,country,planname,planprice);
}
}
}
***************** Fifth *************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using ouula.DataLayer;
using System.Data.SqlClient;
namespace aaa.DataAccessLayer
{
public class HostingDA
{
#region insert hosting
public int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, decimal planprice)
{
DataSet ds= new DataSet();
SqlCommand cmd= new SqlCommand();
int returnvalue=0;
DbConnection.OpenConnection();
cmd.CommandType= CommandType.StoredProcedure;
cmd.CommandText="USP_AddHostingDetails";
cmd.Parameters.AddWithValue("@DomainName", domainname);
cmd.Parameters.AddWithValue("@HostingType", hostingtype);
cmd.Parameters.AddWithValue("@OSType", ostype);
cmd.Parameters.AddWithValue("@Duration", duration);
cmd.Parameters.AddWithValue("@Country", country);
cmd.Parameters.AddWithValue("@PlanName", planname);
cmd.Parameters.AddWithValue("@PlanPrice", planprice);
cmd.Parameters.AddWithValue("@Return_Value", DbType.Int32);
cmd.Parameters["@Return_Value"].Direction = ParameterDirection.Output;
cmd.Connection = DbConnection.MyConnection;
try
{
cmd.ExecuteNonQuery();
returnvalue = Int32.Parse(cmd.Parameters["@Return_Value"].Value.ToString());
DbConnection.CloseConnection();
}
catch (Exception ex)
{
}
return returnvalue;
}
#endregion
}
}
protected void btn_submit_Click(object sender, EventArgs e)
{
string domain = txt_domain_name.Text.Trim() + "." + ddlDomainExt.SelectedValue.ToString();
objhosting = new HostingServices();
objhosting.addhosting(domain, ddl_hosting_type.SelectedValue.ToString(), ddl_type.SelectedValue.ToString(), ddl_planname.SelectedValue.ToString(), ddl_country.SelectedValue.ToString(), hdnplanid.Value, hdnAmountid.Value);
CartServices cartService = new CartServices();
string sessionId = Session.SessionID;
decimal unitPrice = Convert.ToDecimal(hdnAmountid.Value);
cartService.InsertCartDetails(sessionId, 0, domain, unitPrice, 1, (unitPrice * 1));
clear();
//string responseURL =getdomainNameAndCost(ddl_hosting_type.SelectedValue + "hosting" + ddl_type.SelectedValue, "6");
// Response.Redirect(responseURL);
}
************* Second **************************
namespace aaa.Services
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class HostingServices : IhostingServices
{
HostigBL objhosting = new HostigBL();
public int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, string planprice)
{
return objhosting.addhosting(domainname, hostingtype, ostype, duration, country, planname,Convert.ToDecimal(planprice));
}
}
}
****************** Third *********************************
namespace aaa.Services
{
interface IhostingServices
{
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "addhosting?domainname={domainname}&hostingtype={hostingtype}&ostype={ostype}&duration={duration}&country={country}&planname={planname}&planprice={planprice}")]
int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, string planprice);
}
}
************* Fourth ****************************************
namespace aaa.BusinessLayer
{
public class HostigBL
{
HostingDA objhosting = new HostingDA();
public int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, decimal planprice)
{
return objhosting.addhosting(domainname,hostingtype,ostype,duration,country,planname,planprice);
}
}
}
***************** Fifth *************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using ouula.DataLayer;
using System.Data.SqlClient;
namespace aaa.DataAccessLayer
{
public class HostingDA
{
#region insert hosting
public int addhosting(string domainname, string hostingtype, string ostype, string duration, string country, string planname, decimal planprice)
{
DataSet ds= new DataSet();
SqlCommand cmd= new SqlCommand();
int returnvalue=0;
DbConnection.OpenConnection();
cmd.CommandType= CommandType.StoredProcedure;
cmd.CommandText="USP_AddHostingDetails";
cmd.Parameters.AddWithValue("@DomainName", domainname);
cmd.Parameters.AddWithValue("@HostingType", hostingtype);
cmd.Parameters.AddWithValue("@OSType", ostype);
cmd.Parameters.AddWithValue("@Duration", duration);
cmd.Parameters.AddWithValue("@Country", country);
cmd.Parameters.AddWithValue("@PlanName", planname);
cmd.Parameters.AddWithValue("@PlanPrice", planprice);
cmd.Parameters.AddWithValue("@Return_Value", DbType.Int32);
cmd.Parameters["@Return_Value"].Direction = ParameterDirection.Output;
cmd.Connection = DbConnection.MyConnection;
try
{
cmd.ExecuteNonQuery();
returnvalue = Int32.Parse(cmd.Parameters["@Return_Value"].Value.ToString());
DbConnection.CloseConnection();
}
catch (Exception ex)
{
}
return returnvalue;
}
#endregion
}
}
No comments:
Post a Comment