public static int ExeSqlCommand(string sqlCommand) { int num; SqlConnection sqlConnection = new SqlConnection(DBA.strConnection); SqlCommand sqlCommand1 = new SqlCommand(sqlCommand, sqlConnection); int num1 = -1; try { sqlConnection.Open(); } catch { num = -1; return(num); } try { num1 = sqlCommand1.ExecuteNonQuery(); } catch (Exception exception1) { Exception exception = exception1; WebFun.ScriptMessage(string.Concat("SQL错误:", exception.Message), true); } sqlConnection.Close(); num = num1; return(num); }
public void GetItme() { object[] str; string str1 = (base.Request.QueryString["type"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["type"])); string str2 = (base.Request.QueryString["page"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["page"])); string str3 = string.Concat("and FLD_TYPE=", str1); base.Response.Write("{ \"item\": [ "); int num = 0; int num1 = 0; int num2 = 5; DataSet newList = DBA.GetNewList("ITEMSELL", num2, int.Parse(str2), str3, "ID", "ID", 1, out num, out num1); string str4 = ""; for (int i = 0; i < newList.Tables[0].Rows.Count; i++) { int item = (int)newList.Tables[0].Rows[i]["FLD_PRICE"]; item = item * 4; str = new object[] { str4, "{ \"id\":\"", newList.Tables[0].Rows[i]["FLD_PID"].ToString(), "\",\"name\": \"", newList.Tables[0].Rows[i]["FLD_NAME"].ToString(), "\", \"pic\":\"Images/Item/", newList.Tables[0].Rows[i]["FLD_PID"].ToString(), ".gif\",\"yjg\":\"", item, "\",\"jg\":\"", newList.Tables[0].Rows[i]["FLD_PRICE"].ToString(), "\",\"info\":\"", newList.Tables[0].Rows[i]["FLD_DESC"].ToString(), "\",\"type\":\"", newList.Tables[0].Rows[i]["FLD_TYPE"].ToString(), "\"}" }; string str5 = string.Concat(str); base.Response.Write(str5.Replace("\n", "")); str4 = ","; } base.Response.Write("],"); HttpResponse response = base.Response; str = new object[] { "\"pages\": [{\"curpage\":\"", str2, "\",\"pagenum\":\"", num, "\",\"type\":\"", str1, "\"}]" }; response.Write(string.Concat(str)); base.Response.Write("}"); newList.Dispose(); }
public static DataSet GetList(string TBName, int PageSize, int CurPage, string KeyField, string Condition, string Order) { DataSet dataSet = null; SqlConnection sqlConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnString"]); try { SqlParameter[] sqlParameterArray = new SqlParameter[] { SqlDBA.MakeInParam("@TBName", SqlDbType.NVarChar, 100, TBName), SqlDBA.MakeInParam("@PageSize", SqlDbType.Int, 10, PageSize), SqlDBA.MakeInParam("@CurPage", SqlDbType.Int, 10, CurPage), SqlDBA.MakeInParam("@KeyField", SqlDbType.NVarChar, 100, KeyField), SqlDBA.MakeInParam("@Condition", SqlDbType.NVarChar, 200, Condition), SqlDBA.MakeInParam("@Order", SqlDbType.NVarChar, 200, Order) }; SqlDBA.RunProc(sqlConnection, "XW_PublicTurnPageWebSite", sqlParameterArray, out dataSet); } catch (Exception exception1) { Exception exception = exception1; WebFun.ScriptMessage(string.Concat("SqlDBA发生错误,信息为:", exception.Message), true); } return(dataSet); }
public static DataSet GetNewList(string 表名, int 每页显示数, int 当前页, string 查询条件, string 表的主键, string 排序字段, int 排序方法, out int 总页数, out int 记录数) { DataSet dataSet = null; SqlConnection sqlConnection = new SqlConnection(DBA.strConnection); 总页数 = 0; 记录数 = 0; try { SqlParameter[] sqlParameterArray = new SqlParameter[] { SqlDBA.MakeInParam("@tblName", SqlDbType.NVarChar, 200, 表名), SqlDBA.MakeInParam("@pageSize", SqlDbType.Int, 10, 每页显示数), SqlDBA.MakeInParam("@page", SqlDbType.Int, 10, 当前页), SqlDBA.MakeInParam("@strCondition", SqlDbType.NVarChar, 1000, 查询条件), SqlDBA.MakeInParam("@ID", SqlDbType.NVarChar, 150, 表的主键), SqlDBA.MakeInParam("@fldSort", SqlDbType.NVarChar, 200, 排序字段), SqlDBA.MakeInParam("@Sort", SqlDbType.Bit, 10, 排序方法), SqlDBA.MakeOutParam("@pageCount", SqlDbType.Int, 4), SqlDBA.MakeOutParam("@Counts", SqlDbType.Int, 4) }; SqlParameter[] sqlParameterArray1 = sqlParameterArray; SqlDBA.RunProc(sqlConnection, "proc_ListPageInt", sqlParameterArray1, out dataSet); 总页数 = Convert.ToInt32(sqlParameterArray1[7].Value); 记录数 = Convert.ToInt32(sqlParameterArray1[8].Value); } catch (Exception exception1) { Exception exception = exception1; WebFun.ScriptMessage(string.Concat("SqlDBA发生错误,信息为:", exception.Message), true); } return(dataSet); }
public static DataTable GetDBToDataTable(string sqlCommand) { DataTable dataTable; SqlConnection sqlConnection = new SqlConnection(DBA.strConnection); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter() { SelectCommand = new SqlCommand(sqlCommand, sqlConnection) }; SqlDataAdapter sqlDataAdapter1 = sqlDataAdapter; try { sqlConnection.Open(); } catch { dataTable = null; return(dataTable); } DataTable dataTable1 = new DataTable(); try { sqlDataAdapter1.Fill(dataTable1); } catch (Exception exception1) { Exception exception = exception1; WebFun.ScriptMessage(string.Concat("SQL错误:", exception.Message), true); } sqlDataAdapter1.Dispose(); sqlConnection.Close(); sqlConnection.Dispose(); dataTable = dataTable1; return(dataTable); }
protected void Page_Load(object sender, EventArgs e) { object[] item; base.Response.ContentEncoding = Encoding.GetEncoding("utf-8"); string str = (base.Request.QueryString["itemid"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["itemid"])); string str1 = (base.Request.QueryString["itemnum"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["itemnum"])); string str2 = (base.Request.QueryString["itemje"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["itemje"])); string str3 = (base.Request.QueryString["type"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["type"])); string str4 = (base.Request.QueryString["option1"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option1"])); string str5 = (base.Request.QueryString["option2"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option2"])); string str6 = (base.Request.QueryString["option3"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option3"])); string str7 = (base.Request.QueryString["option4"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option4"])); int num = (this.Session["SSPOINT"] == null ? 0 : int.Parse(this.Session["SSPOINT"].ToString())); int num1 = (this.Session["SSCASH"] == null ? 0 : int.Parse(this.Session["SSCASH"].ToString())); int num2 = (this.Session["SSBLANK"] == null ? 0 : int.Parse(this.Session["SSBLANK"].ToString())); int num3 = int.Parse(str2); int num4 = int.Parse(str1); if (num4 > num2) { base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"인벤토리 부족 구입실패 1\"}]} "); } else if (!(num3 > num & num3 > num1)) { if (str3 == "3") { item = new object[] { this.Session["Id"], ",", str, ",", str1, ",", str2, ",0,", str4, ",", str5, ",", str6, ",", str7 }; if (PublicClass.SendBuyShuxing(string.Concat(item))) { if (num3 > 0) { if (num < num3) { if (num1 >= num3) { this.Session["SSCASH"] = num1 - num3; this.Session["SSBLANK"] = num2 - num4; base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} "); return; } base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"포인트 부족 1\"}]} "); return; } this.Session["SSPOINT"] = num - num3; } this.Session["SSBLANK"] = num2 - num4; base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} "); } else { base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"구매오류 1\"}]} "); } return; } else { item = new object[] { this.Session["Id"], ",", str, ",", str1, ",", str2, "," }; if (PublicClass.SendBuy(string.Concat(item))) { if (num3 > 0) { if (num < num3) { if (num1 >= num3) { this.Session["SSCASH"] = num1 - num3; this.Session["SSBLANK"] = num2 - num4; base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} "); this.Session["SSCASH"] = num1 - num3; this.Session["SSBLANK"] = num2 - num4; base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} "); return; } base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"구매 오류 2\"}]} "); return; } this.Session["SSPOINT"] = num - num3; } this.Session["SSBLANK"] = num2 - num4; base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} "); } else { base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"구매오류 3\"}]} "); } return; } this.Session["SSCASH"] = num1 - num3; this.Session["SSBLANK"] = num2 - num4; base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} "); return; } else { base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"인벤토리 부족 구입실패 2\"}]} "); } }