/// <summary> /// 确认订单变更 /// </summary> /// <param name="id">变更编号</param> /// <param name="surePersonId">确认人编号</param> /// <param name="surePerson">确认人</param> /// <returns></returns> public int UpdateTourOrderChange(string id, string surePersonId, string surePerson) { DbCommand cmd = _db.GetStoredProcCommand("proc_TourOrderChange_Update"); _db.AddInParameter(cmd, "Id", DbType.AnsiStringFixedLength, id); _db.AddInParameter(cmd, "SurePersonId", DbType.AnsiStringFixedLength, surePersonId); _db.AddInParameter(cmd, "SurePerson", DbType.String, surePerson); _db.AddOutParameter(cmd, "Result", DbType.Int32, 4); DbHelper.RunProcedureWithResult(cmd, _db); return(Convert.ToInt32(_db.GetParameterValue(cmd, "Result"))); }
private void GvList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewColumn column = GvList.Columns[e.ColumnIndex]; var id = GvList.Rows[e.RowIndex].Cells["id"].Value.ToString(); var ProjectNo = GvList.Rows[e.RowIndex].Cells["ProjectNo"].Value.ToString(); var PartNo = GvList.Rows[e.RowIndex].Cells["PartNo"].Value.ToString(); var PartName = GvList.Rows[e.RowIndex].Cells["PartName"].Value.ToString(); if (column is DataGridViewButtonColumn) { var temp = column as DataGridViewButtonColumn; if (temp.DefaultCellStyle.NullValue.ToString() == "删除") { if (MessageBox.Show("确定要删除数据吗 ?删除数据将不可恢复!", "Confirm Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { SqlParameter[] p = new SqlParameter[] { new SqlParameter("@MeasReportID", id), }; var dbc = db.GetStoredProcCommand("DeleteMeasurementReports"); dbc.Parameters.AddRange(p); var number = db.ExecuteNonQuery(dbc); if (number > 0) { GvBind(); } else { MessageBox.Show("删除失败"); } } } else if (temp.DefaultCellStyle.NullValue.ToString() == "查询") { FrmIndex1 _FrmIndex1 = new FrmIndex1(int.Parse(id), ProjectNo, PartNo, PartName); _FrmIndex1.Show(); } else { MessageBox.Show("未知响应事件"); } } } }
/// <summary> /// Get stored procedure command. /// </summary> /// <param name="spName"> Name of the stored procedure.</param> /// <returns>Returns the Dbcommand</returns> public static DbCommand GetStoredProcCommand(string spName) { DbCommand dbCommand = null; try { Microsoft.Practices.EnterpriseLibrary.Data.Database db = DBSelector.Instance.GetDataBase; dbCommand = db.GetStoredProcCommand(spName); } catch (Exception ex) { throw ex; } return dbCommand; }
public override decimal GetTaxRate(string zip) { decimal dOut = 0; //load the default db from the base class Microsoft.Practices.EnterpriseLibrary.Data.Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(); //specify the SP string cmd = "CSK_Tax_GetTaxRate"; using (DbCommand dbCommand = db.GetStoredProcCommand(cmd)) { db.AddInParameter(dbCommand, "@zip", DbType.String, zip); //return a reader using the Ent Blocks using (IDataReader rdr = db.ExecuteReader(dbCommand)) { if (rdr.Read()) { dOut = (decimal)rdr["rate"]; } } //load routine closes the reader if flag is set to true; return(dOut); } }
//操作中——销售未派计划 //已落实——计调配置完毕 /// <summary> ///1:添加成功 ///0:添加失败 /// </summary> /// <param name="single">单项业务的实体</param> /// <returns></returns> public int AddSingleService(MSingleServiceExtend single) { string tourId = string.IsNullOrEmpty(single.TourId) ? Guid.NewGuid().ToString() : single.TourId; string OrderId = string.IsNullOrEmpty(single.OrderId) ? Guid.NewGuid().ToString() : single.OrderId; string travellerXML = string.Empty;//游客信息 if (single.TourOrderTravellerList != null) { travellerXML = CreateTourOrderTravellerXml(single.TourOrderTravellerList, OrderId);//游客信息 } string teamPriceXMl = string.Empty;//客人要求(分项报价) if (single.TourTeamPriceList != null) { teamPriceXMl = CreateTourTeamPriceXml(tourId, single.TourTeamPriceList); } string planXML = string.Empty;//供应商安排 if (single.PlanBaseInfoList != null) { planXML = CreatePlanBaseInfoXml(tourId, single.CompanyId, single.OperatorDeptId, single.PlanBaseInfoList); } string planerXML = string.Empty;//计调员信息 if (single.TourPlanersList != null) { planerXML = CreateTourPlanerXML(tourId, single.TourPlanersList); } DbCommand cmd = _db.GetStoredProcCommand("proc_TourOrder_Add_SingleService"); _db.AddInParameter(cmd, "TourId", DbType.AnsiStringFixedLength, tourId); _db.AddInParameter(cmd, "TourCode", DbType.String, single.TourCode); _db.AddInParameter(cmd, "OrderId", DbType.AnsiStringFixedLength, OrderId); _db.AddInParameter(cmd, "OrderCode", DbType.String, single.OrderCode); _db.AddInParameter(cmd, "CompanyId", DbType.AnsiStringFixedLength, single.CompanyId); _db.AddInParameter(cmd, "BuyCompanyName", DbType.String, single.BuyCompanyName); _db.AddInParameter(cmd, "BuyCompanyId", DbType.AnsiStringFixedLength, single.BuyCompanyId); _db.AddInParameter(cmd, "ContactDepartId", DbType.String, single.ContactDepartId); _db.AddInParameter(cmd, "ContactName", DbType.String, single.ContactName); _db.AddInParameter(cmd, "ContactTel", DbType.String, single.ContactTel); _db.AddInParameter(cmd, "Adults", DbType.Int32, single.Adults); _db.AddInParameter(cmd, "SellerId", DbType.AnsiStringFixedLength, single.SellerId); _db.AddInParameter(cmd, "SellerName", DbType.String, single.SellerName); _db.AddInParameter(cmd, "DeptId", DbType.String, single.DeptId);//销售员部门编号 _db.AddInParameter(cmd, "OperatorId", DbType.AnsiStringFixedLength, single.OperatorId); _db.AddInParameter(cmd, "Operator", DbType.String, single.Operator); _db.AddInParameter(cmd, "TourIncome", DbType.Currency, single.TourIncome); _db.AddInParameter(cmd, "TourPay", DbType.Currency, single.TourPay);//合计支出 _db.AddInParameter(cmd, "TourProfit", DbType.Currency, single.TourProfit); _db.AddInParameter(cmd, "TravellerFile", DbType.String, single.TravellerFile); _db.AddInParameter(cmd, "TourStatus", DbType.Byte, (int)single.TourStatus);//计划状态 _db.AddInParameter(cmd, "MTourOrderTraveller", DbType.String, travellerXML); _db.AddInParameter(cmd, "MTourTeamPrice", DbType.String, teamPriceXMl); _db.AddInParameter(cmd, "MPlanBaseInfo", DbType.String, planXML); _db.AddInParameter(cmd, "MTourPlaner", DbType.String, planerXML); _db.AddOutParameter(cmd, "Result", DbType.Int32, 4); _db.AddInParameter(cmd, "WeiTuoRiQi", DbType.DateTime, single.WeiTuoRiQi); _db.AddInParameter(cmd, "HeTongId", DbType.AnsiStringFixedLength, single.HeTongId); _db.AddInParameter(cmd, "XuHao", DbType.Int32, single.XuHao); DbHelper.RunProcedureWithResult(cmd, _db); return(Utils.GetInt(_db.GetParameterValue(cmd, "Result").ToString(), 4)); }
/// <summary> /// get sp command /// </summary> /// <param name="com"></param> public DbCommand GetStoredProcCommand(string spName) { return(Db.GetStoredProcCommand(spName)); }