예제 #1
0
        public AstmORecord ToAstmORecord()
        {
            AstmORecord o = new AstmORecord();

            o.data       = this.data;
            o.isFinished = this.isFinished;
            o.recordType = this.recordType;
            o.Build();
            return(o);
        }
예제 #2
0
        private string UpdateKetQuaTuMayCLS(AstmPRecord patient, AstmORecord order)
        {
            try
            {
                string sql = @"set @idketquatumaycls = (select idketquatumaycls from ketquatumaycls where maketqua=@maketqua AND  LOAIMAY ='E2010');
                               if(@idketquatumaycls is null)
                                    begin
                                        insert into ketquatumaycls(mabenhnhan,TenBenhNhan,ngaythuchien,maketqua,loaimay,stt,mota)
                                        values (@mabenhnhan,@TenBenhNhan,@ngaythuchien,@maketqua,@loaimay,@stt,@mota);
                                        set @idketquatumaycls = @@IDENTITY;
                                    end
                               else 
                                    begin
                                        update ketquatumaycls
                                        set mabenhnhan=@mabenhnhan,
                                            TenBenhNhan=@TenBenhNhan,
                                            ngaythuchien=@ngaythuchien,
                                            maketqua=@maketqua,
                                            loaimay=@loaimay,
                                            stt=@stt,
                                            mota=@mota
                                        where idketquatumaycls = @idketquatumaycls;
                                    end";

                ServerConnect.I.Conn.Open();
                SqlCommand cmd = new SqlCommand(sql, ServerConnect.I.Conn);
                if (order.SpecimenID.Length < 10)
                {
                    string [] a = order.SpecimenID.Split('-');
                    if (a[1].Length == 2)
                    {
                        a[1] = "0" + a[1].ToString();
                    }
                    if (a[1].Length == 1)
                    {
                        a[1] = "00" + a[1].ToString();
                    }
                    order.SpecimenID = a[0].ToString() + "-" + a[1].ToString();
                }
                SqlParameter param1 = new SqlParameter("@idketquatumaycls", SqlDbType.BigInt);
                param1.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(param1);
                SqlParameter param2 = new SqlParameter("@mabenhnhan", SqlDbType.VarChar);
                param2.Direction = ParameterDirection.Input;
                param2.Value     = patient.IDNo;
                cmd.Parameters.Add(param2);
                SqlParameter param3 = new SqlParameter("@TenBenhNhan", SqlDbType.NVarChar);
                param3.Direction = ParameterDirection.Input;
                param3.Value     = patient.Name;
                cmd.Parameters.Add(param3);
                SqlParameter param4 = new SqlParameter("@ngaythuchien", SqlDbType.DateTime);
                param4.Direction = ParameterDirection.Input;
                param4.Value     = getDateTime(order.RequestedOrderedDateTime);
                cmd.Parameters.Add(param4);
                SqlParameter param5 = new SqlParameter("@maketqua", SqlDbType.VarChar);
                param5.Direction = ParameterDirection.Input;
                param5.Value     = order.SpecimenID;
                cmd.Parameters.Add(param5);
                SqlParameter param6 = new SqlParameter("@loaimay", SqlDbType.VarChar);
                param6.Direction = ParameterDirection.Input;
                param6.Value     = "E2010";
                cmd.Parameters.Add(param6);
                SqlParameter param7 = new SqlParameter("@stt", SqlDbType.VarChar);
                param7.Direction = ParameterDirection.Input;
                param7.Value     = order.CollectorID;
                cmd.Parameters.Add(param7);
                SqlParameter param8 = new SqlParameter("@mota", SqlDbType.NVarChar);
                param8.Direction = ParameterDirection.Input;
                param8.Value     = order.SpecimenDescriptor;
                cmd.Parameters.Add(param8);
                if (cmd.ExecuteNonQuery() >= 0)
                {
                    return(cmd.Parameters["@idketquatumaycls"].Value.ToString());
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ex)
            {
                return("");
            }
            finally
            {
                if (ServerConnect.I.Conn.State != ConnectionState.Closed)
                {
                    ServerConnect.I.Conn.Close();
                }
            }
        }