public ContentResult DeleteReceiveMsg(string rid) { try { string sql = "delete from T_Receive_Message where Record_Id='" + rid + "'"; DBOperation db = new DBOperation(); db.ExecuteSql(sql); return(Content("{\"result\":\"success\"}")); } catch (Exception ex) { return(Content("{\"result\":\"error\"}")); } }
public string get_unread_user_list(string mid) { string sql = "select u.ID,u.Name from T_Receive_Message m"; sql += " LEFT JOIN Z_User u"; sql += " on u.ID=m.Receiver_Id"; sql += " where m.Msg_Status='0' "; sql += " and m.Msg_Id='" + mid + "' "; DBOperation db = new DBOperation(); DataSet ds = new DataSet(); ds = db.GetDataSet(sql); return("{\"result\":\"success\",\"list\":" + JsonHelper.ToJson(ds) + "}"); }
//数据采集触发 private void tbCaseNumber_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar == 13) { String result = HttpRequest.ConfirmLowerCodeRelation(QRanalyze.QRDecod(tbCaseNumber.Text.Substring(tbCaseNumber.Text.Length - 35, 35)), Session.Id); RelationResult Result = JsonConvert.DeserializeObject <RelationResult>(result); if (!Result.success) { throw new Exception(Result.message); } if (Datas.Add(tbCaseNumber.Text.Substring(tbCaseNumber.Text.Length - 35, 35))) { capsum++; tbCapSum.Text = capsum.ToString(); DataSource.Rows.Add(capsum.ToString(), tbCaseNumber.Text.Substring(tbCaseNumber.Text.Length - 35, 35), DateTime.Now.ToString()); } else { MessageBox.Show(tbCaseNumber.Text + "重复扫描"); } //一箱数据采集完毕 if (Datas.Count == BaseData.CapSum) { DBOperation dBOperation = new DBOperation(); Guid BoxId = Guid.NewGuid(); dBOperation.AddBoxs(BoxId); dBOperation.CreatBoxOrder(BoxId, Datas); dBOperation.Dispose(); Datas.Clear(); DataSource.Clear(); capsum = 0; tbCapSum.Text = capsum.ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { tbCaseNumber.Text = ""; } }
IList <DataTable> DiffSpaceBoundary() { IList <DataTable> qResults = new List <DataTable>(); string spacebTableNew = DBOperation.formatTabName("BIMRL_RELSPACEBOUNDARY", compNewModel.Value); string spacebTableRef = DBOperation.formatTabName("BIMRL_RELSPACEBOUNDARY", compRefModel.Value); string spacebReport = "select a.spaceelementid \"Space ID (New)\", a.boundaryelementid \"Boundary ID (New)\", a.boundaryelementtype \"Boundary Elem Type (New)\", a.boundarytype \"Boundary Type (New)\", a.internalorexternal \"Internal or External (New)\", " + "b.spaceelementid \"Space ID (Ref)\", b.boundaryelementid \"Boundary ID (Ref)\", b.boundaryelementtype \"Boundary Elem Type (Ref)\", b.boundarytype \"Boundary Type (Ref)\", b.internalorexternal \"Internal or External (Ref)\" " + "from " + spacebTableNew + " a full outer join " + spacebTableRef + " b on(a.spaceelementid = b.spaceelementid and a.boundaryelementid = b.boundaryelementid) " + "where a.boundaryelementid != b.boundaryelementid or (a.boundaryelementid is null and b.boundaryelementid is not null) or (a.boundaryelementid is not null and b.boundaryelementid is null)"; DataTable spacebRes = queryMultipleRows(spacebReport, "Space Boundary Changes"); qResults.Add(spacebRes); return(qResults); }
public void given_a_product_when_persisting_then_successfully_persisted() { Product product = new Product(); string name = "test_product_01"; product.Name = name; IProductService service = Bootstrapper.Resolve <IProductService>(); service.AddNewProduct(product); List <Product> item = DBOperation.ReadAllProducts(); item.Count.Should().Be(1, "item count !!!"); item[0].Name.Should().Be(name, "product name !!!"); item[0].Id.Should().Be(1, "product id !!!"); }
IList <DataTable> DiffElementDependency() { IList <DataTable> qResults = new List <DataTable>(); string dependTableNew = DBOperation.formatTabName("BIMRL_ELEMENTDEPENDENCY", compNewModel.Value); string dependTableRef = DBOperation.formatTabName("BIMRL_ELEMENTDEPENDENCY", compRefModel.Value); string dependReport = "Select a.elementid \"Element ID (New)\", a.elementtype \"Element Type (New)\", a.DEPENDENTELEMENTID \"Dependent Element ID (New)\", a.DEPENDENTELEMENTTYPE \"Dependent Element Type (New)\", a.dependencytype \"Dependency Type (New)\", " + "b.elementid \"Element ID (Ref)\", b.elementtype \"Element Type (Ref)\", b.DEPENDENTELEMENTID \"Dependent Element ID (Ref)\", b.DEPENDENTELEMENTTYPE \"Dependent Element Type (Ref)\", b.dependencytype \"Dependency Type (Ref)\" " + "from " + dependTableNew + " a full outer join " + dependTableRef + " b on (a.elementid=b.elementid and a.dependentelementid=b.dependentelementid) " + "where (a.dependentelementid is null and b.dependentelementid is not null) or (a.dependentelementid is not null and b.dependentelementid is null)"; DataTable dependRes = queryMultipleRows(dependReport, "Element Dependency Changes"); qResults.Add(dependRes); return(qResults); }
/*根据开始时间和结束时间查询所有员工的销售业绩信息*/ public static DataSet QueryEmployeeSellResult(string startTime, string endTime) { /*首先清空员工销售业绩信息表中的信息(因为要对其进行重新统计*/ string sqlString = "delete from [employeeSellResult]"; DBOperation.ExecuteNonQuery(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null); /*查询所有的员工信息*/ sqlString = "select employeeNo,employeeName from [employeeInfo]"; DataSet employeeInfoDs = DBOperation.GetDataSet(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null); /*遍历每个员工记录,统计该员工在查询时间类的销售总金额*/ for (int i = 0; i < employeeInfoDs.Tables[0].Rows.Count; i++) { DataRow employeeInfoRow = employeeInfoDs.Tables[0].Rows[i]; string employeeNo = employeeInfoRow["employeeNo"].ToString(); string employeeName = employeeInfoRow["employeeName"].ToString(); /*查询该员工在指定时间内的销售业绩*/ sqlString = "select sum(totalPrice) as employeeSellMoney from [sellInfo] where employeeNo='" + employeeNo + "'"; if (startTime != "") { sqlString += " and sellTime >= '" + Convert.ToDateTime(startTime) + "'"; } if (endTime != "") { sqlString += " and sellTime <= '" + Convert.ToDateTime(endTime) + "'"; } float employeeSellMoney; try { employeeSellMoney = Convert.ToSingle(DBOperation.ExecuteScalar(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null)); } catch (Exception exp) { employeeSellMoney = 0.0f; } /*将该员工该时间内的销售业绩加入到信息表中*/ sqlString = "insert into [employeeSellResult] (employeeNo,employeeName,employeeSellMoney) values ('"; sqlString += employeeNo + "','"; sqlString += employeeName + "',"; sqlString += employeeSellMoney + ")"; DBOperation.ExecuteNonQuery(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null); } /*所有员工在该时间段内的销售业绩计算完毕后就返回该结果集(按销售额排序)*/ sqlString = "select * from [employeeSellResult] order by employeeSellMoney DESC"; return(DBOperation.GetDataSet(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null)); }
public async Task DeleteDraftAsync(DraftMessage msg) { using (var dbop = new DBOperation()) { try { mCmd_DeleteDraft.Parameters["@draftid"].Value = msg.DraftId.ToString(); await mCmd_DeleteDraft.ExecuteNonQueryAsync(); mDrafts.Remove(msg); } catch (SQLiteException e) { throw new AccountDatabaseException(string.Format("Unable to save draft. Database error({0}).", e.ErrorCode)); } } }
IList <DataTable> DiffGroupMembership() { IList <DataTable> qResults = new List <DataTable>(); string groupRelTableNew = DBOperation.formatTabName("BIMRL_RELGROUP", compNewModel.Value); string groupRelTableRef = DBOperation.formatTabName("BIMRL_RELGROUP", compRefModel.Value); string groupRelReport = "Select a.groupelementid \"Group ID (New)\", a.groupelementtype \"Group Type (New)\", a.memberelementid \"Member ID (New)\", a.memberelementtype \"Member Type (New)\", " + "b.groupelementid \"Group ID (Ref)\", b.groupelementtype \"Group Type (Ref)\", b.memberelementid \"Member ID (Ref)\", b.memberelementtype \"Member Type (Ref)\" " + "from " + groupRelTableNew + " a full outer join " + groupRelTableRef + " b on (a.groupelementid=b.groupelementid and a.memberelementid=b.memberelementid) " + "where (a.memberelementid is null and b.memberelementid is not null) or (a.memberelementid is not null and b.memberelementid is null)"; DataTable groupRelRes = queryMultipleRows(groupRelReport, "Group Membership"); qResults.Add(groupRelRes); return(qResults); }
/*根据员工编号得到购物车中商品的总价格*/ public static float GetTotalPriceInCart(string employeeNo) { float totalPrice = 0.0f; /*查询该员工的购物车*/ string sqlString = "select * from [goodCartInfo] where employeeNo='" + employeeNo + "'"; DataSet cartInfoDs = DBOperation.GetDataSet(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null); /*遍历购物车中每条商品销售记录并计算总的价格*/ for (int i = 0; i < cartInfoDs.Tables[0].Rows.Count; i++) { DataRow dr = cartInfoDs.Tables[0].Rows[i]; float price = Convert.ToSingle(dr["goodPrice"]); int number = Convert.ToInt32(dr["goodCount"]); totalPrice += (price * number); } return(totalPrice); }
IList <DataTable> DiffClassification() { IList <DataTable> qResults = new List <DataTable>(); string classifTableNew = DBOperation.formatTabName("BIMRL_CLASSIFASSIGNMENT", compNewModel.Value); string classifTableRef = DBOperation.formatTabName("BIMRL_CLASSIFASSIGNMENT", compRefModel.Value); string classifReport = "select a.elementid \"ElementID (New)\", a.classificationname \"Classification Name (New)\", a.classificationitemcode \"Code (New)\", a.fromtype \"FromType?\", " + "b.elementid \"ElementID (Ref)\", b.classificationname \"Classification Name (Ref)\", b.classificationitemcode \"Code (Ref)\", b.fromtype \"FromType?\"" + " from " + classifTableNew + " a full outer join " + classifTableRef + " b on (a.elementid = b.elementid and a.classificationname = b.classificationname and a.classificationitemcode = b.classificationitemcode) " + "where (a.classificationitemcode is null and b.classificationitemcode is not null) or (a.classificationitemcode is not null and b.classificationitemcode is null)"; DataTable classifRes = queryMultipleRows(classifReport, "Classification Assignments"); qResults.Add(classifRes); return(qResults); }
public ContentResult DoEditSchool(string RecordId, string SchoolName) { try { DBOperation db = new DBOperation(); string sql = ""; sql = "update Z_School set SchoolName = '" + SchoolName + "' where RecordId = '" + RecordId + "'"; db.ExecuteSql(sql); return(Content("{\"result\":\"success\"}")); } catch (Exception ex) { return(Content("{\"result\":\"error\"}")); } }
public ContentResult EditRule(string RecordId, string PointRuleName, int Point) { try { DBOperation db = new DBOperation(); string sql = ""; sql = "update Z_PointRule set PointRuleName = '" + PointRuleName + "', Point = " + Point + " where RecordId = '" + RecordId + "'"; db.ExecuteSql(sql); return(Content("{\"result\":\"success\"}")); } catch (Exception ex) { return(Content("{\"result\":\"error\"}")); } }
/*传入商品销售信息模型,实现销售信息的登记操作*/ public static bool AddSellInfo(SellInfoModel sellInfoModel) { string sqlString = "insert into [sellInfo] (sellNo,goodNo,price,number,totalPrice,sellTime,employeeNo) values ('"; sqlString += sellInfoModel.SellNo + "','"; sqlString += sellInfoModel.GoodNo + "',"; sqlString += sellInfoModel.Price + ","; sqlString += sellInfoModel.Number + ","; sqlString += sellInfoModel.TotalPrice + ",'"; sqlString += sellInfoModel.SellTime + "','"; sqlString += sellInfoModel.EmployeeNo + "')"; if (DBOperation.ExecuteNonQuery(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null) <= 0) { return(false); } return(true); }
public bool isExit(string username) { DataSet ds = new DataSet(); string sql = "select * from Z_User where Login_Name='" + username + "'"; DBOperation db = new DBOperation(); ds = db.GetDataSet(sql); if (ds.Tables[0].Rows.Count > 0) { return(true); } else { return(false); } }
IList <DataTable> DiffAggregation() { IList <DataTable> qResults = new List <DataTable>(); string aggrTableNew = DBOperation.formatTabName("BIMRL_RELAGGREGATION", compNewModel.Value); string aggrTableRef = DBOperation.formatTabName("BIMRL_RELAGGREGATION", compRefModel.Value); string aggrReport = "Select a.masterelementid \"Master ID (New)\", a.masterelementtype \"Master Type (New)\", a.aggregateelementid \"Aggre ID (New)\", a.aggregateelementtype \"Aggr Type (New)\", " + "b.masterelementid \"Master ID (Ref)\", b.masterelementtype \"Master Type (Ref)\", b.aggregateelementid \"Aggre ID (Ref)\", b.aggregateelementtype \"Aggr Type (Ref)\" " + "from " + aggrTableNew + " a full outer join " + aggrTableRef + " b on (a.masterelementid=b.masterelementid and a.aggregateelementid=b.aggregateelementid) " + "where (a.aggregateelementid is null and b.aggregateelementid is not null) or (a.aggregateelementid is not null and b.aggregateelementid is null)"; DataTable aggrRes = queryMultipleRows(aggrReport, "Aggregation Changes"); qResults.Add(aggrRes); return(qResults); }
public string UpdateUser(string from, string username, string password, string realname, string sex, string email) { try { //string content = "from:" + from + "username:"******"password:"******"realname:" + realname + "sex:" + sex + "email:" + email; //clsLog.ErrorLog("update", "", content); DateTime CreateTime = DateTime.Now; if (password != "") { byte[] result = Encoding.Default.GetBytes(password); //Password为输入密码的文本 MD5 md5 = new MD5CryptoServiceProvider(); byte[] output = md5.ComputeHash(result); password = BitConverter.ToString(output).Replace("-", "").ToLower(); //tbMd5pass为输出加密文本的 } if (string.IsNullOrEmpty(realname)) { realname = username; } else { realname = Server.UrlDecode(realname); } string sql = "update Z_User set Name='" + realname + "'"; if (password != "") { sql = sql + " ,Password='******'"; } sql = sql + " ,EditDate='" + CreateTime + "'"; sql = sql + " where ID='" + username + "'"; //clsLog.ErrorLog("", "", sql); DBOperation db = new DBOperation(); db.ExecuteSql(sql); return("{\"result\":\"success\"}"); } catch (Exception ex) { return("{\"result\":\"error\"}"); } }
/*根据查询条件实现商品库存信息的查询*/ public static DataSet QueryGoodStockInfo(string goodNo, string goodName, int goodClassId) { string sqlString = "select * from [goodStockInfo] where 1=1"; if (goodNo != "") { sqlString += " and goodNo like '%" + goodNo + "%'"; } if (goodName != "") { sqlString += " and goodName like '%" + goodName + "%'"; } if (goodClassId != 0) { sqlString += " and goodClassId = " + goodClassId; } return(DBOperation.GetDataSet(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null)); }
public void given_a_product_when_listing_then_return_one_product() { DBOperation.CreateOneProduct(); string name = "test_product_01"; Bootstrapper.Initialize(); IProductService service = Bootstrapper.Resolve <IProductService>(); Product product = service.GetProduct(1); product.Should().NotBeNull(); product.Name.Should().Be(name, "product name !!!"); product.Id.Should().Be(1, "product id !!!"); Bootstrapper.Dispose(); }
//削除 private void BtnDelete_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = MessageBox.Show("本当に削除しますか?", "Delete Confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { try { DBOperation.DeleteRecord(_vm.SelectedPath, _vm.Table, _vm.RowID); _vm.DialogResultFlag = true; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void UpdateFiscalControl(DBOperation operation) { if (fiscalControlList != null) { foreach (ICounterManager fC in fiscalControlList) { if (fC.IsUpdatable) { fC.UpdateValue(operation); } if (operation == DBOperation.Get) { fC.StatesButton = false; } } } }
public string GetSchoolName(string schoolid) { string sql = "select * from Z_School where RecordId='" + schoolid + "'"; DBOperation db = new DBOperation(); DataSet ds = new DataSet(); ds = db.GetDataSet(sql); string SchoolName = ""; if (ds.Tables[0].Rows.Count > 0) { SchoolName = ds.Tables[0].Rows[0]["SchoolName"].ToString(); } return(SchoolName); }
/// <summary> /// 检索用户 /// </summary> /// <param name="username">用户名</param> /// <returns></returns> public string search_user(string username) { try { string sql = "select ID,Name from Z_User "; sql = sql + " where Name like'%" + username + "%' "; DBOperation db = new DBOperation(); DataSet ds = new DataSet(); ds = db.GetDataSet(sql); return("{\"result\":\"success\",\"list\":" + JsonHelper.ToJson(ds) + "}"); } catch (Exception ex) { return("{\"result\":\"error\"}"); } }
public HttpResponseMessage SaveRating(UserRating objUserRating) { #region declaration DataTable dt = new DataTable(); string sQuery = ""; Random r = new Random(); DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[4]; int iParamCount = 0; #endregion DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString); objParam[iParamCount].sParamName = "@vQueryType"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = "RATE"; iParamCount++; objParam[iParamCount].sParamName = "@vRaterID"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objUserRating.RaterID); iParamCount++; objParam[iParamCount].sParamName = "@vRating"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objUserRating.Rating); iParamCount++; objParam[iParamCount].sParamName = "@vUserID"; objParam[iParamCount].sParamType = SqlDbType.VarChar; objParam[iParamCount].sParamValue = Convert.ToString(objUserRating.UserID); iParamCount++; sQuery = "ProcRatingOperation"; sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt); if (sRetVal == "SUCCESS") { return(Request.CreateResponse(HttpStatusCode.OK, "Rated Successfully")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal)); } }
/*传入商品退货信息模型,执行商品的退货操作*/ public bool AddBuyBackInfo(BuyBackInfoModel buyBackInfoModel) { /*商品查询是否存在该商品编号*/ string sqlString = "select * from [goodInfo] where goodNo='" + buyBackInfoModel.GoodNo + "'"; if (!DBOperation.ExecuteReader(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null).Read()) { this.errMessage = "你输入的商品信息不存在!"; return(false); } /*查询该商品目前的库存量*/ sqlString = "select goodCount from [goodStockInfo] where goodNo='" + buyBackInfoModel.GoodNo + "'"; int goodCount = Convert.ToInt32(DBOperation.ExecuteScalar(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null)); if (buyBackInfoModel.Number > goodCount) { this.errMessage = "你输入的该商品数量不能大于库存量"; return(false); } /*将该商品退货信息登记入系统中*/ sqlString = "insert into buyBackInfo (goodNo,supplierName,price,number,totalPrice,buyBackDate,buyBackReason,buyBackAddTime) values ('"; sqlString += buyBackInfoModel.GoodNo + "','"; sqlString += buyBackInfoModel.SupplierName + "',"; sqlString += buyBackInfoModel.Price + ","; sqlString += buyBackInfoModel.Number + ","; sqlString += buyBackInfoModel.TotalPrice + ",'"; sqlString += buyBackInfoModel.BuyBackDate + "','"; sqlString += buyBackInfoModel.BuyBackReason + "','"; sqlString += buyBackInfoModel.BuyBackAddTime + "')"; /*调用数据层执行信息登记操作*/ if (DBOperation.ExecuteNonQuery(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null) <= 0) { this.errMessage = "商品进货退货登记时发生了数据错误!"; return(false); } /*商品退货后需要更新对应商品的库存*/ sqlString = "update [goodStockInfo] set goodCount = goodCount - " + buyBackInfoModel.Number + " where goodNo='" + buyBackInfoModel.GoodNo + "'"; if (DBOperation.ExecuteNonQuery(DBOperation.CONN_STRING_NON_DTC, CommandType.Text, sqlString, null) <= 0) { this.errMessage = "商品进货退货时修改商品库存发生了错误!"; return(false); } return(true); }
public List <object> GetTeacherList(string TeacherName, string schoolId, int pagesize, int pagecurrent, string Type) { int iFrom = (pagecurrent - 1) * pagesize + 1; int iTo = pagecurrent * pagesize; if (string.IsNullOrEmpty(TeacherName)) { TeacherName = ""; } List <object> Ret = new List <object>(); try { string sql = " "; sql = sql + "with cte as( "; sql = sql + " select id0=ROW_NUMBER()over(order by EditDate desc),* "; sql = sql + " from Z_User "; sql = sql + " left join Z_School s on s.RecordId = Z_User.SchoolId "; sql = sql + " where Z_User.Name like '%" + TeacherName + "%' and Z_User.Type = '" + Type + "' "; if (schoolId != "") { sql = sql + " and Z_User.SchoolId = '" + schoolId + "'"; } sql = sql + " ) "; sql = sql + " select * from cte "; sql = sql + " where id0 between " + iFrom + " and " + iTo + " "; DBOperation db = new DBOperation(); DataSet ds = new DataSet(); ds = db.GetDataSet(sql); //保存数据表并返回 Ret.Add(ds); return(Ret); //return "{\"result\":\"success\",\"list\":" + ToJosn.wxListToJson(Ret) + "}"; } catch (Exception ex) { Ret.Add("state:0,msg:获取数据错误!"); return(Ret); } }
public ContentResult SaveSendMsg(FormCollection form, string[] tousergroup) { try { string Msg_Id = Guid.NewGuid().ToString(); string Msg_Title = form["Msg_Title"].ToString(); string Msg_Content = form["Msg_Content"].ToString(); string Send_Id = CommonUtil.GetSession(Session, "id"); string Type = form["Type"].ToString(); DateTime Send_Time = DateTime.Now; DBOperation db = new DBOperation(); Dictionary <string, object> SQLStringList = new Dictionary <string, object>(); SqlParameter[] paraimgdel = new SqlParameter[1]; paraimgdel[0] = new SqlParameter("@Msg_Id", Msg_Id); string sql = "insert into T_Message (Msg_Id,Msg_Title,Msg_Content,Send_Id,Send_Time,Type) values ('" + Msg_Id + "','" + Msg_Title + "','" + Msg_Content + "','" + Send_Id + "','" + Send_Time + "','" + Type + "')"; SQLStringList.Add(sql, paraimgdel); string sqlselect = ""; for (int i = 0; i < tousergroup.Length; i++) { string Receiver_Id = tousergroup[i]; string Msg_Status = "0"; string Record_Id = Guid.NewGuid().ToString(); if (sqlselect != "") { sqlselect = sqlselect + " UNION ALL "; } sqlselect += " select '" + Msg_Id + "','" + Receiver_Id + "','" + Msg_Status + "','" + Record_Id + "','" + Msg_Title + "','" + Msg_Content + "','" + Type + "','" + Send_Id + "','" + Send_Time + "'"; } string sqlInsert = "insert into T_Receive_Message (Msg_Id,Receiver_Id,Msg_Status,Record_Id,Msg_Title,Msg_Content,Type,Send_Id,Send_Time) "; sqlInsert += sqlselect; SQLStringList.Add(sqlInsert, paraimgdel); db.ExecuteSqlTran_sort(SQLStringList); return(Content("{\"result\":\"success\"}")); } catch (Exception ex) { return(Content("{\"result\":\"error\"}")); } }
public ContentResult DoAddSchool(string SchoolName) { try { string RecordId = Guid.NewGuid().ToString(); DateTime CreateTime = DateTime.Now; string sql = "insert into Z_School (RecordId,SchoolName,CreateTime) values ('" + RecordId + "','" + SchoolName + "','" + CreateTime + "')"; DBOperation db = new DBOperation(); db.ExecuteSql(sql); return(Content("{\"result\":\"success\"}")); } catch (Exception ex) { return(Content("{\"result\":\"error\"}")); } }
public void given_two_products_when_listing_then_return_one_product_with_id_2() { DBOperation.CreateTwoProducts(); string name = "test_product_02"; int productId = 2; Bootstrapper.Initialize(); IProductService service = Bootstrapper.Resolve <IProductService>(); Product product = service.GetProduct(productId); product.Should().NotBeNull(); product.Name.Should().Be(name, "product name !!!"); product.Id.Should().Be(productId, "product id !!!"); Bootstrapper.Dispose(); }
IList <DataTable> DiffContainment() { IList <DataTable> qResults = new List <DataTable>(); string elemTableNew = DBOperation.formatTabName("BIMRL_ELEMENT", compNewModel.Value); string elemTableRef = DBOperation.formatTabName("BIMRL_ELEMENT", compRefModel.Value); string containerReport = "select tab1.*, tab2.* from " + "(select a.elementid id_new, a.elementtype \"Element Type (New)\", a.name \"Element Name (New)\", b.elementid as containerid_new, b.name as containername_new, b.longname as containerlongname_new from " + elemTableNew + " a, " + elemTableNew + " b where b.elementid = a.container) tab1 " + "full outer join " + "(select c.elementid as id_ref, c.elementtype \"Element Type (Ref)\", c.name \"Element Name (Ref)\", d.elementid as containerid_ref, d.name as containername_ref, d.longname as containerlongname_ref from " + elemTableRef + " c, " + elemTableRef + " d where d.elementid = c.container) tab2 " + "on tab1.id_new = tab2.id_ref " + "where tab1.containerid_new != tab2.containerid_ref or(tab1.containerid_new is not null and tab2.containerid_ref is null) or(tab1.containerid_new is null and tab2.containerid_ref is not null)"; DataTable containerRes = queryMultipleRows(containerReport, "Container Assignment Changes"); qResults.Add(containerRes); return(qResults); }