📄 sell_open.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LoginCheckClass;
public partial class 销售管理_Sell_open : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//判断用户是否登陆
//获取session值,防止直接通过URL访问页面,确保安全性
LoginCheck a = new LoginCheck(); //实例化LoginCheck类的对象
a.check(); //调用LoginCheck类的方法
try
{
using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(_connectString))
{
connection.Open(); //打开连接
using (System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand()) //创建Command对象
{
command.Connection = connection;
command.Parameters.Add("@id", SqlDbType.Int).Value = (int)Session["Sell_Search_ID"];
//获取该视图的信息
command.CommandText = "SELECT SQ.CommodityName, SQ.CompanyName,SQ.Type,SQ.kehu,SQ.Number,SQ.StockDate, SQ.ManageMan,SQ.SettlementType,SQ.UserName,SQ.AddTime,SQ.Pirce,SQ.Payment,SQ.id FROM SQ WHERE dbo.SQ.id=@id";
command.ExecuteNonQuery(); //返回受影响的行数
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
//进行对应字段的传值
CommodityName.Text = reader.GetString(0);
CompanyName.Text = reader.GetString(1);
Type.Text = reader.GetString(2);
kehu.Text = reader.GetString(3);
Number.Text = Convert.ToString(reader.GetInt32(4));
StockDate.Text = Convert.ToString(reader.GetDateTime(5).ToShortDateString());
ManageMan.Text = reader.GetString(6);
SettlementType.Text = reader.GetString(7);
UserName.Text = reader.GetString(8);
AddTime.Text = Convert.ToString(reader.GetDateTime(9));
Price.Text = Convert.ToString(reader.GetInt32(10));
Payment.Text = Convert.ToString(reader.GetInt32(11));
}
}
}
//单据编号的计算
Payment.Text = Convert.ToString(int.Parse(Number.Text) * int.Parse(Price.Text));
DateTime NO_Time = Convert.ToDateTime(StockDate.Text);
string time = NO_Time.ToString("yyyyMMdd");
string hou10 = Payment.Text;
hou10 = hou10.PadLeft(10, '0');
time = time + hou10;
NO.Text = time;
}
catch (Exception ex)
{
Response.Write(@"<script>alert('系统错误')</script>"); //抛出异常
}
}
private static readonly string _connectString = System.Configuration.ConfigurationManager.ConnectionStrings["db_sellConnectionString"].ConnectionString;
protected void closebtn_Click(object sender, EventArgs e)
{
Response.Write("<script>window.close()</script>"); //关闭页面
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -