/// <summary> /// 控制分组带参构造 /// </summary> /// <param name="Connection"></param> public ControlPointGroup(string Connection) { DbConnection = new SqlHelper(Connection); GroupType = 0; GroupName = "NULL"; Remarks = "NULL"; }
public static void DumpHgbstLists(params string[] listNames) { var sqlHelper = new SqlHelper(); DataSet listDs; if (listNames == null || listNames.Length == 0 || (listNames.Length == 1 && listNames[0].Trim().Length == 0)) { sqlHelper.CommandText = "SELECT * FROM table_hgbst_lst"; listDs = sqlHelper.ExecuteDataSet(); } else { var names = new object[listNames.Length]; string colName = null; const string hgbstListSql = "SELECT * FROM table_hgbst_lst WHERE (title IN({0}))"; Array.Copy(listNames, 0, names, 0, listNames.Length); sqlHelper.CommandText = String.Format(hgbstListSql, SqlHelper.IN_LIST_TOKEN); listDs = sqlHelper.ExecuteDataSetInList(names, colName); } if (listDs == null || listDs.Tables.Count == 0 || listDs.Tables[0].Rows.Count == 0) { var namesCombined = (listNames == null) ? "" : String.Join("', '", listNames); Console.WriteLine("No HGBST lists found matching the specified criteria ('{0}').", namesCombined); return; } DumpHgbstLists(listDs); }
public PlaneIntersection(string Connection) { DbConnection = new SqlHelper(Connection); Stake = "NULL"; PlaneInterName = "NULL"; bCalcLeft = 0; LeftBt = 0; LeftL = 0; LeftR1 = 0; LeftR2 = 0; LeftR3 = 0; LeftR4 = 0; LeftW1 = 0; LeftW2 = 0; LeftW3 = 0; LeftW4 = 0; bCalcRight = 0; RightBt = 0; RightL = 0; RightR1 = 0; RightR2 = 0; RightR3 = 0; RightR4 = 0; RightW1 = 0; RightW2 = 0; RightW3 = 0; RightW4 = 0; Remarks = "NULL"; }
public VerticalSectionGroundLine(string Connection) { DbConnection = new SqlHelper(Connection); SerialNumber = 0; Stake = "NULL"; H = 0; }
/// <summary> /// 设计横断面地面线数据带参构造 /// </summary> /// <param name="Connection"></param> public CrossSectionDesignLineData(string Connection) { DbConnection = new SqlHelper(Connection); SerialNumber = 0; Stake = "NULL"; H = 0; }
public void Delete(int id) { using (SqlHelper sqlh = new SqlHelper(@" delete from Access.role where role = @Id")) { sqlh.ExecNoQuery(); } }
/// <summary> /// 控制点带参构造 /// </summary> /// <param name="Connection"></param> public ControlPoint(string Connection) { DbConnection = new SqlHelper(Connection); Name = "NULL"; X = 0; Y = 0; H = 0; Remarks = "NULL"; }
public GradeChangePoint(string Connection) { DbConnection = new SqlHelper(Connection); SerialNumber = 0; Stake = "NULL"; H = 0; R = 0; i1 = 0; i2 = 0; }
/// <summary> /// 涵洞带参构造 /// </summary> /// <param name="Connection"></param> public Culvert(string Connection) { DbConnection = new SqlHelper(Connection); CenterStake = "NULL"; CulvertName = "NULL"; StructureFrom = 0; Angle = 0; BottomH = 0; SpanDescription = "NULL"; }
//初始化竖曲线构造函数 public VerticalCurv(string Connection) { DbConnection = new SqlHelper(Connection); VerticalCurveType = 0; GradeChangePointNumber = 0; CurveNumber = 0; VerticalCurveLength = 0; BeginStake = "NULL"; EndStake = "NULL"; Description = "NULL"; }
/// <summary> /// 积木法带参构造 /// </summary> /// <param name="Connection"></param> public BuildingBlockCurve(string Connection) { DbConnection = new SqlHelper(Connection); SerialNumber = 0; Stake = "NULL"; X = 0; Y = 0; Azimuth = 0; TurnTo = 0; R = 0; Description = "NULL"; }
public EmailBLL() { _currentPath = GetType().Assembly.Location; _currentPath = _currentPath.Substring(0, _currentPath.LastIndexOf(@"\")) + "\\"; string mailConfigPath = _currentPath + @"ConfigFiles\MailConfig.xml"; string connFile = _currentPath + @"ConfigFiles\CommonConfig.xml"; string connStr = new XmlHelper(connFile).GetValue("ConnectionString"); _sqlHelper = new SqlHelper(connStr); _xmlHelper = new XmlHelper(mailConfigPath); }
/// <summary> /// Получает роль по идентификатору. /// </summary> /// <param name="id">Идентификатор.</param> /// <returns>Роль.</returns> public RoleItem Get(int id) { using (var sqlh = new SqlHelper()) { return sqlh.ExecMapping<RoleItem>(@" select r.role Id, r.code Code, r.mem Mem from Access.role r where r.role = @Id", new { id }); } }
public Tunnel(string Connection) { DbConnection = new SqlHelper(Connection); Stake = "NULL"; StartStake = "NULL"; EndStake = "NULL"; Type = 0; Name = "NULL"; Angle = 0; LeftWidth = 0; RightWidth = 0; SpanDescription = "NULL"; }
protected void Page_Load(object sender, EventArgs e) { Response.Clear(); string str_sql = ""; IDbHelper sql = GetHelper(); DbDataReader rd = sql.ExecuteReader(CommandType.Text, "select [name] from sysobjects where xtype='U'"); while (rd.Read()) { string tableName = rd["name"].ToString(); if (tableName.ToLower() == "sysuser") { continue; } IDbHelper Helper = new SqlHelper(Voodoo.Setting.DataBase.ConnStr); DataTable dt = Helper.ExecuteDataTable(CommandType.Text, string.Format("select * from [{0}]",tableName)); string str_insert = string.Format("SET IDENTITY_INSERT [{0}] ON ;\n insert into [{0}](", tableName); for (int i = 0; i < dt.Columns.Count; i++) { str_insert += "[" + dt.Columns[i].ColumnName + "]"; if (i != dt.Columns.Count - 1) { str_insert += ","; } } str_insert += ") values("; for (int i = 0; i < dt.Rows.Count; i++) { str_sql += str_insert; for (int j = 0; j < dt.Columns.Count; j++) { str_sql += "N'" + dt.Rows[i][j].ToString().Replace("'", "''") + "'"; if (j != dt.Columns.Count - 1) { str_sql += ","; } } str_sql += string.Format(")\n SET IDENTITY_INSERT [{0}] OFF ;\n\n\n",tableName); } } rd.Close(); rd.Dispose(); //Response.Write(str_sql); Voodoo.IO.File.Write(Server.MapPath("~/e/installer/tabledata.txt"), str_sql, System.IO.FileMode.Create); Response.Write("已经生成到:" + Server.MapPath("~/e/installer/tabledata.txt")); Response.End(); }
public IntersectionPoint(string Connection) { DbConnection = new SqlHelper(Connection); SerialNumber = 0; JDBH = "NULL"; Stake = "NULL"; X = 0; Y = 0; R = 0; Ls1 = 0; Ls2 = 0; Ls1R = 0; Ls2R = 0; }
public int Create(RoleItem role) { using (SqlHelper sqlh = new SqlHelper(@" insert into Access.role(code, mem) values (@Code, @Mem) select SCOPE_IDENTITY() ")) { sqlh.AddWithValue("@Code", role.Code); sqlh.AddWithValue("@Mem", role.Mem); return (int)sqlh.ExecScalar(); } }
public RoadWidthChange(string Connection) { DbConnection = new SqlHelper(Connection); SerialNumber = 0; Stake = "NULL"; LeftSoilShoulder = 0; LeftHardShoulder = 0; LeftCarriageway = 0; LeftMiddle = 0; RightMiddle = 0; RightCarriageway = 0; RightHardShoulder = 0; RightSoilShoulder = 0; Remarks = "NULL"; }
public ActionResult Contact() { ViewBag.Message = "與我們聯絡"; /* List<string> DepartmentList = new List<string>(); DepartmentList.Add("業務部"); DepartmentList.Add("創意部"); DepartmentList.Add("行銷部"); ViewBag.DepartmentList = DepartmentList; return View(); */ List<department> departmentlist = new List<department>(); SqlHelper hp = new SqlHelper(); DataTable tb = hp.Sql2Table("select id,cname from dep"); department depobj; foreach(DataRow r in tb.Rows) { depobj = new department(); depobj.id = r["id"].ToString(); depobj.departmentName = r["cname"].ToString(); departmentlist.Add(depobj); } //return View(departmentlist); departmentlist.Clear(); depobj = new department(); depobj.id = "a001"; depobj.departmentName = "業務部"; departmentlist.Add(depobj); depobj = new department(); depobj.id = "a002"; depobj.departmentName = "創意部"; departmentlist.Add(depobj); depobj = new department(); depobj.id = "a003"; depobj.departmentName = "行銷部"; departmentlist.Add(depobj); return View(departmentlist); }
protected void Page_Load(object sender, EventArgs e) { m_sqlHelper = new SqlHelper(); string P_id = Request.QueryString["P_id"]; //string P_id = "054321"; string commandText = "select distinct Paper.Introduction as 选题简介 " + "from Paper " + "where P_id = " + P_id; DataTable dt = m_sqlHelper.Query(commandText); m_introductionGridView.DataSource = dt; m_introductionGridView.DataBind(); }
/// <summary> /// Добавляет подроль. /// </summary> /// <param name="owner_id">Идентификатор роли.</param> /// <param name="offer_id">Идентификатор подроли.</param> public void CreateMemberRole(int owner_id, int offer_id) { using (var sqlh = new SqlHelper()) { sqlh.ExecNoQuery(@" insert into Access.role_member ( role_owner, role_offer ) values ( @owner_id, @offer_id )", new {owner_id, offer_id}); } }
public ActionResult Create(department model) { SqlHelper hp = new SqlHelper(); int icount = 0; icount=Convert.ToInt32(hp.sql2result("select count(id) from dep where id=" + model.id)); if (icount>0) { ModelState.AddModelError("", "部門編號"+model.id+"已經存在"); } icount = Convert.ToInt32(hp.sql2result("select count(cname) from dep where cname='" + model.departmentName+"'")); if (icount > 0) { ModelState.AddModelError("", "部門名稱" + model.departmentName + "已經存在"); } /* if (model.departmentName=="業務部") { ModelState.AddModelError("", "該部門名稱已經存在"); } */ if (ModelState.IsValid) { //寫入資料庫的程式碼 hp.sql2result( string.Format("insert into dep (id,cname) values ({0},'{1}')", model.id,model.departmentName ) ); // return RedirectToAction("Department", "admin"); } else { return View(model); } }
/// <summary> /// Создает новую роль. /// </summary> /// <param name="role">Роль.</param> /// <returns>Идентификатор созданной роли.</returns> public int Create(RoleItem role) { using (var sqlh = new SqlHelper()) { return sqlh.ExecScalar<int>(@" insert into Access.role ( code, mem ) values ( @Code, @Mem ) select scope_identity()", role); } }
protected void Page_Load(object sender, EventArgs e) { m_sqlHelper = new SqlHelper(); string id = Session["Id"].ToString(); string commandText = "select distinct Stu_Paper.S_id as 学号, Stu.Name as 姓名, Stu_Paper.P_id as 论文编号, Paper.Title as 论文题目, Teacher.Name as 指导老师, Stu_Paper.P_score as 论文成绩, Stu_Paper.RP_score as 答辩成绩, Stu_Paper.Total_score as 总成绩 " + "from Stu_Paper, Stu, Teacher, Paper " + "where Stu_Paper.S_id = " + id + " and Stu_Paper.S_id = Stu.S_id and Paper.P_id = Stu_Paper.P_id and Paper.T_id = Teacher.T_id"; DataTable dt = m_sqlHelper.Query(commandText); if (dt.Rows.Count != 0) { m_Grade_StuIdLabel.Text = dt.Rows[0][0].ToString(); m_Grade_StuNameLabe1.Text = dt.Rows[0][1].ToString(); m_Grade_TitleIdLabel.Text = dt.Rows[0][2].ToString(); m_Grade_TitleNameLabel.Text = dt.Rows[0][3].ToString(); m_Grade_AdvisorLabel.Text = dt.Rows[0][4].ToString(); m_Grade_PaperGradeLabel.Text = dt.Rows[0][5].ToString(); m_Grade_DefenceGradeLabel.Text = dt.Rows[0][6].ToString(); m_Grade_TotalGradeLabel.Text = dt.Rows[0][7].ToString(); } }
public RoleItem GetByCode(string code) { using (SqlHelper sqlh = new SqlHelper(@" select r.role Id, r.code Code, r.mem Mem from Access.role r where r.code = @Code")) { sqlh.AddWithValue("@Code", code); var dt = sqlh.ExecTable(); if (dt.Rows.Count == 0) { return null; } return new RoleItem() { Id = (int)dt.Rows[0]["Id"], Code = (string)dt.Rows[0]["Code"], Mem = (string)dt.Rows[0]["Mem"] }; } }
/// <summary> /// Gets a collection PurchaseOrderItem objects by custom where clause and order by. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <param name="orderBy">the order by clause. Shoudl start with "order by"</param> /// <returns>The retrieved collection of PurchaseOrderItem objects.</returns> protected static EntityList<PurchaseOrderItem> GetPurchaseOrderItems(string prefix, string where, System.Collections.Generic.List<SqlParameter> parameters, string orderBy) { string commandText = @"SELECT " + prefix + "" + PurchaseOrderItem.SelectFieldList + "FROM [dbo].[PurchaseOrderItems] " + where + " " + orderBy; using (SqlHelper helper = new SqlHelper()) { using (IDataReader reader = helper.ExecuteDataReader(commandText, CommandType.Text, parameters)) { return EntityBase.InitializeList<PurchaseOrderItem>(reader); } } }
/// <summary> /// Updates a PurchaseOrderItem into the data store based on the primitive properties. This can be used as the /// update method for an ObjectDataSource. /// </summary> /// <param name="purchaseorder_id">purchaseorder_id</param> /// <param name="product_code">product_code</param> /// <param name="barcode">barcode</param> /// <param name="description">description</param> /// <param name="quantity">quantity</param> /// <param name="cost_price">cost_price</param> /// <param name="helper">helper</param> internal static void UpdatePurchaseOrderItem(int @purchaseorder_id, string @product_code, string @barcode, string @description, double @quantity, decimal @cost_price, SqlHelper @helper) { string commandText = "PurchaseOrderItemUpdate"; System.Collections.Generic.List<SqlParameter> parameters = new System.Collections.Generic.List<SqlParameter>(); parameters.Add(new SqlParameter("@purchaseorder_id", EntityBase.GetDatabaseValue(@purchaseorder_id))); parameters.Add(new SqlParameter("@product_code", EntityBase.GetDatabaseValue(@product_code))); parameters.Add(new SqlParameter("@barcode", EntityBase.GetDatabaseValue(@barcode))); parameters.Add(new SqlParameter("@description", EntityBase.GetDatabaseValue(@description))); parameters.Add(new SqlParameter("@quantity", @quantity)); parameters.Add(new SqlParameter("@cost_price", EntityBase.GetDatabaseValue(@cost_price))); @helper.Execute(commandText, CommandType.StoredProcedure, parameters); }
/// <summary> /// Deletes a PurchaseOrderItem from the data store based on the primitive primary keys. This can be used as the /// delete method for an ObjectDataSource. /// </summary> /// <param name="purchaseorder_id">purchaseorder_id</param> /// <param name="product_code">product_code</param> /// <param name="helper">helper</param> internal static void DeletePurchaseOrderItem(int @purchaseorder_id, string @product_code, SqlHelper @helper) { string commandText = "PurchaseOrderItemDelete"; System.Collections.Generic.List<SqlParameter> parameters = new System.Collections.Generic.List<SqlParameter>(); parameters.Add(new SqlParameter("@purchaseorder_id", @purchaseorder_id)); parameters.Add(new SqlParameter("@product_code", @product_code)); @helper.Execute(commandText, CommandType.StoredProcedure, parameters); }
/// <summary> /// Updates a PurchaseOrderItem into the data store based on the primitive properties. This can be used as the /// update method for an ObjectDataSource. /// </summary> /// <param name="purchaseorder_id">purchaseorder_id</param> /// <param name="product_code">product_code</param> /// <param name="barcode">barcode</param> /// <param name="description">description</param> /// <param name="quantity">quantity</param> /// <param name="cost_price">cost_price</param> public static void UpdatePurchaseOrderItem(int @purchaseorder_id, string @product_code, string @barcode, string @description, double @quantity, decimal @cost_price) { using (SqlHelper helper = new SqlHelper()) { try { helper.BeginTransaction(); UpdatePurchaseOrderItem(@purchaseorder_id, @product_code, @barcode, @description, @quantity, @cost_price, helper); helper.Commit(); } catch { helper.Rollback(); throw; } } }
/// <summary> /// Deletes PurchaseOrderItem objects by a PurchaseOrder unique identifier. /// </summary> /// <param name="purchaseorder_id">purchaseorder_id</param> public static void DeletePurchaseOrderItemsBypurchaseorder_(int purchaseorder_id) { string commandText = "PurchaseOrderItemDeleteByPurchaseOrder"; System.Collections.Generic.List<SqlParameter> parameters = new System.Collections.Generic.List<SqlParameter>(); parameters.Add(new SqlParameter("@purchaseorder_id", purchaseorder_id)); using (SqlHelper helper = new SqlHelper()) { helper.Execute(commandText, CommandType.StoredProcedure, parameters); } }