Example #1
0
        public void SaveEndTime(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddNullableDateTime("EndTime", endTime);

            if (id != 0)
            {
                cmd.CommandText = "update Watching set EndTime=@EndTime where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
        public void SaveDischargeData(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddInt("DischargeTypeId", (int)dischargeTypeId);
            cmd.AddString("DischargeData", dischargeData.GetXmlString());
            cmd.AddNullableDateTime("DischargeDate", dischargeDate);
            if (id == 0)
            {
                cmd.CommandText = "insert into Patients values (DischargeTypeId,@DischargeData,@DischargeDate) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = @"update Patients set DischargeTypeId=@DischargeTypeId,DischargeData=@DischargeData,DischargeDate=@DischargeDate where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
        public void Save(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddInt("PatientId", patientId);
            cmd.AddDateTime("RequestDate", requestDate);
            cmd.AddNullableDateTime("ExecutionDate", executionDate);
            cmd.AddString("ConsultationData", consultationData.GetXmlString());
            if (id == 0)
            {
                cmd.CommandText = "insert into PatientConsultations values (@PatientId,@RequestDate,@ExecutionDate,@ConsultationData) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "update PatientConsultations set PatientId=@PatientId,RequestDate=@RequestDate,ExecutionDate=@ExecutionDate,ConsultationData=@ConsultationData where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
Example #4
0
        public void Save(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddInt("UserId", userId);
            cmd.AddDateTime("StartTime", startTime);
            cmd.AddNullableDateTime("EndTime", endTime);
            cmd.AddString("Data", data.GetXmlString());

            if (id == 0)
            {
                cmd.CommandText = "insert into Watching values (@UserId,@StartTime,@EndTime,@Data) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "update Watching set UserId=@UserId,StartTime=@StartTime,EndTime=@EndTime,Data=@Data where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
        public void Save(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddString("Surname", surname);
            cmd.AddString("Name", name);
            cmd.AddString("MiddleName", middleName);
            cmd.AddInt("Gender", (int)gender);
            cmd.AddNullableDateTime("Birthday", birthday);
            cmd.AddString("IdentificationData", identificationData.GetXmlString());
            if (id == 0)
            {
                cmd.CommandText = "insert into PatientIdentifications values (@Surname,@Name,@MiddleName,@Gender,@Birthday,@IdentificationData) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "update PatientIdentifications set Surname=@Surname,Name=@Name,MiddleName=@MiddleName,Gender=@Gender,Birthday=@Birthday,IdentificationData=@IdentificationData where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
        public void Save(GmConnection conn, DbTransaction trans)
        {
            GmCommand cmd = conn.CreateCommand(trans);

            cmd.AddInt("Id", id);
            cmd.AddInt("ProductId", productId);
            cmd.AddDecimal("Price", price);
            cmd.AddNullableDateTime("ExpiredDate", expiredDate);
            cmd.AddDecimal("CurrentCount", currentCount);
            cmd.AddDecimal("ReservedCount", reservedCount);
            cmd.AddString("Series", series);
            if (id == 0)
            {
                cmd.CommandText = "insert into StoreProducts values (@ProductId,@Price,@ExpiredDate,@CurrentCount,@ReservedCount,@Series) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "update StoreProducts set ProductId=@ProductId,Price=@Price,ExpiredDate=@ExpiredDate,CurrentCount=@CurrentCount,ReservedCount=@ReservedCount,Series=@Series where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }