public virtual string Delete(ArrayList alDeleteData) { string sqlDelete = "SET XACT_ABORT ON begin TRANSACTION Deletetran "; string errMsg = ""; for (int i = 0; i < alDeleteData.Count; i++) { string _tbname = ((IDeleteEventDate)alDeleteData[i]).TableName; string _pkFieldName = ((IDeleteEventDate)alDeleteData[i]).PkName; string pkValue = ((IDeleteEventDate)alDeleteData[i]).PkValue; sqlDelete = sqlDelete + ConstructDMLSql.ConstructDeleteSql(_tbname, _pkFieldName, pkValue) + ";"; sqlDelete += " IF @@ERROR<>0 begin ROLLBACK TRANSACTION Deletetran return end "; } sqlDelete += " else COMMIT TRANSACTION Deletetran "; if (sqlDelete.Trim().Length == 0) { return(ERR_DAE_DELETE); } try { errMsg = _da.ExecuteDMLSQL(sqlDelete); } catch (System.Data.SqlClient.SqlException e) { return(GetDataBaseErrorsMessage(e)); } return(errMsg); }
public string InsertMaterialVendor(string sItemCode, string sMaterialName, string sVendorID, string sComment, string sVendorName) { string errorMessage = ""; string sSql = "insert into WH_MaterialVendor(MaterialVendorID,ItemCode,VendorID,MaterialName,Comment,VendorName) values ('" + System.Guid.NewGuid().ToString() + "'," + "'" + sItemCode + "','" + sVendorID + "','" + sMaterialName + "','" + sComment + "','" + sVendorName + "')"; errorMessage = _da.ExecuteDMLSQL(sSql); return(errorMessage); }
/// <summary> /// 更新SR的IDKey /// </summary> /// <param name="strPutInIDKey">提交IDKey</param> /// <param name="state"></param> /// <returns></returns> public string UpdateTenderState(string strPutInIDKey, TenderState state) { int iState = Convert.ToInt32(state); string strErrorMsg = string.Empty; string UpdateSql = "UPDATE ServiceRequistion Set SRState = " + iState + " WHERE IDKey = ( SELECT ObjectiveID FROM PutIn Where IDKey = '" + strPutInIDKey + "')"; strErrorMsg = _da.ExecuteDMLSQL(UpdateSql); return(strErrorMsg); }
/// <summary> /// 通过供应商ID生成供应商编号( Added By Liujun at 1.11 ) /// </summary> /// <param name="VendorIDKey">供应商ID</param> /// <returns>供应商编号,如果正常更新则返回编号,如果返回为空则表示更新失败</returns> public string UpdateNo(string VendorIDKey) { string strVendorNo = string.Empty; strVendorNo = GetVendorNo(VendorIDKey); if (strVendorNo.Length > 0) { da.ExecuteDMLSQL("UPDATE Vendor SET VendorNo = '" + strVendorNo + "' WHERE IDKey = '" + VendorIDKey + "'"); } return(strVendorNo); }
public string CancelSubmit(string sIDkey) { string errMsg = string.Empty; string sql = "DELETE FROM PutIn WHERE ObjectiveID = '" + sIDkey + "'"; errMsg = _da.ExecuteDMLSQL(sql); if (errMsg == null || errMsg.Length == 0) { sql = "UPDATE Vendor SET Status = 1 WHERE IDkey='" + sIDkey + "'"; errMsg = _da.ExecuteDMLSQL(sql); return(errMsg); } else { return(errMsg); } }
public string InsertAttachment(string IDKey, string moduleID, string infoID, string ObjectiveType, string ObjectiveID, string AttachAddr, string AttachName, string UploadTime, string AttachSize, string DateOfExpire) { strSql = "Select dbo.f_NextAttachmentOrderID('" + moduleID.Trim() + "','" + infoID.Trim() + "') as AttachmentOrderID"; int iOrderID = int.Parse(pDataAccess.GetDataTable(strSql).Rows[0][0].ToString()); System.DateTime loadTime = Convert.ToDateTime(UploadTime); string sfieldValue = string.Empty; //modify by wxc at 200/12/28 sfieldValue = loadTime.ToString("yyyy-MM-dd HH:mm:ss"); if (DateOfExpire.Trim() == "") { strSql = "INSERT INTO Attachments(IDKey,ObjectiveType,ObjectiveID,AttachAddr,AttachName,OrderID,UploadTime,AttachSize) Values('" + IDKey + "','" + ObjectiveType + "','" + infoID + "','" + AttachAddr + "','" + AttachName + "'," + iOrderID + ",'" + sfieldValue + "'," + double.Parse(AttachSize.Trim()) + ")"; } else { System.DateTime strDateOfExpire = Convert.ToDateTime(DateOfExpire); strSql = "INSERT INTO Attachments(IDKey,ObjectiveType,ObjectiveID,AttachAddr,AttachName,OrderID,UploadTime,AttachSize,DateOfExpire) Values('" + IDKey + "','" + ObjectiveType + "','" + infoID + "','" + AttachAddr + "','" + AttachName + "'," + iOrderID + ",'" + sfieldValue + "'," + double.Parse(AttachSize.Trim()) + ",'" + strDateOfExpire + "')"; } return(pDataAccess.ExecuteDMLSQL(strSql)); }
public string UpdateContratState(string IDKey, int nState) { string UpdateSql = " UPDATE Contract SET State = " + nState + " WHERE IDKey = '" + IDKey + "'"; return(_da.ExecuteDMLSQL(UpdateSql)); }
/// <summary> /// 添加到黑名单后将用户名和密码置为空 /// </summary> /// <param name="strVendorIDKey"></param> public void AddToBlackList(string strVendorIDKey) { string SelectSql = "UPDATE Vendor SET LoginName = '' , Passwd = '' WHERE IDKey = '" + strVendorIDKey + "'"; _da.ExecuteDMLSQL(SelectSql); }