public APIResult Save() { StringBuilder commandText = new StringBuilder(); commandText.Append(SQLHelper.GetSaveCommandText(typeof(PanelSetOrderCPTCodeBill), this, this.m_RowOperationType)); //string xx = commandText.ToString(); JObject apiRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText.ToString()); APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(apiRequest); this.m_RowOperationType = RowOperationTypeEnum.Update; return(apiResult); }
public APIResult Save() { StringBuilder commandText = new StringBuilder(); commandText.Append(SQLHelper.GetSaveCommandText(typeof(ClientOrder), this, this.m_RowOperationType)); commandText.Append(this.m_ClientOrderDetailCollection.GetSQLSaveCommands()); string xx = commandText.ToString(); JObject apiRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText.ToString()); APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(apiRequest); this.m_RowOperationType = RowOperationTypeEnum.Update; return(apiResult); }
public APIResult Delete() { StringBuilder commandText = new StringBuilder(); if (this.m_ClientOrderDetailCollection.Count > 0) { commandText.Append($"delete from tblClientOrderDetail where clientOrderId = '{this.ClientOrderId}';"); } commandText.Append($"delete from tblClientOrder where clientOrderId = '{this.ClientOrderId}';"); JObject apiRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText.ToString()); APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(apiRequest); this.m_RowOperationType = RowOperationTypeEnum.Delete; return(apiResult); }
public static string GetSaveCommandText(Type type, object domainObject, RowOperationTypeEnum rowOperationType) { string commandText = ""; switch (rowOperationType) { case RowOperationTypeEnum.Insert: commandText = SQLHelper.GetInsertCommands(type, domainObject); break; case RowOperationTypeEnum.Update: commandText = SQLHelper.GetUpdateCommands(type, domainObject); break; case RowOperationTypeEnum.Delete: commandText = SQLHelper.GetDeleteCommands(type, domainObject); break; default: throw new Exception("This row operation type is not handled."); } return(commandText); }