public bool ExecuteTransaction() { if (!Connection()) { return(false); } SqlTransaction transaction = CN.BeginTransaction(); try { foreach (SqlCommand cmd in TransactionCommands) { cmd.Transaction = transaction; cmd.ExecuteNonQuery(); } transaction.Commit(); return(true); } catch (Exception ex) { transaction.Rollback(); _error = ex.Message; } return(false); }
public void HandleFunction() { var values = new Func <string>(() => "apple"); var expected = "apple"; CN.Create(values).ShouldBe(expected); }
public void HandleTupleWithFunction() { var values = ("apple", new Func <bool>(() => true)); var expected = "apple"; CN.Create(values).ShouldBe(expected); }
public void HandleTuple() { var values = ("apple", true); var expected = "apple"; CN.Create(values).ShouldBe(expected); }
public void HandleKeyValuePair() { var values = new KeyValuePair <string, bool>("apple", true); var expected = "apple"; CN.Create(values).ShouldBe(expected); }
public List <PseudoPart> GetPseudoParts() { List <PseudoPart> retList = new List <PseudoPart>(); ConfigNode[] partNodes = shipNode.GetNodes("PART"); // KCTDebug.Log("partNodes count: " + partNodes.Length); foreach (ConfigNode CN in partNodes) { string name = CN.GetValue("part"); string pID = ""; if (name != null) { string[] split = name.Split('_'); name = split[0]; pID = split[1]; } else { name = CN.GetValue("name"); pID = CN.GetValue("uid"); } //for (int i = 0; i < split.Length - 1; i++) // pName += split[i]; PseudoPart returnPart = new PseudoPart(name, pID); retList.Add(returnPart); } return(retList); }
public List <CreditNote> GETCNSID() { DataSet ds = new DataSet(); DBHelper db = new DBHelper(); List <CreditNote> CNs = new List <CreditNote>(); if (conn.State == System.Data.ConnectionState.Closed) { try { conn.Open(); } catch (Exception ex) { log.Error("Cannot open the Database due to: ", ex); return(null); } } try { using (SqlCommand cmd = new SqlCommand("spr_GetDataSAPPI", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 300; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); cmd.ExecuteNonQuery(); conn.Close(); } DataTable CreNote = ds.Tables[0]; CNs = CreNote.AsEnumerable(). Select(CN => new CreditNote { InterfaceType = CN.Field <string>("INTERFACETYPE"), SalesOrg = CN.Field <string>("SALESORG"), SoldtoParty = CN.Field <string>("SOLDTOPARTY"), ShiptoParty = CN.Field <string>("SHIPTOPARTY"), OrderReason = CN.Field <string>("ORDERREASON"), OrderDate = CN.Field <DateTime>("ORDERDATE").ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture), RequestDeliveryDate = CN.Field <DateTime>("REQUESTDELIVERYDATE").ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture), CustomerDocument = CN.Field <string>("CUSTOMERDOCUMENT"), MaterialNumber = CN.Field <string>("MATERIALNUMBER"), OrderQuantity = CN.Field <decimal>("ORDERQUANTITY").ToString(), SalesUnit = CN.Field <string>("SALESUNIT"), ConditionalType = CN.Field <string>("CONDITIONTYPE"), Amount = CN.Field <Decimal>("AMOUNT").ToString(), IONumber = CN.Field <string>("IONUMBER"), GUI = CN.Field <string>("GUI") }).ToList(); log.Info("Get CreditNotes successfull total record: " + CreNote.Rows.Count); return(CNs); } catch (Exception ex) { log.Error("Cannot get CreditNotes due to: ", ex); return(null); } }
public void HandleKeyValuePairWithFunction() { var values = new KeyValuePair <string, Func <bool> >("apple", new Func <bool>(() => true)); var expected = "apple"; CN.Create(values).ShouldBe(expected); }
/// <summary> /// Get formatted name from a CN instance. /// </summary> /// <param name="cn">CN instance.</param> /// <returns>Formatted name string.</returns> internal static string GetNameStringFromCN(CN cn) { if (cn != null) { return((string.IsNullOrEmpty(cn.prefix) ? string.Empty : cn.prefix + " ") + cn.givenname + " " + cn.familyname + (string.IsNullOrEmpty(cn.suffix) ? string.Empty : " " + cn.suffix)); } else { return(null); } }
/// <summary> /// fecha a conexão /// </summary> private static void CloseConnection() { if (!(CN == null)) { if (CN.State == 1) { CN.Close(); } CN = null; } }
public void HandleKeyValuePairs() { var values = new object[] { new KeyValuePair <string, bool>("apple", true), new KeyValuePair <string, bool>("banana", false), new KeyValuePair <string, bool>("cherry", true) }; var expected = "apple cherry"; CN.Create(values).ShouldBe(expected); }
public void HandleDictionary() { var values = new Dictionary <string, bool>() { { "apple", true }, { "banana", false }, { "cherry", true }, }; var expected = "apple cherry"; CN.Create(values).ShouldBe(expected); }
public void HandleTuples() { var values = new object[] { ("apple", true), ("banana", false), ("cherry", true) }; var expected = "apple cherry"; CN.Create(values).ShouldBe(expected); }
public void HandleFunctions() { var values = new Func <string>[] { () => "apple", () => null, () => "banana", }; var expected = "apple banana"; CN.Create(values).ShouldBe(expected); }
private void CMDCAl_Click(object sender, EventArgs e) { //Programa que asigne el valor numerico a las calificaciones dadas //en literal. //Excelente =10, Muy bien =9, Bien =8, Regular =7, Suficiente =6 y No //Acreditado=5 //Silva Reyes Luis Adrian 19210549 //Ejemplo#9B //Declaracion de variables int CN; string CL; //Asignacion de valor CL = TXTCAL.Text; CN = 0; //Seleccion multiple switch (CL) { case "Excelente": CN = 10; break; case "Muy bien": CN = 9; break; case "Bien": CN = 8; break; case "Regular": CN = 7; break; case "Suficiente": CN = 6; break; case "No acreditado": CN = 5; break; default: LBLERROR.Text = "No valida"; break; } LBLCAL1.Text = CN.ToString(); }
///<summary> /// Returns a single repetition of ORDERING PROVIDER(OBR-16). /// throws HL7Exception if the repetition number is invalid. /// <param name="rep">The repetition number (this is a repeating field)</param> ///</summary> public CN GetORDERINGPROVIDER(int rep) { CN ret = null; try { IType t = this.GetField(16, rep); ret = (CN)t; } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error ocurred", ex); } return(ret); }
/** * Returns a single repetition of RESULTS COPIES TO(ORO-3). * @param rep the repetition number (this is a repeating field) * @throws HL7Exception if the repetition number is invalid. */ public CN getRESULTSCOPIESTO(int rep) { CN ret = null; try { Type t = this.getField(3, rep); ret = (CN)t; } catch (System.Exception ex) { HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error ocurred", ex); } return(ret); }
public void HandleTuplesWithFunctions() { var falseFunc = new Func <bool>(() => false); var trueFunc = new Func <bool>(() => true); var values = new object[] { ("apple", trueFunc), ("banana", falseFunc), ("cherry", trueFunc) }; var expected = "apple cherry"; CN.Create(values).ShouldBe(expected); }
/// <summary> Returns a single repetition of CONSULTING DOCTOR (PV1-9).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getCONSULTINGDOCTOR(int rep) { CN ret = null; try { Type t = this.getField(9, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
/// <summary> Returns a single repetition of COLLECTOR IDENTIFIER (OBR-10).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getCOLLECTORIDENTIFIER(int rep) { CN ret = null; try { Type t = this.getField(10, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
/// <summary> Returns a single repetition of ORDERING PROVIDER (OBR-16).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getORDERINGPROVIDER(int rep) { CN ret = null; try { Type t = this.getField(16, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
public void HandleKeyValuePairsWithFunctions() { var falseFunc = new Func <bool>(() => false); var trueFunc = new Func <bool>(() => true); var values = new object[] { new KeyValuePair <string, Func <bool> >("apple", trueFunc), new KeyValuePair <string, Func <bool> >("banana", falseFunc), new KeyValuePair <string, Func <bool> >("cherry", trueFunc) }; var expected = "apple cherry"; CN.Create(values).ShouldBe(expected); }
/// <summary> Returns a single repetition of Collector Identifier (OBR-10).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getCollectorIdentifier(int rep) { CN ret = null; try { Type t = this.getField(10, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
/// <summary> Returns a single repetition of Result Copies To (OBR-28).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getResultCopiesTo(int rep) { CN ret = null; try { Type t = this.getField(28, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
public void HandleDictionaryWithFunction() { var falseFunc = new Func <bool>(() => false); var trueFunc = new Func <bool>(() => true); var values = new Dictionary <string, Func <bool> >() { { "apple", trueFunc }, { "banana", falseFunc }, { "cherry", trueFunc }, }; var expected = "apple cherry"; CN.Create(values).ShouldBe(expected); }
/// <summary> Returns a single repetition of Consulting Doctor (PV1-9).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getConsultingDoctor(int rep) { CN ret = null; try { Type t = this.getField(9, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
/// <summary> Returns a single repetition of RESULTS COPIES TO (ORO-3).</summary> /// <param name="rep">the repetition number (this is a repeating field) /// </param> /// <throws> HL7Exception if the repetition number is invalid. </throws> public virtual CN getRESULTSCOPIESTO(int rep) { CN ret = null; try { Type t = this.getField(3, rep); ret = (CN)t; } catch (System.InvalidCastException) { throw new Exception(); } return(ret); }
private void CMDCAl_Click(object sender, EventArgs e) { //Programa que asigne valor numerico a las calificaciones //dadas en literal. A=10, M=9, B=8, R=7, S=6, N=5 //Silva Reyes Luis Adrian 19210549 //Ejemplo#9 //Declaracion de variables int CN; char CL; //Asignacion de valor CL = System.Char.Parse(TXTCAL.Text); CN = 0; //Seleccion multiple switch (CL) { case 'A': CN = 10; break; case 'M': CN = 9; break; case 'B': CN = 8; break; case 'R': CN = 7; break; case 'S': CN = 6; break; case 'N': CN = 5; break; default: LBLCAL1.Text = "No valida"; break; } LBLCAL1.Text = CN.ToString(); }
/// <summary> /// Creates a PersonName instance from a CN instance. /// </summary> /// <param name="name">The HL7 V2 CN instance.</param> /// <returns></returns> internal static IPersonName GetPersonNameFromCn(CN name) { IPersonName personName = BaseCDAModel.CreatePersonName(); personName.FamilyName = name.familyname; personName.GivenNames = new List <string> { name.givenname }; if (!string.IsNullOrWhiteSpace(name.prefix)) { personName.Titles = new List <string> { name.prefix }; } return(personName); }
/** * Returns all repetitions of RESULTS COPIES TO (ORO-3). */ public CN[] getRESULTSCOPIESTO() { CN[] ret = null; try { Type[] t = this.getField(3); ret = new CN[t.Length]; for (int i = 0; i < ret.Length; i++) { ret[i] = (CN)t[i]; } } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error ocurred", he); } catch (System.Exception cce) { HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new System.Exception("An unexpected error ocurred", cce); } return(ret); }
/// <summary> Creates a NDL.</summary> /// <param name="message">the Message to which this Type belongs /// </param> public NDL(Message message):base(message) { data = new Type[11]; data[0] = new CN(message); data[1] = new TS(message); data[2] = new TS(message); data[3] = new IS(message, 0); data[4] = new IS(message, 0); data[5] = new IS(message, 0); data[6] = new HD(message); data[7] = new IS(message, 0); data[8] = new IS(message, 0); data[9] = new IS(message, 0); data[10] = new IS(message, 0); }