using System; using System.Configuration; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Xml.Xsl; namespace AeroNet.ops { /// /// Summary description for ops_Order. /// public class ops_Order : Common { protected System.Web.UI.WebControls.Label lblOrderNumber; protected System.Web.UI.WebControls.Label lblOrderDate; protected System.Web.UI.WebControls.DataGrid GridControl1; protected System.Web.UI.WebControls.Label MyError; protected System.Web.UI.WebControls.Label Confirm; protected System.Web.UI.WebControls.Label lblTotal; protected System.Web.UI.WebControls.Label lblPostCost; protected System.Web.UI.WebControls.Label lblNotes; protected System.Web.UI.WebControls.Panel OrdersPanel; protected int orderID; protected int status; public string TotalUSD; public decimal CurrenceRate; protected System.Web.UI.HtmlControls.HtmlTable detailsTable; protected System.Web.UI.HtmlControls.HtmlForm o; protected string customerId; /// /// PrintAddress() - вывод адреса доставки заказа /// protected void PrintAddress() { try { Transform("PostAddress.xml?orderID="+orderID.ToString(),"PostAddress.xsl",this.Response,1); } catch { Response.Redirect("error.aspx",true); } } /// /// PrintRuPay() - вывод приглашения к оплате заказа через систему RuPay /// protected void PrintRuPay() { // Получение статуса текущего заказа status = CheckStatus(orderID); // Если status=2 (Подтвержден), то выводится приглашение к оплате через систему RuPay if (status == 2) { Response.Write ("
Оплата через систему RUpay
(текущий курс "+String.Format("{0:F}",CurrenceRate)+" RUR)

Сумма оплаты :   $


"); } } protected int CheckStatus(int orderID) { // Создание экземпляра объекта подключения и команды SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); SqlCommand myCommand = new SqlCommand("CheckStatusOrder", myConnection); // Пометка команды как SPROC myCommand.CommandType = CommandType.StoredProcedure; // Добавление параметров к SPROC SqlParameter parameterOrderID = new SqlParameter("@orderID", SqlDbType.Int, 4); parameterOrderID.Value = orderID; myCommand.Parameters.Add(parameterOrderID); SqlParameter parameterStatus = new SqlParameter("@Status", SqlDbType.Int, 4); parameterStatus.Direction = ParameterDirection.Output; myCommand.Parameters.Add(parameterStatus); // Открытие подключения и выполнение команды myConnection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); // Возвращение Status return (int)parameterStatus.Value; } protected void CurrRate() { // Создание экземпляра объекта подключения и команды SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); SqlCommand myCommand = new SqlCommand("CurrenceRate", myConnection); // Пометка команды как SPROC myCommand.CommandType = CommandType.StoredProcedure; // Добавление параметров к SPROC SqlParameter parameterCurrRate = new SqlParameter("@CurrRate", SqlDbType.Decimal); parameterCurrRate.Direction = ParameterDirection.InputOutput ; parameterCurrRate.Scale =2; parameterCurrRate.Precision=18; myCommand.Parameters.Add(parameterCurrRate); // Открытие подключения и выполнение команды myConnection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); CurrenceRate = (decimal)parameterCurrRate.Value; } private void Page_Load(object sender, System.EventArgs e) { OpsMenu(); CurrRate(); OrdersDB orderHistory = new OrdersDB(); if (CurrenceRate == 0) { CurrenceRate = 28.9M; } //Получить ID заказа из строки запроса if ((Request.QueryString["orderID"] == null) || (Request.QueryString["orderID"] == "")) { Response.Redirect("ops_OrderList.aspx",true); } else { orderID = Convert.ToInt32(Request.QueryString["orderID"]); } //Получить ID клиента из строки запроса if ((Request.QueryString["customerId"] == null) || (Request.QueryString["customerId"] == "")) { Response.Redirect("ops_OrderList.aspx",true); } else { customerId = Request.QueryString["customerId"]; } //Проверка прав доступа к странице Session["exit"]="/ops/ops_Order.aspx?orderID="+orderID.ToString()+ "&customerId="+customerId.ToString(); OpsLogin(); // Получение подробных сведений о заказе из базы данных OrderDetails myOrderDetails = orderHistory.GetOrderDetails(orderID, customerId); // если заказ был найден – его отображение if (myOrderDetails != null) { // Привязка элементов к GridControl GridControl1.DataSource = myOrderDetails.OrderItems; GridControl1.DataBind(); // Обновление меток на основе подробностей резюме lblPostCost.Text = String.Format("{0:c}", myOrderDetails.PostCost); lblTotal.Text = String.Format("{0:c}", (myOrderDetails.OrderTotal+myOrderDetails.PostCost)); lblNotes.Text = myOrderDetails.Notes.ToString(); TotalUSD = String.Format("{0:F}",((myOrderDetails.OrderTotal+myOrderDetails.PostCost)/CurrenceRate)); lblOrderNumber.Text = orderID.ToString(); lblOrderDate.Text = myOrderDetails.OrderDate.ToShortDateString(); } // иначе – отображение сообщения об ошибках else { MyError.Text = "Заказ не найден!"; OrdersPanel.Visible = false; } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }